dryrun: fix regression with '$(am__make_dryrun)'
In commit v1.11-683-gda0964e of 05-02-2012, we introduced a new
variable '$(am__make_dryrun)' that could be used in recipes to
determine whether make is running in dry mode (e.g., as with
"make -n"). Unfortunately, the idiom we used fails to take into
account the case in which $(MAKEFLAGS) contains one or more variable
definitions whose value is a whitespace-separated list; for example,
if we invoke make as:
make check TESTS="n1.test n2.test"
then the better make implementations out there (at least modern
GNU make and BSD make) will export MAKEFLAGS to the following
value:
TESTS=n1.test\ n2.test
So a shell loop like the one we used in $(am__make_dryrun):
for flag in $$MAKEFLAGS; do ...
won't behave as expected: the shell word-splitting rules will break
up the entry for TESTS into the two distinct entries "TESTS=n1.test\"
and "n2.test", and this second entry will goad our $(am__make_dryrun)
code into thinking that make is performing a dry run!
So now we simply loop over the expanded value of $(MAKEFLAGS).
This solves the regression, but alas, is more brittle in case the
users passes on the command line a macro value containing unbalanced
" or ' quotes, or shell metacharacters like, say, '`' or '('. This
should almost never happen though, so we don't worry about it now;
we will revisit the issue only when and if we receive bug reports in
this area.
* lib/am/header-vars.am (am__make_dryrun): Fix.
* tests/make-dryrun.test: New test.
* tests/list-of-tests.mk: Add it.