[Automake-NG] [FYI Merge branch 'master' into ng/master

2013-05-07 Thread Stefano Lattarini
commit 9b183694a14f5eb93c1aee0d1fb5dcc7c7acbd30
Merge: 00395d4 df3490b
Author: Stefano Lattarini 
Date:   Tue May 7 15:27:21 2013 +0200

Merge branch 'master' into ng/master

* master:
  docs: fix warnings given by Texinfo 5.x
  fixlet: remove leftover comment fragment
  master branch: we are going to become Automake 2.0
  maint branch: we are going to become Automake 1.14
  maint: version bump after beta release 1.13.1d
  release: beta release 1.13.1d (will become 1.13.2)
  NEWS: document more robust handling/recognition of make options
  tests: typofixes in comments in t/preproc-c-compile.sh
  tests: remove bashism from a test
  maint: targets and recipes to simplify testing on real-world packages
  build: preparatory refactoring
  build: tiny reduction in code duplication
  make flags analysis: handle more options with args
  make flags analysis: use simpler variable names
  make flags analysis: whitespace changes
  make flags analysis: embed in a subshell
  make flags analysis: be more robust
  make flags analysis: cater to GNU make 3.83 (still unreleased as of now)
  tests: expose weaknesses in make flags analysis
  tests: improve debugging output in checks on make flags analysis
  make flags analysis: refactor, to reduce code duplication
  tests: avoid one tricky use of "make -e"
  cosmetics: remove few trailing whitespace occurrences
  typofix: in NEWS (extra whitespace)
  compat: substitute '@mkdir_p@' as '$(MKDIR_P)' unconditionally
  tests: avoid a spurious error with Solaris make
  subdirs: don't return false positives for the '-k' option's presence
  header-vars: recognize more make flags ('-k' in particular)
  header-vars: simplify how make flags are determined
  tests: remove dead code from t/make-dryrun.tap
  header-vars: new variable $(am__running_with_option)
  tests: expose bug#12554 (false positives for presence of '-k' make option)

Signed-off-by: Stefano Lattarini 



[Automake-NG] [FYI] make flags analysis: take advantage of GNU make features

2013-05-07 Thread Stefano Lattarini
* lib/am/header-vars.mk: Here.  In particular ...
(am__make_keepgoing): ... rename this ...
(am.make.keep-going): ... like this, and reimplement using ...
(am.make.is-running-with-option): ... this new macro, cannibalized
from the old version of the 'am.make.dry-run' macro.
(am.make.dry-run): Reimplement using such new macro.
* lib/am/subdirs.mk: Adjust.
* t/make-keepgoing.tap: Likewise.  While at, simplify by assuming
that $MAKE is GNU make, and enhance to test more setups (in particular,
this makes this test more in sync with the test 't/make-dryrun.tap').
* t/make-dryrun.tap: While at it, remove an extra empty line.

Signed-off-by: Stefano Lattarini 
---
 lib/am/header-vars.mk | 115 ++
 lib/am/subdirs.mk |   2 +-
 t/make-dryrun.tap |   1 -
 t/make-keepgoing.tap  |  75 +++-
 4 files changed, 57 insertions(+), 136 deletions(-)

diff --git a/lib/am/header-vars.mk b/lib/am/header-vars.mk
index d31bb60..37f0c87 100644
--- a/lib/am/header-vars.mk
+++ b/lib/am/header-vars.mk
@@ -158,99 +158,28 @@ am.vpath.rewrite = \
 # with mainline Automake.
 DESTDIR ?=
 
-# Tell whether make is running in "dry mode".  It is either 'true' or
-# 'false', so that it can be easily used in shell code as well as in
-# GNU make conditionals.  Use $(MFLAGS), not $(MAKEFLAGS), since the
-# former doesn't containing the command line variable definitions, and
-# it always begins with a hyphen unless it is empty, assumptions that
-# allow a simpler implementation.
-am.make.dry-run := \
-  $(if $(findstring n,$(filter-out --%,$(MFLAGS))),true,false)
-
-## 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.
-## FIXME: copied over from mainline Automake.  This should be later
-##discarder!
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-
-## FIXME: copied over from mainline Automake.  Rewrite to be GNU make
-##   specific, please!
-## 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 = \
-  case $${target_option-} in \
-  ?) ;; \
-  *) echo "am__make_running_with_option: internal error: invalid" \
-  "target option '$${target_option-}' specified" >&2; \
- exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-## The format of $(MAKEFLAGS) is quite tricky with GNU make; the
-## variable $(MFLAGS) behaves much better in that regard.  So use it.
-sane_makeflags=$$MFLAGS; \
-  else \
-## Non-GNU make: we must rely on $(MAKEFLAGS).  This is tricker and more
-## 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.
-  *\\[\ \  ]*) \
-## Extra indirection with ${bs} required by FreeBSD 8.x make.
-## Not sure why (so sorry for the cargo-cult programming here).
-bs=\\; \
-sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-  | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-test $$skip_next = yes && { skip_next=no; continue; }; \
-case $$flg in \
-  *=*|--*) continue;; \
-##
-## GNU make 3.83 has changed the format of $MFLAGS, and removed the space
-## between an option and its argument (e.g., from "-I dir" to "-Idir").
-## So we need to handle both formats, at least for options valid in GNU
-## make.  OTOH, BSD make formats $(MAKEFLAGS) by separating all options,
-## and separating any option from its argument, so things are easier
-## there.
-##
-## For GNU make and BSD make.
--*I) strip_trailopt 'I'; skip_next=yes;; \
-  -*I?*) strip_trailopt 'I';; \
-## For GNU make >= 3.83.
--*O) strip_trailopt 'O'; skip_next=yes;; \
-  -*O?*) strip_trailopt 'O';; \
-## For GNU make (possibly overkill, this one).
--*l) strip_trailopt 'l'; skip_next=yes;; \
-  -*l?*) strip_trailopt 'l';; \
-## For BSD make.
-  -[dEDm]) skip_next=yes;; \
-## For NetBSD make.
-  -[JT]) skip_next=yes;; \
-esac; \
-case $$flg in \
-  *$$target_option*) has_opt=yes; break;; \
-esac; \
-  done; \
-  test $$has_opt = yes
-
-## Shell code that determines whether make is running in "keep-going mode"
-## ("make -k") or not.  Useful in ru