> Date: Sat, 09 Jun 2012 15:57:48 +0300 > From: Shachar Shemesh <shac...@liveu.tv> > CC: bug-make@gnu.org > > At the time I wanted to reply, but failed to find my sources. Today I > happened to stumble on them. The misleading behavior, i.e. - building > two targets with one receipt invocation, is suggested by the > documentation itself (which is where I originally got it too): > > http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites > > We see a suggestion to generate the dependency file as part of the > normal build, and then use sed to turn that into a multi-target rule. > The code, as placed in the documentation, exhibits the same bug as my > original question. Since I was relying on that code (from memory) when I > wrote my incorrect make file, I would like to suggest that this be > considered a bug in the documentation, and that an example be placed > that produces better make scripts.
The manual _does_ use pattern rules, which is what I suggested you to use back then. Here's the example from the manual: %.d: %.c @set -e; rm -f $@; \ $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ All the other examples in the manual are for dependencies only, i.e. rules with no commands. By contrast, your example Makefile used ordinary, non-pattern rules, which don't support the single-execution feature you wanted. Of course, I have no objections against making the manual even more clear on this issue. _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make