[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: can I create dynamic variables?
From: |
Paul Smith |
Subject: |
Re: can I create dynamic variables? |
Date: |
Sat, 07 Apr 2007 12:21:04 -0400 |
On Sat, 2007-04-07 at 11:02 +0300, mickey n wrote:
> Hi All,
>
> I wish to create variables based on other variables which are given
> from an included file by pattern.
> something like (lets assume VAR1 and VAR2 are included from a conf
> file):
>
> VAR1 = A
> VAR2 = B
>
> VARS = VAR*
>
>
> I expect VARS to contain 'A B'.
>
> How can I assign VARS like this in valid gnumake syntax? (read the
> manual, couldn't find it)
If you have GNU make 3.80 or better, you can use this:
VARS = $(foreach V,$(filter-out VARS,$(filter VAR%,$(.VARIABLES))),$($(V)))
If you can avoid having the variable you're creating (VARS) match the
same pattern as the variables you're looking for (VAR%), then you can
simplify that a lot:
ALLVARS = $(foreach V,$(filter VAR%,$(.VARIABLES)),$($(V)))
If you don't have GNU make 3.80 or better, then you can't do it at all.
--
-------------------------------------------------------------------------------
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