[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Computed variables and .VARIABLES
From: |
Paul D. Smith |
Subject: |
Re: Computed variables and .VARIABLES |
Date: |
Tue, 13 Dec 2005 15:00:47 -0500 |
%% "Martin d'Anjou" <address@hidden> writes:
md> I try to fish variable names out of .VARIABLES and then use their
md> values, but it does not work:
md> var_t1=foo
md> var_t2=bar
md> not_a_var=boo
md> s=$(filter var_%,$(.VARIABLES))
md> $(warning $s)
md> $(warning $($s))
md> $(warning $($($s)))
"It does not work" is not a bug report. What does it do, and which part
of what it does is not what you expected, and what did you expect
instead? Not to mention, which version of GNU make are you using, what
OS are you using it on, etc.
Your makefile works as expected for me; I get:
/tmp/x5.mk:6: var_t1 var_t2
/tmp/x5.mk:7:
/tmp/x5.mk:8:
make: *** No targets. Stop.
which shows that the .VARIABLES variable is correct and the filter is
correct.
The next line:
$(warning $($s))
doesn't print anything, and that's correct too. Why? If you expand it
you'll see; the variable "s" contains (as the first warning line shows
us), "var_t1 var_t2", so after the first expansion step you'll get:
$(warning $(var_t1 var_t2))
you can already see this won't print anything: there is no variable
"var_t1 var_t2" defined.
You need to expand each word in the return list individually, something
like this:
$(warning $(foreach V,$s,$($V)))
--
-------------------------------------------------------------------------------
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