From 6ba4d714c671e3a3909b724b1d1e866d35bf3335 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 26 Mar 2002 09:38:47 +0000 Subject: [PATCH] * Makefile.am (maintainer-check): Catch occurrences of `$MAKE foo=bar' in the testsuite. Suggest using `foo=bar $MAKE -e' instead. * tests/ansi3.test, tests/ansi5.test, tests/subobj3.test: Use $MAKE -e. This fixes a ansi5.test failure with Solaris make. * tests/defs: Unset $srcdir, and set $testsrcdir to its old value. * tests/installsh.test (AUTOMAKE, ACLOCAL): Use $testsrcdir. --- ChangeLog | 10 ++++++++++ Makefile.am | 29 ++++++++++++++++++++++++----- Makefile.in | 25 ++++++++++++++++++++----- tests/ansi3.test | 2 +- tests/ansi5.test | 2 +- tests/defs | 5 +++++ tests/installsh.test | 4 ++-- tests/subobj3.test | 2 +- 8 files changed, 64 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc2c85d..28d5612 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2002-03-26 Alexandre Duret-Lutz + * Makefile.am (maintainer-check): Catch occurrences of + `$MAKE foo=bar' in the testsuite. Suggest using + `foo=bar $MAKE -e' instead. + * tests/ansi3.test, tests/ansi5.test, tests/subobj3.test: + Use $MAKE -e. This fixes a ansi5.test failure with Solaris make. + * tests/defs: Unset $srcdir, and set $testsrcdir to its old value. + * tests/installsh.test (AUTOMAKE, ACLOCAL): Use $testsrcdir. + +2002-03-26 Alexandre Duret-Lutz + Fix for PR automake/310: * lib/am/depend2.am, lib/am/lex.am, lib/am/yacc.am: Quote %SOURCE% so it never appears as a plain word. diff --git a/Makefile.am b/Makefile.am index 51977c7..837cdbc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -147,29 +147,48 @@ maintainer-check: automake aclocal fi ## Tests should never call make directly. @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*make'; then \ - echo 'Do not run "make" in the above tests. Use "$$MAKE" instead.' \ + echo 'Do not run "make" in the above tests. Use "$$MAKE" instead.' 1>&2; \ exit 1; \ fi ## Tests should never call autoconf directly. @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*autoconf'; then \ - echo 'Do not run "autoconf" in the above tests. Use "$$AUTOCONF" instead.' \ + echo 'Do not run "autoconf" in the above tests. Use "$$AUTOCONF" instead.' 1>&2; \ exit 1; \ fi ## Tests should never call automake directly. @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*automake'; then \ - echo 'Do not run "automake" in the above tests. Use "$$AUTOMAKE" instead.' \ + echo 'Do not run "automake" in the above tests. Use "$$AUTOMAKE" instead.' 1>&2; \ exit 1; \ fi ## Tests should never call aclocal directly. @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*aclocal'; then \ - echo 'Do not run "aclocal" in the above tests. Use "$$ACLOCAL" instead.' \ + echo 'Do not run "aclocal" in the above tests. Use "$$ACLOCAL" instead.' 1>&2; \ exit 1; \ fi ## Tests should never call perl directly. @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*perl'; then \ - echo 'Do not run "perl" in the above tests. Use "$$PERL" instead.' \ + echo 'Do not run "perl" in the above tests. Use "$$PERL" instead.' 1>&2; \ exit 1; \ fi +## Overriding a Makefile macro on the command line is not portable when +## recursive targets are used. Better use an envvar. SHELL is an exception, +## POSIX says it can't come from the environment. + @if egrep '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \ + echo 'Rewrite "$$MAKE foo=bar SHELL=/bin/sh" as "foo=bar $$MAKE -e SHELL=/bin/sh"' 1>&2; \ + echo ' in the above lines, it is more portable.' 1>&2; \ + exit 1; \ + fi + @if grep -v SHELL $(srcdir)/tests/*.test | grep '\$$MAKE .*=' ; then \ + echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \ + echo 'it is more portable.' 1>&2; \ + exit 1; \ + fi + @if egrep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \ + echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=/bin/sh" in' 1>&2; \ + echo 'the above lines.' 1>&2; \ + exit 1; \ + fi + # Tag before making distribution. Also, don't make a distribution if # checks fail. Also, make sure the NEWS file is up-to-date. diff --git a/Makefile.in b/Makefile.in index 5cc11e2..dad2fbd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -655,23 +655,38 @@ maintainer-check: automake aclocal exit 1; \ fi @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*make'; then \ - echo 'Do not run "make" in the above tests. Use "$$MAKE" instead.' \ + echo 'Do not run "make" in the above tests. Use "$$MAKE" instead.' 1>&2; \ exit 1; \ fi @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*autoconf'; then \ - echo 'Do not run "autoconf" in the above tests. Use "$$AUTOCONF" instead.' \ + echo 'Do not run "autoconf" in the above tests. Use "$$AUTOCONF" instead.' 1>&2; \ exit 1; \ fi @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*automake'; then \ - echo 'Do not run "automake" in the above tests. Use "$$AUTOMAKE" instead.' \ + echo 'Do not run "automake" in the above tests. Use "$$AUTOMAKE" instead.' 1>&2; \ exit 1; \ fi @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*aclocal'; then \ - echo 'Do not run "aclocal" in the above tests. Use "$$ACLOCAL" instead.' \ + echo 'Do not run "aclocal" in the above tests. Use "$$ACLOCAL" instead.' 1>&2; \ exit 1; \ fi @if grep -v '^#' $(srcdir)/tests/*.test | egrep ':[ ]*perl'; then \ - echo 'Do not run "perl" in the above tests. Use "$$PERL" instead.' \ + echo 'Do not run "perl" in the above tests. Use "$$PERL" instead.' 1>&2; \ + exit 1; \ + fi + @if egrep '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \ + echo 'Rewrite "$$MAKE foo=bar SHELL=/bin/sh" as "foo=bar $$MAKE -e SHELL=/bin/sh"' 1>&2; \ + echo ' in the above lines, it is more portable.' 1>&2; \ + exit 1; \ + fi + @if grep -v SHELL $(srcdir)/tests/*.test | grep '\$$MAKE .*=' ; then \ + echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \ + echo 'it is more portable.' 1>&2; \ + exit 1; \ + fi + @if egrep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \ + echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=/bin/sh" in' 1>&2; \ + echo 'the above lines.' 1>&2; \ exit 1; \ fi diff --git a/tests/ansi3.test b/tests/ansi3.test index cb06620..ef7e7fb 100755 --- a/tests/ansi3.test +++ b/tests/ansi3.test @@ -41,5 +41,5 @@ $ACLOCAL \ && $AUTOCONF \ && $AUTOMAKE -a \ && CC='gcc' ./configure \ - && $MAKE ANSI2KNR=./ansi2knr U=_ \ + && ANSI2KNR=./ansi2knr U=_ $MAKE -e \ && ./hello diff --git a/tests/ansi5.test b/tests/ansi5.test index f4c88e2..f9d56b5 100755 --- a/tests/ansi5.test +++ b/tests/ansi5.test @@ -73,6 +73,6 @@ done mv one/Makefile one/Makefile.old sed -e 's,ANSI2KNR =,ANSI2KNR = ./ansi2knr,' < one/Makefile.old > one/Makefile -$MAKE U=_ +U=_ $MAKE -e ./one/joe ./two/maude diff --git a/tests/defs b/tests/defs index 835e964..45bf2f8 100644 --- a/tests/defs +++ b/tests/defs @@ -127,6 +127,11 @@ esac # generated for the tests do not use the installed tools. export AUTOMAKE ACLOCAL +# The tests call `make -e' but we do not want $srcdir from the evironment +# to override the definition from the Makefile. +testsrcdir=$srcdir +unset srcdir + # Turn on shell traces when VERBOSE=x. if test "x$VERBOSE" = xx; then set -x diff --git a/tests/installsh.test b/tests/installsh.test index d21ca2c..7f7c7f1 100755 --- a/tests/installsh.test +++ b/tests/installsh.test @@ -25,8 +25,8 @@ case "$srcdir" in ;; esac -AUTOMAKE="$PERL ../../../automake --libdir=$srcdir/../lib --foreign --Werror" -ACLOCAL="$PERL ../../../aclocal -I ../../../m4 --acdir=$srcdir/../m4" +AUTOMAKE="$PERL ../../../automake --libdir=$testsrcdir/../lib --foreign --Werror" +ACLOCAL="$PERL ../../../aclocal -I ../../../m4 --acdir=$testsrcdir/../m4" # Now we proceed with the test $ACLOCAL || exit 1 diff --git a/tests/subobj3.test b/tests/subobj3.test index 97b7f6a..9be2fa8 100755 --- a/tests/subobj3.test +++ b/tests/subobj3.test @@ -45,5 +45,5 @@ $ACLOCAL \ && $AUTOCONF \ && $AUTOMAKE -a \ && CC='gcc' ./configure \ - && $MAKE ANSI2KNR=./ansi2knr U=_ \ + && ANSI2KNR=./ansi2knr U=_ $MAKE -e \ && ./hello -- 2.7.4