Wed 06 Apr 2005 08:25:23 PM UTC, original submission:
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.
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.
|