From: Stefano Lattarini Date: Tue, 24 Jul 2012 13:23:08 +0000 (+0200) Subject: [ng] vars: names of iterating vars in $(foreach) loops shorter & simpler X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62558c73a5477adda8a377e3643e26075f0b91e3;p=thirdparty%2Fautomake.git [ng] vars: names of iterating vars in $(foreach) loops shorter & simpler 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. Signed-off-by: Stefano Lattarini --- diff --git a/lib/am/compile.am b/lib/am/compile.am index f874550b7..af96a3c07 100644 --- a/lib/am/compile.am +++ b/lib/am/compile.am @@ -21,8 +21,8 @@ AM_DEFAULT_INCLUDES = \ ## unaesthetic in non-VPATH builds, so get rid of it if it is not ## actually needed. $(call am.util.uniq, -I. -I$(srcdir) \ - $(foreach am__h, $(AM_CONFIG_HEADERS), \ - $(patsubst %/,%,-I$(dir $(am__h))))))) + $(foreach h, $(AM_CONFIG_HEADERS), \ + $(patsubst %/,%,-I$(dir $h)))))) else !%?STDINC% AM_DEFAULT_INCLUDES = endif !%?STDINC% diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am index 4769cba74..16a0e4081 100644 --- a/lib/am/header-vars.am +++ b/lib/am/header-vars.am @@ -138,9 +138,9 @@ am.vpath.rewrite = \ ## hack with $(subst \ , ...). am.make.dry-run := \ $(strip $(if $(strip \ - $(foreach am__v, $(subst \ ,,$(strip $(MAKEFLAGS))), \ - $(if $(or $(findstring =,$(am__v)),$(filter --%,$(am__v))),, \ - $(findstring n,$(am__v))))), \ + $(foreach v, $(subst \ ,,$(strip $(MAKEFLAGS))), \ + $(if $(or $(findstring =,$v),$(filter --%,$v)),, \ + $(findstring n,$v)))), \ true, false)) # An empty string. It can be very useful to "fool" the make parser w.r.t. diff --git a/lib/am/parallel-tests.am b/lib/am/parallel-tests.am index 22e1f108d..a31828144 100644 --- a/lib/am/parallel-tests.am +++ b/lib/am/parallel-tests.am @@ -87,10 +87,10 @@ am__tpfx = \ ## FIXME: this will pick up the default from the environment; are we sure ## FIXME: we want that? !TEST_EXTENSIONS ?= .test -!$(foreach am__e,$(filter-out .%,$(TEST_EXTENSIONS)),\ -! $(call am.error,invalid test extension: '$(am__e)')) -!$(foreach am__e,$(TEST_EXTENSIONS), \ -! $(eval $(call am__handle_per_suffix_test,$(am__e)))) +!$(foreach e,$(filter-out .%,$(TEST_EXTENSIONS)),\ +! $(call am.error,invalid test extension: '$e')) +!$(foreach e,$(TEST_EXTENSIONS), \ +! $(eval $(call am__handle_per_suffix_test,$e))) ## It is *imperative* that the "empty" suffix goes last. Otherwise, a ## declaration like "TESTS = all.test" would cause GNU make to mistakenly ## try to build the 'all.log' and 'all.trs' files from a non-existent diff --git a/lib/am/serial-tests.am b/lib/am/serial-tests.am index 7a8f071d5..8850dbb91 100644 --- a/lib/am/serial-tests.am +++ b/lib/am/serial-tests.am @@ -23,7 +23,7 @@ if %?HANDLE-EXEEXT% am__check_cook_with_exeext_1 = \ $(if $(filter $(am.all-progs), $1), $1$(EXEEXT), $1) am__check_cook_with_exeext = $(strip \ - $(if $(EXEEXT), $(foreach am__t, $1, $(call $(0)_1, $(am__t))), $1)) + $(if $(EXEEXT), $(foreach t, $1, $(call $(0)_1, $t)), $1)) else !%?HANDLE-EXEEXT% am__check_cook_with_exeext = $(strip $1) endif !%?HANDLE-EXEEXT%