Merge branch 'master' into testsuite-work
[platform/upstream/automake.git] / Makefile.am
index 7ee282b..09706ff 100644 (file)
@@ -3,7 +3,8 @@
 ## Makefile for Automake.
 
 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +25,8 @@
 ## run aclocal and automake.
 SUBDIRS = lib . doc m4 tests
 
+TEST_SUBDIRS = lib/Automake/tests tests
+
 bin_SCRIPTS = automake aclocal
 
 CLEANFILES = $(bin_SCRIPTS)
@@ -76,6 +79,8 @@ do_subst = sed \
   -e 's,[@]PERL[@],$(PERL),g' \
   -e 's,[@]PERL_THREADS[@],$(PERL_THREADS),g' \
   -e 's,[@]SHELL[@],$(SHELL),g' \
+  -e 's,[@]am_AUTOCONF[@],$(am_AUTOCONF),g' \
+  -e 's,[@]am_AUTOM4TE[@],$(am_AUTOM4TE),g' \
   -e 's,[@]VERSION[@],$(VERSION),g' \
   -e 's,[@]configure_input[@],Generated from $@.in; do not edit by hand.,g' \
   -e 's,[@]datadir[@],$(datadir),g'
@@ -99,8 +104,6 @@ INSTALL: lib/INSTALL
        $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
 
 ## recheck: convenience proxy target for the test suites.
-TEST_SUBDIRS = lib/Automake/tests tests
-
 .PHONY: recheck
 recheck:
        @failcom='exit 1'; \
@@ -166,6 +169,7 @@ clean-local: clean-coverage
 syntax_check_rules = \
 sc_test_names \
 sc_diff_automake_in_automake \
+sc_diff_aclocal_in_automake \
 sc_perl_syntax \
 sc_no_brace_variable_expansions \
 sc_rm_minus_f \
@@ -185,6 +189,9 @@ sc_tests_plain_make \
 sc_tests_plain_autoconf \
 sc_tests_plain_autoupdate \
 sc_tests_plain_automake \
+sc_tests_plain_autom4te \
+sc_tests_plain_autoheader \
+sc_tests_plain_autoreconf \
 sc_tests_here_document_format \
 sc_tests_Exit_not_exit \
 sc_tests_automake_fails \
@@ -205,7 +212,24 @@ sc_at_in_texi
 
 .PHONY: $(syntax_check_rules)
 $(syntax_check_rules): automake aclocal
-maintainer-check: $(syntax_check_rules)
+
+## Check that the list of tests given in the Makefile is equal to the
+## list of all test scripts in the Automake testsuite.
+.PHONY: maintainer-check-list-of-tests
+maintainer-check-list-of-tests:
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       for subdir in $(TEST_SUBDIRS); do \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@) || eval $$failcom; \
+       done; \
+       test -z "$$fail"
+
+maintainer-check: $(syntax_check_rules) maintainer-check-list-of-tests
 
 ## Look for test whose names can cause spurious failures when used as
 ## first argument to AC_INIT (chiefly because they might contain an
@@ -267,15 +291,22 @@ sc_test_names:
           exit 1; \
         fi
 
-## This check avoids accidental configure substitutions in the source.
-## There are exactly 8 lines that should be modified.  This works out
-## to 28 lines of diffs.
+## These check avoids accidental configure substitutions in the source.
+## There are exactly 9 lines that should be modified from automake.in to
+## automake, and 10 lines that should be modified from aclocal.in to
+## aclocal; these wors out to 32 and 34 lines of diffs, respectively.
 sc_diff_automake_in_automake:
-       @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 28; then \
+       @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 32; then \
          echo "found too many diffs between automake.in and automake" 1>&2; \
          diff -c $(srcdir)/automake.in automake; \
          exit 1; \
        fi
+sc_diff_aclocal_in_aclocal:
+       @if test `diff $(srcdir)/aclocal.in aclocal | wc -l` -ne 34; then \
+         echo "found too many diffs between aclocal.in and aclocal" 1>&2; \
+         diff -c $(srcdir)/aclocal.in aclocal; \
+         exit 1; \
+       fi
 
 ## Syntax check with default Perl (on my machine, Perl 5).
 sc_perl_syntax:
