%% David Greene <[EMAIL PROTECTED]> writes: dg> I use target-specific variable definitions for things like CFLAGS dg> and CPPFLAGS.
dg> Unfortunately, GNU make's ability to automatically make makefiles dg> can't take advantage of this: dg> prog: CPPFLAGS = -I/my/include/dir dg> prog: file1.o file2.o dg> %.d: %.c dg> $(CC) -MM $(CPPFLAGS) $< > $@ dg> include file1.d file2.d dg> Since the rule that makes file.d and file2.d is not invoked dg> as a dependency of prog, CPPFLAGS is not set to the correct dg> value. dg> What's the right way to do this? I have a number of dependency dg> includes which need to use different CPPFLAGS to search different dg> header directories. I'd rather not have to define prog_CPPFLAGS, dg> prog2_CPPFLAGS and then do some command magic to use the right dg> variable in the $(CC) -MM invocation depending on the value of [EMAIL PROTECTED] Maybe I can suggest reinterpreting the entire problem? If you move away from the "traditional" dependency generation method you're using here (and the one described in the GNU make manual) and start using the "advanced" dependency generation method described on my web site below (first created by the automake folks), you will get all the CPPFLAGS stuff handled for free and won't have to worry about this. It's good stuff! -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
