Hello,

I found a little problem with an example in section 4.14 in the GNU make documentation:

This edition of the GNU Make Manual, last updated 08 July 2002, documents GNU make 
Version 3.80.

If you have targets in subdirectories, the sed call will not work properly because gcc 
will issue a lilne like

b.o: sub/b.c /usr/include/stdio.h /usr/include/features.h ...

$* will be set to sub/b, so the sed substitution command won't find anything to 
substitute. I append my solution. Of course, it will fail if filenames contain colons.

Sincerely,
Jochen


#####################################################
FILES = a.c sub/b.c

all: a sub/b $(CFILES:.c=.d)

a: a.o

sub/b: sub/b.o

%.d: %.c
        @set -e; rm -f $@; \
        $(CC) -M $(CPPFLAGS) $< > [EMAIL PROTECTED]; \
        sed 's,.*:,$*.o $@ : ,g' < [EMAIL PROTECTED] > $@; \
        rm -f [EMAIL PROTECTED]
########################################################







_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to