Shorter and less error-prone rule for automatic prerequisite generation in the GNU Make manual

2010-04-28 Thread Robert Jørgensgaard Engdahl
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,\($*\)\.

Re: Shorter and less error-prone rule for automatic prerequisite generation in the GNU Make manual

2010-04-28 Thread Mike Shal
On 4/28/10, Robert Jørgensgaard Engdahl 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 $@; \ > $

Re: Shorter and less error-prone rule for automatic prerequisite generation in the GNU Make manual

2010-04-28 Thread Edward Welbourne
> 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. Well, if a .d file gets deleted while its .o file exists, you do need to regenerate it - or regenerate the .o (which may cause wasteful

Re: Shorter and less error-prone rule for automatic prerequisite generation in the GNU Make manual

2010-04-28 Thread Philip Guenther
On Wed, Apr 28, 2010 at 7:12 AM, Edward Welbourne wrote: >> 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. > > Well, if a .d file gets deleted while its .o file exists, you do need >

Re: Shorter and less error-prone rule for automatic prerequisite generation in the GNU Make manual

2010-04-28 Thread Robert Jørgensgaard Engdahl
Surely the -MMD solution with -include $(objects:.o=.d) does the trick cleaner than the method mentioned in the manual. Edward, are you rewriting the Make manual? I hope that you do include an example, besides the explanation below. You guys have been most helpful. Cheers Edward Welbourne