bugmake - Bugs: bug #12588, Make conflates multiple targets in...

 
 

bug #12588: Make conflates multiple targets in pattern rule.

Submitted by:  Eric Postpischil <edp>
Submitted on:  Wed 06 Apr 2005 08:25:23 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.80Operating 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.

 

Wed 06 Apr 2005 10:23:01 PM UTC, comment #3:

Ah, I see the interpretation. A static pattern rule with multiple targets means the commands will make all the targets specified by a single value of the wildcard "%", not all the targets that match any value.

Eric Postpischil <edp>
Wed 06 Apr 2005 10:16:35 PM UTC, comment #2:

Then is then following behavior unexpected? Using the first makefile above (with "A/% B/%:"), execute "make A/x A/y B/x B/y". In this case, make builds A/x and A/y. They are both specified in the same pattern rule (in fact, they are both specified by the same target pattern). make appears not to have marked the A/y target as having been updated when it built A/x.

Eric Postpischil <edp>
Wed 06 Apr 2005 08:42:31 PM UTC, comment #1:

This is expected behavior. A pattern rule with multiple patterns in the target position is entirely different from an explicit rule with multiple targets. For pattern rules, multiple target patterns means that ONE invocation of the rule will build ALL the targets.

When make builds the first one it assumes that the command also built the second one, because that's what your makefile said it would do.

See the GNU make manual for details.

Paul D. Smith <psmith>
Project Administrator
Wed 06 Apr 2005 08:25:23 PM UTC, original submission:
  • SUMMARY

When make is given a pattern rule with multiple targets and asked to build two targets identical in the portion matched by the "%" in the pattern, make builds only one of the targets.

  • STEPS TO REPRODUCE

Create "makefile" containing:

A/% B/%:
@echo "Target is $@."

Execute "make A/x B/x". (It is not necessary to create the directories A or B.) make will build A/x, as shown by the output "Target is A/x.", and then reports there is nothing to be done for B/x.

Note that if "make A/x" and "make B/x" are performed separately, each is built.

We might speculate that the identical file name is confusing make, but another experiment shows this is not so. Edit makefile to contain:

%/x %/y:
@echo "Target is $@."

Then execute "make A/x A/y". make builds A/x and reports there is nothing to be done for A/y.

If the targets are listed explicitly, instead of with patterns, as with:

A/x A/y:
@echo "Target is $@."

then make builds both targets. This is what I would expect from the pattern rules.

make reports itself as "GNU Make 3.80", and this is under Mac OS X 10.4.

Eric Postpischil <edp>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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
Wed 06 Apr 2005 08:42:31 PM UTCpsmithOpen/ClosedOpen=>Closed
Wed 06 Apr 2005 08:42:30 PM UTCpsmithStatusNone=>Not A Bug
Wed 06 Apr 2005 08:25:23 PM UTCedpCarbon-Copy-=>Added edp

Back to the top


Powered by Savane 3.1-cleanup1