automake-ng
[Top][All Lists]
Advanced

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

Re: [Automake-NG] [FYI] [ng] vars: names of iterating vars in $(foreach)


From: Stefano Lattarini
Subject: Re: [Automake-NG] [FYI] [ng] vars: names of iterating vars in $(foreach) loops shorter & simpler
Date: Tue, 24 Jul 2012 16:03:16 +0200

On 07/24/2012 03:58 PM, Akim Demaille wrote:
> 
> Le 24 juil. 2012 à 15:45, Stefano Lattarini a écrit :
> 
>> In GNU make, after a "$(foreach x,...)" loop, the make variable $(x):
>>
>>  - is restored to its original variable it had before the 'foreach'
>>    loop, if it was already set;
>>
>>  - re-unset otherwise.
>>
>> This behaviour is checked by the recent spy test 't/spy-foreach.sh'.
>>
>> This means that, in most situations, there's no actual need to use
>> a "namespace safe" variable name for the iterating variable in a
>> "$(foreach ...)" loop, because that variable won't linger in the
>> environment after the loop anyway.
>>
>> * lib/am/compile.am, lib/am/header-vars.am, lib/am/parallel-tests.am,
>> lib/am/serial-tests.am: Adjust to use simpler variables names in their
>> foreach loops; for example, simply 'v' instead of 'am__v', etc.
> 
> I might be stretching things too far, but imagine that some
> one defines v in her Makefile.am, at the top level, because
> for instance she can factor longish definitions in EXTRA_DIST.
> 
> v = headers/include/pkg
> EXTRA_DIST = $(v)/1.h $(v)/2.h $(v)/3.h $(v)/4.h $(v)/5.h
> 
> Then I guess you are capturing this $(v) to mean something else.
> 
No.  My point is exactly that, even with your "devil's advocate"
example above, the use of an "$(foreach v, ...)" construct between
the 'v' and 'EXTRA_DIST' definition would not cause any problem!
Isn't that great? :-)  See also new test 't/spy-foreach.sh'.

Regards,
  Stefano



reply via email to

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