summaryrefslogtreecommitdiff
path: root/lib/am
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-05-01 23:26:42 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-05-01 23:27:14 +0200
commite242b44eedb39afa0dbd72a74f56b2863c2aaf55 (patch)
tree791840faf579d14c50af9a292cb1879f83163699 /lib/am
parent425fe1e87a78985c0d51ebb185793e57cdd433da (diff)
downloadautomake-e242b44eedb39afa0dbd72a74f56b2863c2aaf55.tar.gz
make flags analysis: refactor, to reduce code duplication
And make it a little more reliable. * t/header-vars.am (am__make_running_with_option): Here. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 'lib/am')
-rw-r--r--lib/am/header-vars.am40
1 files changed, 17 insertions, 23 deletions
diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index 4ad17835d..3de46dca2 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -44,15 +44,11 @@ am__make_running_with_option = \
exit 1;; \
esac; \
am__has_opt=no; \
+ am__flags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
-## GNU make: $(MAKEFLAGS) is quite tricky there, while the older variable
-## $(MFLAGS) behaves much better. So use the latter.
- for am__flg in $$MFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- -*$$am__target_option*) am__has_opt=yes; break;; \
- esac; \
- done; \
+## The format of $(MAKEFLAGS) is quite tricky with GNU make; the
+## variable $(MFLAGS) behaves much better in that regard. So use it.
+ am__flags=$$MFLAGS; \
else \
## Non-GNU make: we must rely on $(MAKEFLAGS). This is tricker and more
## brittle, but is the best we can do.
@@ -68,24 +64,22 @@ am__make_running_with_option = \
am__bs=\\; \
am__flags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$am__bs$$am__bs[$$am__bs $$am__bs ]*//g"`;; \
- *) \
- am__flags=$$MAKEFLAGS;; \
esac; \
- am__skip_next=no; \
- for am__flg in $$am__flags; do \
- if test $$am__skip_next = yes; then \
- am__skip_next=no; \
- continue; \
- fi; \
- case $$am__flg in \
- *=*|--*) ;; \
+ fi; \
+ am__skip_next=no; \
+ for am__flg in $$am__flags; 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 ones actually,
## but let's wait until the need arises.
- -I) am__skip_next=yes;; \
- *$$am__target_option*) am__has_opt=yes; break;; \
- esac; \
- done;\
- fi; \
+ -I) am__skip_next=yes;; \
+ *$$am__target_option*) am__has_opt=yes; break;; \
+ esac; \
+ done;\
unset am__skip_next am__flg am__flags am__target_option; \
test $$am__has_opt = yes; \
}