bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Minor problem with example form documentation


From: walterj
Subject: Minor problem with example form documentation
Date: Tue, 20 Jul 2004 15:37:23 +0200 (CEST)

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) $< > address@hidden; \
        sed 's,.*:,$*.o $@ : ,g' < address@hidden > $@; \
        rm -f address@hidden
########################################################









reply via email to

[Prev in Thread] Current Thread [Next in Thread]