On 4/28/10, Robert Jørgensgaard Engdahl <r...@bang-olufsen.dk> wrote: > > Hello GNU Make bug-list subscribers > > On > > http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites > > The rule for automatically generating prerequisites is > > %.d: %.c > @set -e; rm -f $@; \ > $(CC) -M $(CPPFLAGS) $< > $...@.$$$$; \ > sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $...@.$$$$ > $@; \ > rm -f $...@.$$$$ > > but could be replaced with > > %.d : %.c > @$(CC) -MT $@ -MT $*.o -MM $(CPPFLAGS) $< > $@ > > This is simpler.
It's also unnecessary - you don't need a rule for %.d at all. You can just generate the dependencies as a side-effect of compilation using -MMD or similar. Then use '-include' to grab all the deps if they exist. By providing a rule for the .d files you'll cause make to re-execute itself, so you'll just end up parsing the Makefile twice. -Mike _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make