[Top][All Lists]

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

Target-specific CPPFLAGS for autodependencies

From: David Greene
Subject: Target-specific CPPFLAGS for autodependencies
Date: Wed, 10 May 2006 14:59:42 -0500
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7.8) Gecko/20050512

I use target-specific variable definitions for things like CFLAGS

Unfortunately, GNU make's ability to automatically make makefiles
can't take advantage of this:

prog: CPPFLAGS = -I/my/include/dir
prog: file1.o file2.o

%.d: %.c
        $(CC) -MM $(CPPFLAGS) $< > $@

include file1.d file2.d

Since the rule that makes file.d and file2.d is not invoked
as a dependency of prog, CPPFLAGS is not set to the correct

What's the right way to do this?  I have a number of dependency
includes which need to use different CPPFLAGS to search different
header directories.  I'd rather not have to define prog_CPPFLAGS,
prog2_CPPFLAGS and then do some command magic to use the right
variable in the $(CC) -MM invocation depending on the value of address@hidden

Thanks again.


reply via email to

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