On 2009-08-02 16:40Z, mwnn wrote: > Hi all, > The "Auto dependecy generation" mechanism can be used to generation > dependency list for a target automatically. For a C file this can be > done by invoking gcc with the -MM switch. So in a make file we normally > have the following rule to generate dependency files and later include them: > > ------------------------------------------------------------------------------------- > %.d: %.c > @set -e; rm -f $@; \ > $(CC) -M $(CPPFLAGS) $< > $...@.$$$$; \ > sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $...@.$$$$ > $@; \ > rm -f $...@.$$$$ > > sources = foo.c bar.c > > include $(sources:.c=.d) > ------------------------------------------------------------------------------------- > > When using the above facility how can use the "Target specific variable > values" facility? > For example, I would want the CPP flag -DLINUX to be defined for foo.c only.
Set preprocessor flags for generating autodependencies the same way you would for compiling. For example: foo.c: CPPFLAGS += -DLINUX BTW, extra options that have been added to the gnu preprocessor (-MD -MP -MT -MF...) generally make the use of 'sed' unnecessary for autodependencies, and you can even generate them as a side effect of a '%.o: %.c' rule. _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
