help-make
[Top][All Lists]
Advanced

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

Combining "auto dependency generation" with "Target specific variable va


From: mwnn
Subject: Combining "auto dependency generation" with "Target specific variable values"
Date: Sun, 02 Aug 2009 22:10:08 +0530
User-agent: Thunderbird 2.0.0.22 (X11/20090605)

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

    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.

Regards,
mwnn





reply via email to

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