On Mon, 2010-08-09 at 11:54 -0700, Philip Prindeville wrote: > I guess I was thinking that variables are exported between makes the > same way that environments variables are passed between processes.
Well, certainly variables CAN be exported by make (see the "export" command) and passed to sub-makes that way. However, those variables have the least "priority" so you have to be very careful. Using "make CFLAGS=-DA" would still not be possible because that would override the env. var. You could run "CFLAGS=-DA make" and that would work. Also, see the -e flag to make which allows env. vars. to have a higher precedence than makefile vars... but this is highly dangerous because users might have odd env. vars. in their ~/.bashrc etc. Hm. Actually, you might be able to do this, because you can reset the MAKEOVERRIDES variable to empty. Of course that would delete ALL command line variables, so it could limit your flexibility on the command line. But, what you'd do is override and export CFLAGS, then set MAKEOVERRIDES to empty so that sub-makes wouldn't have any command-line settings. Now I think sub-makes would get the value of CFLAGS from their parent. It would have to be tested and proven; there may be subtle areas that are not well-behaved. > This will require rewriting several hundred makefiles. I don't think there's any possible way to do this without changing makefiles. It's a good idea to test the implementation on a small subset before creating a huge environment based on that implementation :-) If you're going to have to do this anyway you might consider changing your makefile environment so that individual makefiles only set a few variables and all common bits are contained in some command makefiles that are "include"'d by the rest. This can drastically cut down on the amount of editing you have to do when you change things. -- ------------------------------------------------------------------------------- Paul D. Smith <psm...@gnu.org> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make