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

 
 

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

Submitter:  Mike Hommey <glandium>
Submitted:  Wed 23 Jul 2014 11:32:34 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.0 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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:

foo bar: ; echo $@

is identical to writing this:

foo: ; echo $@
bar: ; echo $@

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:

%/host:
        @echo $@
%/target:
        @echo $@


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>
Group 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 Files:
   
   
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
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by glandium (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-09-21 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed
    2014-07-23 glandium Attached File- Added test.mk, #31762

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code