]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] vars: names of iterating vars in $(foreach) loops shorter & simpler
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 24 Jul 2012 13:23:08 +0000 (15:23 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 24 Jul 2012 14:08:06 +0000 (16:08 +0200)
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 <stefano.lattarini@gmail.com>
lib/am/compile.am
lib/am/header-vars.am
lib/am/parallel-tests.am
lib/am/serial-tests.am

index f874550b78264c133e7fc264046a8d7575b04773..af96a3c0708c23ed476ed6995bb6774ba6daea9a 100644 (file)
@@ -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%
index 4769cba7421ff3e9b4747ec5b2a2e6c84e247e86..16a0e408111974f837efa5999eeccad1e24ec94b 100644 (file)
@@ -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.
index 22e1f108da73c73302b9b8f968b22548cafa062b..a31828144ba8cbf2d35b64fbe9955260d73946d8 100644 (file)
@@ -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
index 7a8f071d5e6af947ea5a4a63e5affed4b74a9649..8850dbb9124eba4c2ce2bc2ba76d9ac1e9f39cbf 100644 (file)
@@ -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%