@@ -410,25 +441,46 @@ sc_tests_plain_make:
 
 ## Tests should never call autoconf directly.
 sc_tests_plain_autoconf:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoconf'; then \
+       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoconf\>'; then \
          echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
          exit 1; \
        fi
 
 ## Tests should never call autoupdate directly.
 sc_tests_plain_autoupdate:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoupdate'; then \
+       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoupdate\>'; then \
          echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
          exit 1; \
        fi
 
 ## Tests should never call automake directly.
 sc_tests_plain_automake:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep -E ':[   ]*automake([^:]|$$)'; then \
+       @if grep -v '^#' $(srcdir)/tests/*.test | grep -E ':[   ]*automake\>([^:]|$$)'; then \
          echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
          exit 1; \
        fi
 
+## Tests should never call autoheader directly.
+sc_tests_plain_autoheader:
+       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoheader\>'; then \
+         echo 'Do not run "automake" in the above tests.  Use "$$AUTOHEADER" instead.' 1>&2;  \
+         exit 1; \
+       fi
+
+## Tests should never call autoreconf directly.
+sc_tests_plain_autoreconf:
+       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoreconf\>'; then \
+         echo 'Do not run "automake" in the above tests.  Use "$$AUTORECONF" instead.' 1>&2;  \
+         exit 1; \
+       fi
+
+## Tests should never call autom4te directly.
+sc_tests_plain_autom4te:
+       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autom4te\>'; then \
+         echo 'Do not run "automake" in the above tests.  Use "$$AUTOM4TE" instead.' 1>&2;  \
+         exit 1; \
+       fi
+
 ## Tests should only use END and EOF for here documents
 ## (so that the next test is effective).
 sc_tests_here_document_format:
@@ -439,9 +491,10 @@ sc_tests_here_document_format:
 
 ## Tests should never call exit directly, but use Exit.
 ## This is so that the exit status is transported correctly across the 0 trap.
-## Ignore comments, and ignore one perl line in ext2.test.
+## Ignore comments, testsuite self tests, and one perl line in ext2.test.
 sc_tests_Exit_not_exit:
        @found=false; for file in $(srcdir)/tests/*.test; do \
+         case $$file in */self-check-*.test) continue;; esac; \
          res=`sed -n -e '/^#/d; /^\$$PERL/d' -e '/<<.*END/,/^END/b' \
                      -e '/<<.*EOF/,/^EOF/b' -e '/exit [$$0-9]/p' $$file`; \
          if test -n "$$res"; then \
@@ -463,14 +516,14 @@ sc_tests_automake_fails:
 
 ## Tests should never call aclocal directly.
 sc_tests_plain_aclocal:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*aclocal'; then \
+       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*aclocal\>'; then \
          echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
          exit 1; \
        fi
 
 ## Tests should never call perl directly.
 sc_tests_plain_perl:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*perl'; then \
+       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*perl\>'; then \
          echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
          exit 1; \
        fi
@@ -485,17 +538,24 @@ sc_tests_required_after_defs:
        done
 
 ## 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.  V and DESTDIRS are exceptions,
-## too, as package authors are urged not to initialize them anywhere.
+## recursive targets are used.  Better use an envvar.  SHELL is an
+## exception, POSIX says it can't come from the environment.  DESTDIR and
+## DISTCHECK_CONFIGURE_FLAGS and V are exceptions, too, as package authors
+## are urged not to initialize them anywhere.
 sc_tests_overriding_macros_on_cmdline:
        @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
          echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
          echo ' in the above lines, it is more portable.' 1>&2; \
          exit 1; \
        fi
-       @if sed 's/DESTDIR=[^ ]*//; s/SHELL=[^ ]*//; s/V=[^ ]*//' $(srcdir)/tests/*.test | \
-           grep '\$$MAKE .*=' ; then \
+       @if sed -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
+               -e 's/ V=[^ ]*/ /' -e 's///' \
+## DISTCHECK_CONFIGURE_FLAGS is allowed to contain whitespace in its
+## definition, so the more complex substitutions below.
+               -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
+               -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
+               -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
+             $(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; \