[Top][All Lists]
[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: |
Akim Demaille |
Subject: |
Re: [Automake-NG] [FYI] [ng] vars: names of iterating vars in $(foreach) loops shorter & simpler |
Date: |
Tue, 24 Jul 2012 15:58:47 +0200 |
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.