|
From: | John Graham-Cumming |
Subject: | Re: looking for help with auto creating rules with eval hierarchically |
Date: | Thu, 16 Mar 2006 14:49:32 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
PATTON, BILLY (SBCSI) wrote:
This works fine for proj alias PROJECTS Now looking at each of the PROJECTS I need to create the same thing $(foreach var for each of the BB_<proj> But I don't want to hard code all the names. This needs to be expandable in the future This will then be further created for the TOPIC_<proj>_<bb> My first best try $foreach proj,${PROJECTS}, Will give me the list names $(addprefix BB_,${PROJECTS}) So would it be something like $(foreach proj,${PROJECTS} # to capture project name , $(foreach bb, $(addprefix BB_,${proj})) # name of list BB_<proj> , $(eval $(call dummy_template, ${bb})) # call define) # foreach
What you want to do is calculate the name of a variable and then get its value. That's trivial in GNU Make. For example, take a look at this:
X := Y YY := Hello! all: @echo $($X$X)This will print Hello! because $($X$X) will first be expanded to $(YY) because X = Y and then $(YY) will be expanded to Hello! So in your example what you want to do is this:
$(foreac proj,$(PROJECTS),$(foreach bb,$(BB_$(proj)), $(eval $(call dummy_template,$(bb)))))
John. -- John Graham-Cumming address@hidden Home: http://www.jgc.org/ Blog: http://www.jgc.org/blog/ POPFile: http://getpopfile.org/ GNU Make Standard Library: http://gmsl.sf.net/ GNU Make Debugger: http://gmd.sf.net/ Fast, Parallel Builds: http://www.electric-cloud.com/ Sign up for my Spam and Anti-spam Newsletter at http://www.jgc.org/
[Prev in Thread] | Current Thread | [Next in Thread] |