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 ([EMAIL PROTECTED])


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to