help-gnu-utils
[Top][All Lists]
Advanced

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

Re: gmake - how to generate variable assignments?


From: Bill Godfrey
Subject: Re: gmake - how to generate variable assignments?
Date: 18 Dec 2004 00:20:52 GMT

Ernest <wmozart5NOSPAM@NOSPAMyahoo.com> wrote:
> And I want to be able to generate *global* variable assignments (which
> may need to be used later in multiple targets) of the form:

Not sure what you mean by that. I think all make variables are global, so
your emphasis puzzles me.

> foo1_VAR = ${VALUES}
> foo2_VAR = ${VALUES}

No idea if this is any use to you, but you can do...

$($(SOMEVARIABLE)_VAR)

Here, $(SOMEVARIABLE) is expanded (to say, 'foo1') which is then inserted
in causing $(foo1_VAR) to be expanded.

Since you are starting off with a variable holding a list of items, you may
want to use this trick inside foreach.

VARS=foo bar baz
foo_VAR=the_value_of_foo
bar_VAR=the_value_of_bar
baz_VAR=the_value_of_baz

ALL_VARS=$(foreach x,$(VARS),$($(x)_VAR))

(I've not tested that. I may be totally wrong.)

Bill, may be totally wrong.


reply via email to

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