[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/7] header-vars: new variable $(am__running_with_option)
From: |
Stefano Lattarini |
Subject: |
[PATCH 2/7] header-vars: new variable $(am__running_with_option) |
Date: |
Mon, 29 Apr 2013 23:00:30 +0200 |
This is a preparatory refactoring, needed by later patches.
No semantic change is intended.
* lib/am/header-vars.am (am__running_with_option): New, contains
shell code that determines whether the current make instance is
running with a given one-letter option (e.g., -k, -n) that takes
no argument. Actually, the only supported option at the moment
is '-n' (support for '-k' will be added soon).
(am__make_dryrun): Rewrite as a thin wrapper around
'$(am__make_running_with_option)'.
Signed-off-by: Stefano Lattarini <address@hidden>
---
lib/am/header-vars.am | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index d2f0984..8426dcb 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -31,21 +31,26 @@ VPATH = @srcdir@
## 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 = \
+## Shell code that determines whether the current make instance is
+## running with a given one-letter option (e.g., -k, -n) that takes
+## no argument. Actually, the only supported option at the moment
+## is '-n' (support for '-k' will be added soon).
+am__make_running_with_option = \
{ \
- am__dry=no; \
+ case $${am__target_option-} in \
+ n) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${am__target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ am__has_opt=no; \
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;; \
+ -*$$am__target_option*) am__has_opt=yes; break;; \
esac; \
done; \
else \
@@ -59,7 +64,7 @@ am__make_dryrun = \
## 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 ;; \
+ | grep '^AM OK$$' >/dev/null || am__has_opt=yes ;; \
*) \
am__skip_next=no; \
for am__flg in $$MAKEFLAGS; do \
@@ -72,14 +77,21 @@ am__make_dryrun = \
## 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;; \
+ *$$am__target_option*) am__has_opt=yes; break;; \
esac; \
done ;;\
esac; \
fi; \
- test $$am__dry = yes; \
+ test $$am__has_opt = yes; \
}
+## 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__target_option=n; $(am__make_running_with_option); }
+
## Some derived variables that have been found to be useful.
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
--
1.8.2.1.610.g562af5b
- Re: bug#12554: Checking MAKEFLAGS with RECURSIVE_TARGETS, Stefano Lattarini, 2013/04/29
- [PATCH 0/7][PATCH 0/7] Fix automake bug#12554., Stefano Lattarini, 2013/04/29
- [PATCH 2/7] header-vars: new variable $(am__running_with_option),
Stefano Lattarini <=
- [PATCH 1/7] tests: expose bug#12554 (false positives for presence of '-k' make option), Stefano Lattarini, 2013/04/29
- [PATCH 3/7] tests: remove dead code from t/make-dryrun.tap, Stefano Lattarini, 2013/04/29
- [PATCH 4/7] header-vars: simplify how make flags are determined, Stefano Lattarini, 2013/04/29
- [PATCH 5/7] header-vars: recognize more make flags ('-k' in particular), Stefano Lattarini, 2013/04/29
- [PATCH 6/7] subdirs: don't return false positives for the '-k' option's presence, Stefano Lattarini, 2013/04/29
- [PATCH 7/7] tests: avoid a spurious error with Solaris make, Stefano Lattarini, 2013/04/29