bugmake - Bugs: bug #42833, Prunes targets with pattern rules...

 
 

bug #42833: Prunes targets with pattern rules for no obvious reason

Submitted by:  Mike Hommey <glandium>
Submitted on:  Wed 23 Jul 2014 11:32:34 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 4.0Operating System: POSIX-Based
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 21 Sep 2014 08:39:15 PM UTC, comment #1:

To me make's behavior seems correct.

Possibly you've missed the difference in behavior between explicit rules with multiple targets and pattern rules with multiple targets. An explicit rule with N multiple targets is identical to writing the same rule N times, once with each target. So this:
is identical to writing this:
This appears to be what you want.

However, pattern rules are different; see http://www.gnu.org/software/make/manual/make.html#Pattern-Intro

A pattern rule with multiple targets tells make that ONE invocation of that recipe will build BOTH targets. That's why you don't see both the /host and /target generated: make invokes one of them and expects the recipe to build both, so later when the other is listed as a prerequisite make thinks it's already been built.

You have to write your pattern rules like this then it should work as you expect:

If I've misunderstood the situation add a comment with more detail (maybe a simpler test-case) and I'll re-open this bug.

Paul D. Smith <psmith>
Project Administrator
Wed 23 Jul 2014 11:32:34 AM UTC, original submission:

With the attached reduced testcase, running make -f test.mk recurse_compile doesn't yield all the possible values. It skips modules/libbz2/src/target. modules/libmar/src/target, toolkit/crashreporter/google-breakpad/src/common/linux/target and toolkit/crashreporter/google-breakpad/src/common/target.
However, if you run make -f test.mk toolkit/library/gtest/target, which is one of the dependencies of the recurse_compile target, the toolkit/crashreporter/* ones are there, as expected from the dependencies.

make -d tells they are pruned, and I see no obvious reason why, b ut maybe I'm wrong.

When not using pattern rules, it works appropriately.

Mike Hommey <glandium>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #31762:  test.mk added by glandium (18KiB - text/x-makefile - test.mk)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by glandium (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 21 Sep 2014 08:39:15 PM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed
    Wed 23 Jul 2014 11:33:08 AM UTCglandiumAttached File-=>Added test.mk, #31762

    Back to the top


    Powered by Savane 3.1-cleanup1