[Top][All Lists]

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

Re: how to indirect access a variable

From: Paul D. Smith
Subject: Re: how to indirect access a variable
Date: Mon, 27 Oct 2003 17:21:13 -0500

%% "Yanghui Bian" <address@hidden> writes:

  yb> blocks := a b

  yb> a_property := 0 1 2 3

  yb> b_property := 2 3 8 9

  yb> How can I get a list of property in the first column for the all
  yb> the blocks?

  yb> I try to use the foreach as below:

  yb> block_properties := $(foreach block, $(blocks), $(block)_property)

Not quite.  $(block)_property expands to the _names_ of the variables;
so the result will be:

    a_property b_property

You want to expand to the _values_ of those variables, so you need an
extra variable reference:

    block_properties := $(foreach block, $(blocks), $($(block)_property))
                                                    ^^                  ^

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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