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.
This fixes disagreements about object file names between the sed command
and the cc command, should the c file not be found in the current
directory.
Perhaps it would be time to make this rule part of the default rules in
GNU Make? In that case, the -MG option should also be considered for
avoiding errors when auto generated headers are included, perhaps via an
CCMFLAGS variable.
Best regards Robert
-------
Robert Jørgensgaard Engdahl
Cum Laude MSc. C.S.
SW-Developer, R&D
Video Services & Applications
Bang & Olufsen A/S
Peter Bangs Vej 15
DK-7600 Struer
Denmark
Phone: (+45) 96 84 44 05
Internal phone: 454405
e-mail: r...@bang-olufsen.dk
Location: Factory 1 - West
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make