summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-04-26 20:39:40 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-04-26 20:39:40 +0200
commitf0d1288f3a2033577ee4e374d203bcb5d8477a9d (patch)
tree6e1a97cfbc993020a88b3e854317f7cc5fb41cd6 /lib
parentad5816114582e329cfaf6df84ebfd6ddba190e34 (diff)
parent3fd147d8cf435e337bc9c6270da23633993967cf (diff)
downloadautomake-f0d1288f3a2033577ee4e374d203bcb5d8477a9d.tar.gz
Merge branch 'branch-1.13.2' into maint
* branch-1.13.2: docs: issues with configure substitutions in TESTS tests: avoid possible autotools caching issues (automake bug#13832) docs: add myself and Ralf Wildenhues as authors authors: add myself dry-run: don't get confused by '-I' option tests: avoid a spurious failure with the Korn Shell dry-run: with GNU make, prefer $(MFLAGS) over $(MAKEFLAGS) header vars: can determine whether we are running under GNU make NEWS: improve wording for automake bug#13514 fix NEWS: document fix for automake bug#13514
Diffstat (limited to 'lib')
-rw-r--r--lib/am/header-vars.am57
1 files changed, 41 insertions, 16 deletions
diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index 9fda37cbe..d2f098425 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -26,32 +26,57 @@ VPATH = @srcdir@
## a vendor make.
## DESTDIR =
+## Shell code that determines whether we are running under GNU make.
+## This is somewhat of an hack, and might be improved, but is good
+## enough for now.
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+
## Shell code that determines whether make is running in "dry mode"
## ("make -n") or not. Useful in rules that invoke make recursively,
## and are thus executed also with "make -n" -- either because they
## are declared as dependencies to '.MAKE' (NetBSD make), or because
## their recipes contain the "$(MAKE)" string (GNU and Solaris make).
-
am__make_dryrun = \
{ \
am__dry=no; \
- case $$MAKEFLAGS in \
-## If we run "make TESTS='snooze nap'", GNU make will export MAKEFLAGS
-## to "TESTS=foo\ nap", so that the simpler loop below (on word-splitted
+ if $(am__is_gnu_make); then \
+## GNU make: $(MAKEFLAGS) is quite tricky there, and the older
+## $(MFLAGS) variable behaves much better.
+ for am__flg in $$MFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ -*n*) am__dry=yes; break;; \
+ esac; \
+ done; \
+ else \
+## Non-GNU make: we must rely on $(MAKEFLAGS). This is tricky and brittle,
+## but is the best we can do.
+ case $$MAKEFLAGS in \
+## If we run "make TESTS='snooze nap'", FreeBSD make will export MAKEFLAGS
+## to " TESTS=foo\ nap", so that the simpler loop below (on word-splitted
## $$MAKEFLAGS) would see a "make flag" equal to "nap", and would wrongly
## misinterpret that as and indication that make is running in dry mode.
-## This has already happened in practice. So we need this hack.
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
+## This has already happened in practice. So we need this unpleasant hack.
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes ;; \
+ *) \
+ am__skip_next=no; \
+ for am__flg in $$MAKEFLAGS; do \
+ if test $$am__skip_next = yes; then \
+ am__skip_next=no; \
+ continue; \
+ fi; \
+ case $$am__flg in \
+ *=*|--*) ;; \
+## Quite ugly special-casing. We might need other similar, but let's
+## wait until the need arises.
+ -I) am__skip_next=yes;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done ;;\
+ esac; \
+ fi; \
test $$am__dry = yes; \
}