help-make
[Top][All Lists]
Advanced

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

Automatic Prerequisites with subdirectories


From: Sebastian Setzer
Subject: Automatic Prerequisites with subdirectories
Date: Tue, 29 Oct 2002 16:38:43 +0100
User-agent: Mutt/1.2.5.1i

In the manual of make, there is an example how to generate
prerequisite-rules automatically. It doesn't work for targets in
subdirectories because gcc doesn't print the directory of the target.

Here's how it works: (the sed command is changed in 2 places)

%.d: %.c
        set -e; echo "Making $@"; $(CC) -MM $(CPPFLAGS) $< \
                | sed 's#\($(*F)\)\.o[ :]*#\$*.o $@ : #g' > $@; \
                [ -s $@ ] || rm -f $@

I there's no pitfall in my rule, the manual should probably be updated.

-- 

Sebastian Setzer (address@hidden)




reply via email to

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