automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ansi5.test fix


From: Alexandre Duret-Lutz
Subject: ansi5.test fix
Date: Thu, 21 Mar 2002 16:34:51 +0100
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (i386-debian-linux-gnu)

I'd like an approval (or disapproval) for this patch.

ansi5.test fails on SunOS because it runs

  $MAKE U=_

but make does not propagate the U=_ setting to sub-makes.

The symptom is

Making all in one
make: Warning: Can't find `.deps/joe.Po': No such file or directory
Current working directory /tmp/a/automake-1.6a/tests/testSubDir/one
make: Fatal error in reader: Makefile, line 165: Read of include file 
`.deps/joe.Po' failed
Current working directory /tmp/a/automake-1.6a/tests/testSubDir/one
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
FAIL: ansi5.test

where `.deps/joe.Po' was in fact `.deps/joe$U.Po'.

I think using 

   U=_ $MAKE -e

would be better, but I'm wondering if there are some
drawbacks with using -e.

The patch below updates maintainer-check to detect occurrences of
"$MAKE foo=bar" and suggest "foo=bar $MAKE -e".  There is an
exception which is SHELL: POSIX says the SHELL envvar should
never override the $(SHELL) macro (GNU make and SunOS make
follow this, but BSD make does not).  So whenever SHELL is
overriden, it needs to be done from the arguments, as in
{ansi,insh2,texinfo,texinfo8}.test.


Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.1791
diff -u -r1.1791 ChangeLog
--- ChangeLog   2002/03/21 11:27:14     1.1791
+++ ChangeLog   2002/03/21 15:34:04
@@ -1,5 +1,15 @@
 2002-03-21  Alexandre Duret-Lutz  <address@hidden>
 
+       * 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.
+       * tests/defs: Unset $srcdir, and set $testsrcdir to its old value.
+       * tests/installsh.test (AUTOMAKE, ACLOCAL): Use $testsrcdir.
+
+2002-03-21  Alexandre Duret-Lutz  <address@hidden>
+
        * tests/dirname.test: Don't use $SHELL when calling ./configure.
 
 2002-03-21  Alexandre Duret-Lutz  <address@hidden>
Index: Makefile.am
===================================================================
RCS file: /cvs/automake/automake/Makefile.am,v
retrieving revision 1.186
diff -u -r1.186 Makefile.am
--- Makefile.am 2002/03/21 09:11:54     1.186
+++ Makefile.am 2002/03/21 15:34:04
@@ -147,29 +147,48 @@
        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.
Index: tests/ansi3.test
===================================================================
RCS file: /cvs/automake/automake/tests/ansi3.test,v
retrieving revision 1.7
diff -u -r1.7 ansi3.test
--- ansi3.test  2001/12/26 08:22:05     1.7
+++ ansi3.test  2002/03/21 15:34:05
@@ -41,5 +41,5 @@
    && $AUTOCONF \
    && $AUTOMAKE -a \
    && CC='gcc' ./configure \
-   && $MAKE ANSI2KNR=./ansi2knr U=_ \
+   && ANSI2KNR=./ansi2knr U=_ $MAKE -e \
    && ./hello
Index: tests/ansi5.test
===================================================================
RCS file: /cvs/automake/automake/tests/ansi5.test,v
retrieving revision 1.3
diff -u -r1.3 ansi5.test
--- ansi5.test  2001/12/26 08:22:05     1.3
+++ ansi5.test  2002/03/21 15:34:05
@@ -73,6 +73,6 @@
 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
Index: tests/defs
===================================================================
RCS file: /cvs/automake/automake/tests/defs,v
retrieving revision 1.45
diff -u -r1.45 defs
--- defs        2002/03/11 16:43:37     1.45
+++ defs        2002/03/21 15:34:05
@@ -127,6 +127,11 @@
 # 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
Index: tests/installsh.test
===================================================================
RCS file: /cvs/automake/automake/tests/installsh.test,v
retrieving revision 1.8
diff -u -r1.8 installsh.test
--- installsh.test      2002/01/07 20:25:24     1.8
+++ installsh.test      2002/03/21 15:34:05
@@ -25,8 +25,8 @@
     ;;
 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
Index: tests/subobj3.test
===================================================================
RCS file: /cvs/automake/automake/tests/subobj3.test,v
retrieving revision 1.9
diff -u -r1.9 subobj3.test
--- subobj3.test        2001/12/26 08:22:06     1.9
+++ subobj3.test        2002/03/21 15:34:05
@@ -45,5 +45,5 @@
    && $AUTOCONF \
    && $AUTOMAKE -a \
    && CC='gcc' ./configure \
-   && $MAKE ANSI2KNR=./ansi2knr U=_ \
+   && ANSI2KNR=./ansi2knr U=_ $MAKE -e \
    && ./hello

-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]