[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: only run submake if that submake needs to be run?
From: |
Paul D. Smith |
Subject: |
Re: only run submake if that submake needs to be run? |
Date: |
Fri, 20 Aug 2004 15:49:09 -0400 |
%% Boris Kolpackov <address@hidden> writes:
>> 2. I want to use the same variable namespace for all the makefiles.
bk> This one is a bit trickier but there is a way to achieve
bk> this. Here is the idea. There is a special make variable called
bk> `.VARIABLES' which contains names of all variables defined up to
bk> the point. With this variable you can write two functions that
bk> will save and restore values of all variables; I called them
bk> `frame-enter' and `frame-leave'. Now having those two functions
bk> you can write function `import-rules' like this:
bk> define import-rules-body
bk> $(call frame-enter)
bk> include $1
bk> $(call frame-leave)
bk> endef
bk> define import-rules
bk> $(eval $(call import-rules-body,$1))
bk> endef
I didn't look to see how these are defined but I don't see how they can
work in general.
Consider, for example, something like this:
XXFLAGS += -a
foo.yy: foo.xx
$(XX) $(XXFLAGS) -o $@ $<
The XXFLAGS reference is embedded into a rule, so if you change the name
of the variable it won't resolve properly when the rule is invoked.
You can do this kind of frame idea only if you never have any rules
defined in your included makefiles... right?
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> 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