automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12.1


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12.1-569-g5fdd743
Date: Mon, 02 Jul 2012 21:10:00 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=5fdd743164e2b15a385b19a14108bdacb6c76218

The branch, ng/master has been updated
       via  5fdd743164e2b15a385b19a14108bdacb6c76218 (commit)
       via  01b46d4bc1ce9bba6b7abffa1742af68256dcc03 (commit)
       via  3145ca4a432730e782e20f7375eba1df3a2842de (commit)
       via  cf2a81c0fc6579ce2fce57cea25fcac57e919c7a (commit)
       via  67abae49732991b596e6fa6d9d93a925720abe64 (commit)
       via  18dac9077caa49f69aa39e306b146ae700e14e9c (commit)
       via  53d49841f875a7a1e86a874ee5e5d171872ac733 (commit)
       via  d7d983b0276e903b492054d99cbbd6918279cb6a (commit)
       via  22786e467794bb1ee0daf4f47b59de7db612204b (commit)
       via  3da1457d426f1be7b9f792fce1461a7b8227d7e7 (commit)
       via  097930059adbd5061a5f78e2b91e339f91a32a18 (commit)
       via  1b3c7eaf50a74cbb0300631505bbb870f5cc95d3 (commit)
       via  e1b72b8f69b934116018c4d9fcb42dabe89e14a5 (commit)
       via  6532c8c1b3fbff1170aa63f4a8b9439991b636b9 (commit)
       via  f2436f5b665184ce8fa2e3babe1b1edfa69299f6 (commit)
       via  337110487a5a1868cad767dd9f09c49d178c6f67 (commit)
       via  d5443e4c3e6ca109be489bde2e1b4720d69f0029 (commit)
       via  0a442c188817b16482373253d729b7a4ec8f7fd9 (commit)
       via  285eed2fadec7f8949f10d60ef138c56e25ac565 (commit)
       via  b281eb7ce1c168d01eff9a093d61114c1abff9af (commit)
       via  c59c8d1536afcd0051cbe23ba538568932ecf00f (commit)
      from  aefbb49b2b6b872f53ba6a160f78b5d439d7aaa4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5fdd743164e2b15a385b19a14108bdacb6c76218
Author: Stefano Lattarini <address@hidden>
Date:   Mon Jul 2 22:37:25 2012 +0200

    [ng] fixup: s/&define_pretty_variable/&define_variable/
    
    * automake.in (handle_user_recursion): Here.  The former has been
    removed from the Automake-NG codebase (commit v1.12-319-g6175558).
    Issue introduced in the recent merge from master.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 01b46d4bc1ce9bba6b7abffa1742af68256dcc03
Author: Stefano Lattarini <address@hidden>
Date:   Mon Jul 2 22:19:15 2012 +0200

    [ng] fixup: don't reference non-existing tests on 'multilib'
    
    * contrib/t/local.am (contrib_TESTS): Here.
    * Makefile.am (EXTRA_DIST): No need to manually add $(contrib_TESTS),
    we already add $(TESTS) as a whole.
    (TESTS): Add $(contrib_TESTS) directly in the definition, rather than
    later with '+='.
    ($(srcdir)/contrib/t/local.am): Move inclusion of this earlier.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 3145ca4a432730e782e20f7375eba1df3a2842de
Author: Stefano Lattarini <address@hidden>
Date:   Mon Jul 2 22:01:14 2012 +0200

    [ng] maintcheck: fix several failures (real and spurious)
    
    * syntax-checks.mk (ams): Do not mistakenly consider also the directory
    '.am' used by Automake-NG internals as a '*.am' makefile fragment.
    (sc_no_dotmake_target): Use $(ams) instead of an hand-rolled equivalent
    expression.
    (sc_no_for_variable_in_macro): Whitelist the "for var in $(am__installdirs)"
    usage, since  $(am__installdirs) is already defined as properly quoted.
    * t/parallel-tests-recheck-pr11791.sh: Remove uses of the 'using_gmake'
    function; of course $MAKE is GNU make in Automake-NG.
    * t/remake-recurs-user.sh: Likewise.
    * t/recurs-user-keep-going.sh: Likewise.
    * t/recurs-user-phony.sh: Do not explicitly require GNU make.
    * t/recurs-user-wrap.sh: Likewise.
    * t/vartypos.sh: Use 'exit', not 'Exit'.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit cf2a81c0fc6579ce2fce57cea25fcac57e919c7a
Merge: e1b72b8 67abae4
Author: Stefano Lattarini <address@hidden>
Date:   Mon Jul 2 21:40:47 2012 +0200

    Merge branch 'master' into ng/master
    
    * master:
      contrib: check-html: pass flags to rst2html invocations
      contrib: simple improvements to check-html
      coverage: check-html can be used recursively
      tests: tests for stuff in contrib goes in 'contrib/t'
      recursion: support user-defined recursive targets
      tests: rename 'recurs*.sh' to 'var-recurs*.sh'
      tests: minor improvements to 'recurs*.sh'
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit e1b72b8f69b934116018c4d9fcb42dabe89e14a5
Author: Stefano Lattarini <address@hidden>
Date:   Sun Jul 1 19:28:51 2012 +0200

    [ng] recheck: improve the fix for bug#11791 to use more GNU make features
    
    * lib/am/parallel-tests.am: Here, and to generally have a "look and feel"
    more in the Automake-NG style.  Also, improve comments while we are at it.
    * Makefile.am (XFAIL_TESTS): Remove 't/test-missing.sh', as the changes in
    'parallel-tests.am' have restored some semantics that had been messed up
    in the previous merge (where 't/test-missing.sh' started failing).
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 6532c8c1b3fbff1170aa63f4a8b9439991b636b9
Merge: aefbb49 f2436f5
Author: Stefano Lattarini <address@hidden>
Date:   Sun Jul 1 18:35:40 2012 +0200

    Merge branch 'master' into ng/master
    
    This merge fixes automake bug#11791 for Automake-NG as well.
    
    * master:
      tests: don't trust the exit status of "make -k" for non-GNU makes
      parallel-tests: reimplement fix for bug#11791
      tests setup: unset CDPATH
      tests setup: more namespace safeness
      tests setup: remove an unused variable
      tests setup: less hard-coding of the test subdirectory
    
    + Extra non-trivial edits:
    
    * lib/am/parallel-tests.am: Manually merge the new implementation of the
    fix for the bug#11791, as implemented by commit 'v1.12.1-95-gd5443e4' of
    mainline Automake.
    * Makefile.am (XFAIL_TESTS): Remove 't/parallel-tests-recheck-pr11791.sh'.
    Add 't/test-missing.sh', which is slightly broken by this patch.  A later
    patch will restore the lost behaviour.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    3 +
 Makefile.am                                        |    8 +-
 NEWS                                               |    7 +
 automake.in                                        |   35 ++++
 contrib/check-html.am                              |   21 ++--
 t/autohdr.sh => contrib/t/local.am                 |   27 ++--
 contrib/t/parallel-tests-html-recursive.sh         |  163 ++++++++++++++++++++
 .../t/parallel-tests-html.sh                       |    2 -
 defs-static.in                                     |    8 +-
 doc/automake-ng.texi                               |   28 ++++
 lib/am/parallel-tests.am                           |   17 ++-
 lib/am/subdirs.am                                  |   16 ++-
 m4/extra-recurs.m4                                 |   17 ++
 syntax-checks.mk                                   |   16 ++-
 t/ax/test-init.sh                                  |   18 ++-
 t/parallel-tests-recheck-pr11791.sh                |    4 +-
 t/recurs-user-deeply-nested.sh                     |   97 ++++++++++++
 t/recurs-user-indir.sh                             |   99 ++++++++++++
 t/recurs-user-keep-going.sh                        |   89 +++++++++++
 t/recurs-user-many.sh                              |   73 +++++++++
 t/{colon.sh => recurs-user-no-subdirs.sh}          |   38 +++--
 t/{subdir10.sh => recurs-user-no-top-level.sh}     |   27 +++-
 ...figure-no-subdir.sh => recurs-user-override.sh} |   58 ++++----
 t/{subdir10.sh => recurs-user-phony.sh}            |   38 ++++-
 t/{instdir-cond.sh => recurs-user-wrap.sh}         |   46 ++++--
 t/{vpath-built-sources.sh => recurs-user.sh}       |   82 ++++++-----
 t/recurs-user2.sh                                  |  103 ++++++++++++
 ...ules-old-fashioned.sh => remake-recurs-user.sh} |   78 ++++++----
 t/{recurs.sh => var-recurs.sh}                     |    2 -
 t/{recurs2.sh => var-recurs2.sh}                   |    2 +
 t/vartypos.sh                                      |    2 +-
 31 files changed, 1019 insertions(+), 205 deletions(-)
 copy t/autohdr.sh => contrib/t/local.am (67%)
 mode change 100755 => 100644
 create mode 100755 contrib/t/parallel-tests-html-recursive.sh
 rename t/parallel-tests2.sh => contrib/t/parallel-tests-html.sh (96%)
 create mode 100644 m4/extra-recurs.m4
 create mode 100755 t/recurs-user-deeply-nested.sh
 create mode 100755 t/recurs-user-indir.sh
 create mode 100755 t/recurs-user-keep-going.sh
 create mode 100755 t/recurs-user-many.sh
 copy t/{colon.sh => recurs-user-no-subdirs.sh} (62%)
 copy t/{subdir10.sh => recurs-user-no-top-level.sh} (67%)
 copy t/{autodist-configure-no-subdir.sh => recurs-user-override.sh} (52%)
 copy t/{subdir10.sh => recurs-user-phony.sh} (59%)
 copy t/{instdir-cond.sh => recurs-user-wrap.sh} (60%)
 copy t/{vpath-built-sources.sh => recurs-user.sh} (50%)
 create mode 100755 t/recurs-user2.sh
 copy t/{suffix-rules-old-fashioned.sh => remake-recurs-user.sh} (55%)
 rename t/{recurs.sh => var-recurs.sh} (94%)
 rename t/{recurs2.sh => var-recurs2.sh} (99%)

diff --git a/.gitignore b/.gitignore
index 74ec0d6..1ea4dbb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,6 +45,9 @@
 /t/*.dir
 /t/*.log
 /t/*.trs
+/contrib/t/*.dir
+/contrib/t/*.log
+/contrib/t/*.trs
 /t/pm/*.log
 /t/pm/*.trs
 /t/perf/*.log
diff --git a/Makefile.am b/Makefile.am
index d7e4b1c..6b8cde9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -242,6 +242,7 @@ dist_automake_ac_DATA = \
   m4/cond-if.m4 \
   m4/depend.m4 \
   m4/dmalloc.m4 \
+  m4/extra-recurs.m4 \
   m4/gcj.m4 \
   m4/init.m4 \
   m4/install-sh.m4 \
@@ -295,6 +296,9 @@ AM_TAP_LOG_DRIVER_FLAGS = --merge
 
 EXTRA_DIST += t/README t/ax/is t/ax/is_newest
 
+# Hand-written tests for stuff in 'contrib/'.
+include $(srcdir)/contrib/t/local.am
+
 # All tests, both hand-written and autogenerated.
 # IMPORTANT: This assumes that the autogenerated tests are placed
 #            in the $(srcdir) as well!
@@ -317,7 +321,8 @@ long_running_TESTS = \
 
 TESTS = \
   $(long_running_TESTS) \
-  $(filter-out $(long_running_TESTS), $(all_TESTS))
+  $(filter-out $(long_running_TESTS), $(all_TESTS)) \
+  $(contrib_TESTS)
 
 EXTRA_DIST += $(TESTS)
 
@@ -335,7 +340,6 @@ perl_fake_XFAIL_TESTS = \
 XFAIL_TESTS = \
   t/all.sh \
   t/override-suggest-local.sh \
-  t/parallel-tests-recheck-pr11791.sh \
   t/yacc-bison-skeleton-cxx.sh \
   t/yacc-bison-skeleton.sh \
   t/comments-in-var-def.sh \
diff --git a/NEWS b/NEWS
index 1612a36..292f628 100644
--- a/NEWS
+++ b/NEWS
@@ -81,6 +81,13 @@ New in 1.13:
     script to avoid such issues; a simple example is provided in the
     "CVS and generated files" chapter of the automake manual.
 
+* Recursive targets:
+
+  The user can now define his own recursive targets that recurse
+  in the directories specified in $(SUBDIRS).  This can be done by
+  specifying the name of such targets in invocations of the new
+  'AM_EXTRA_RECURSIVE_TARGETS' m4 macro.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.12.2:
diff --git a/automake.in b/automake.in
index 97ccdab..6e7da4b 100644
--- a/automake.in
+++ b/automake.in
@@ -372,6 +372,9 @@ my $ac_gettext_location;
 # Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen.
 my $seen_gettext_intl = 0;
 
+# The arguments of the AM_EXTRA_RECURSIVE_TARGETS call (if any).
+my @extra_recursive_targets = ();
+
 # Lists of tags supported by Libtool.
 my %libtool_tags = ();
 # 1 if Libtool uses LT_SUPPORTED_TAG.  If it does, then it also
@@ -3950,6 +3953,32 @@ sub handle_all_and_check ()
                                        'CHECK-TESTS' => "@check_tests");
 }
 
+# Generate helper targets for user recursion, where needed.
+sub handle_user_recursion ()
+{
+  return unless @extra_recursive_targets;
+
+  define_variable ('am__extra_recursive_targets', INTERNAL,
+                   map { "$_-recursive" } @extra_recursive_targets);
+  my $aux = var ('SUBDIRS') ? 'recursive' : 'am';
+  foreach my $target (@extra_recursive_targets)
+    {
+      # This allows the default target's rules to be overridden in
+      # Makefile.am.
+      user_phony_rule ($target);
+      depend ("$target", "$target-$aux");
+      depend ("$target-am", "$target-local");
+      # Every user-defined recursive target 'foo' *must* have a valid
+      # associated 'foo-local' rule; we define it as an empty rule by
+      # default, so that the user can transparently extend it in his
+      # own Makefile.am.
+      pretty_print_rule ("$target-local:");
+      # $target-recursive might as well be undefined, so do not add
+      # it here; it's taken care of in subdirs.am anyway.
+      depend (".PHONY", "$target-am", "$target-local");
+    }
+}
+
 # handle_clean ($MAKEFILE)
 # ------------------------
 # Handle all 'clean' targets.
@@ -4345,6 +4374,7 @@ sub scan_autoconf_traces ($)
                AC_SUBST_TRACE => 1,
                AM_AUTOMAKE_VERSION => 1,
                AM_CONDITIONAL => 2,
+               _AM_EXTRA_RECURSIVE_TARGETS => 1,
                AM_GNU_GETTEXT => 0,
                AM_GNU_GETTEXT_INTL_SUBDIR => 0,
                AM_INIT_AUTOMAKE => 0,
@@ -4505,6 +4535,10 @@ sub scan_autoconf_traces ($)
        {
          $configure_cond{$args[1]} = $where;
        }
+      elsif ($macro eq '_AM_EXTRA_RECURSIVE_TARGETS')
+       {
+         push @extra_recursive_targets, split (' ', $args[1]);
+       }
       elsif ($macro eq 'AM_GNU_GETTEXT')
        {
          $seen_gettext = $where;
@@ -6907,6 +6941,7 @@ sub generate_makefile ($$)
   handle_data;
   handle_headers;
   handle_subdirs;
+  handle_user_recursion;
   handle_tags;
   handle_minor_options;
 
diff --git a/contrib/check-html.am b/contrib/check-html.am
index c9d44cd..2604c5e 100644
--- a/contrib/check-html.am
+++ b/contrib/check-html.am
@@ -29,18 +29,17 @@ mostlyclean-check-html:
        rm -f $(TEST_SUITE_HTML)
 
 .log.html:
-       @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py';            \
-       for r2h in $$list; do                                           \
-         if ($$r2h --version) >/dev/null 2>&1; then                    \
-           R2H=$$r2h;                                                  \
-         fi;                                                           \
-       done;                                                           \
-       if test -z "$$R2H"; then                                        \
-         echo >&2 "cannot find rst2html, cannot create $@";            \
+       @list='$(RST2HTML) rst2html rst2html.py';                       \
+       while :; do                                                     \
+         for r2h in $$list; do                                         \
+           if ($$r2h --version) >/dev/null 2>&1; then break 2;         \
+           else :; fi;                                                 \
+         done;                                                         \
+         echo "cannot find rst2html, cannot create $@" >&2;            \
          exit 2;                                                       \
-       fi;                                                             \
-       $$R2H $< >address@hidden
-       @mv address@hidden $@
+       done;                                                           \
+       $$r2h $(AM_RST2HTMLFLAGS) $(RST2HTMLFLAGS) $< >address@hidden           
\
+         && mv -f address@hidden $@
 
 # Be sure to run check first, and then to convert the result.
 # Beware of concurrent executions.  Run "check" not "check-TESTS", as
diff --git a/t/autohdr.sh b/contrib/t/local.am
old mode 100755
new mode 100644
similarity index 67%
copy from t/autohdr.sh
copy to contrib/t/local.am
index 19daabe..1852747
--- a/t/autohdr.sh
+++ b/contrib/t/local.am
@@ -1,30 +1,23 @@
-#!/bin/sh
-# Copyright (C) 2002-2012 Free Software Foundation, Inc.
-#
+# Copyright (C) 1995-2012 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
 # the Free Software Foundation; either version 2, or (at your option)
 # any later version.
-#
+
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-#
+
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check that autoheaders works, despite our AC_CONFIG_HEADERS hack.
-
-. ./defs || exit 1
-
-cat >>configure.ac <<EOF
-AC_CONFIG_HEADERS([thisfile.h])
-EOF
-
-: > Makefile.am
+# Automake: tests for stuff in 'contrib/'.
 
-$ACLOCAL
-$AUTOHEADER
+## Relative to the top-level directory.
+contrib_testsuite_dir = contrib/t
 
-test -f thisfile.h.in
+contrib_TESTS = \
+  $(contrib_testsuite_dir)/parallel-tests-html.sh \
+  $(contrib_testsuite_dir)/parallel-tests-html-recursive.sh
diff --git a/contrib/t/parallel-tests-html-recursive.sh 
b/contrib/t/parallel-tests-html-recursive.sh
new file mode 100755
index 0000000..12d967e
--- /dev/null
+++ b/contrib/t/parallel-tests-html-recursive.sh
@@ -0,0 +1,163 @@
+#! /bin/sh
+# Copyright (C) 2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Recursive use of 'check-html'.  See Automake bug#11287.
+
+. ./defs || exit 1
+
+# Try the variants that are tried in check-html.am.
+while :; do
+  for r2h in $RST2HTML rst2html rst2html.py; do
+    echo "$me: running $r2h --version"
+    $r2h --version && break 2
+    : For shells with busted 'set -e'.
+  done
+  skip_all_ "no proper rst2html program found"
+done
+unset r2h
+
+cp "$am_top_srcdir"/contrib/check-html.am . \
+  || fatal_ "cannot fetch 'check-html.am' from contrib"
+
+cat >> configure.ac << 'END'
+AM_EXTRA_RECURSIVE_TARGETS([check-html])
+AC_CONFIG_FILES([sub/Makefile sub/more/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+EXTRA_DIST = $(TESTS)
+TEST_SUITE_LOG = mylog.log
+TESTS = foo.test bar.sh mu
+XFAIL_TESTS = bar.sh
+check_SCRIPTS = bla
+bla:
+       echo '#!/bin/sh' > address@hidden
+       echo 'echo Blah Blah Blah' >> address@hidden
+       chmod a+x,a-w address@hidden
+       mv -f address@hidden $@
+CLEANFILES = bla
+include $(srcdir)/check-html.am
+END
+
+mkdir sub
+echo SUBDIRS = more > sub/Makefile.am
+
+mkdir sub/more
+cat > sub/more/Makefile.am << 'END'
+include $(top_srcdir)/check-html.am
+TEST_EXTENSIONS = .test .sh
+TESTS = sh.sh test.test
+LOG_COMPILER = true
+test.log: sh.log
+nodist_check_DATA = x.txt
+$(nodist_check_DATA):
+       echo $@ > $@
+CLEANFILES = $(nodist_check_DATA)
+EXTRA_DIST = $(TESTS)
+END
+
+cat > foo.test <<'END'
+#! /bin/sh
+./bla
+exit 77
+END
+
+cat > bar.sh <<'END'
+#! /bin/sh
+echo "this is $0"
+exit 1
+END
+
+cat > mu <<'END'
+#! /bin/sh
+set -x
+test -f sub/more/test.log
+test -f sub/more/sh.log
+END
+
+cat > sub/more/test.test << 'END'
+#!/bin/sh
+echo "this is $0"
+set -x
+test -f sh.log
+test -f x.txt
+exit 77
+END
+
+cat > sub/more/sh.sh << 'END'
+#!/bin/sh
+set -x
+test ! -f test.log
+test -f x.txt
+END
+
+
+cat > sub/more/mu << 'END'
+#!/bin/sh
+exit 99
+END
+
+chmod a+x foo.test bar.sh mu sub/more/test.test sub/more/sh.sh
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE check-html
+grep 'Blah Blah Blah' mylog.html
+grep 'this is .*bar\.sh' mylog.html
+grep 'this is .*test\.test' sub/more/test-suite.html
+# check-html should cause check_SCRIPTS and check_DATA to be created.
+test -f bla
+test -f sub/more/x.txt
+
+# "make clean" should remove HTML files.
+$MAKE clean
+test ! -e mylog.html
+test ! -e sub/more/test-suite.html
+test ! -e bla
+test ! -e sub/more/x.txt
+
+# Create HTML output for individual tests.
+
+$MAKE bla
+$MAKE foo.html bar.sh.html
+grep 'Blah Blah Blah' foo.html
+grep 'this is .*bar\.sh' bar.sh.html
+test ! -e mu.hml
+
+ocwd=$(pwd) || fatal_ "getting current workind directory"
+( cd sub/more \
+    && $MAKE sh.html \
+    && test -f sh.html \
+    && test ! -e test.html \
+    && $MAKE test.html \
+    && grep 'this is .*test\.test' test.html) || exit 1
+
+# HTML output removed by mostlyclean.
+$MAKE check-html
+test -f mylog.html
+test -f sub/more/test-suite.html
+$MAKE mostlyclean
+find . -name '*.html' | grep . && exit 1
+
+$MAKE distcheck
+
+:
diff --git a/t/parallel-tests2.sh b/contrib/t/parallel-tests-html.sh
similarity index 96%
rename from t/parallel-tests2.sh
rename to contrib/t/parallel-tests-html.sh
index 7d57640..78cae7a 100755
--- a/t/parallel-tests2.sh
+++ b/contrib/t/parallel-tests-html.sh
@@ -17,8 +17,6 @@
 # Check parallel-tests features:
 #  - check-html
 #  - recheck-html
-# FIXME: the features tested by this script has been moved in contrib.
-# FIXME: We should move this script accordingly.
 
 . ./defs || exit 1
 
diff --git a/defs-static.in b/defs-static.in
index 781571c..6901212 100644
--- a/defs-static.in
+++ b/defs-static.in
@@ -25,6 +25,9 @@
 #     shell, not only with configure-time detected $SHELL and/or
 #     $AM_TEST_RUNNER_SHELL.
 
+# CDPATH is evil if exported in the environment.
+CDPATH=; unset CDPATH
+
 # Be more Bourne compatible.
 # (Snippet inspired to configure's initialization in Autoconf 2.64)
 DUALCASE=1; export DUALCASE # for MKS sh
@@ -88,9 +91,9 @@ if test -z "$am_using_tap"; then
   case $argv0 in *.tap) am_using_tap=yes;; *) am_using_tap=no;; esac
 fi
 
+am_rel_srcdir='@srcdir@'
 am_top_srcdir='@abs_srcdir@'
 am_top_builddir='@abs_builddir@'
-testprefix='@prefix@'
 
 # Where testsuite-related helper scripts, data files and shell libraries
 # are placed.
@@ -131,6 +134,9 @@ PATH_SEPARATOR='@PATH_SEPARATOR@'
 host_alias=${host_alias-'@host_alias@'}; export host_alias
 build_alias=${build_alias-'@build_alias@'}; export build_alias
 
+# A concurrency-safe "mkdir -p" implementation.
+MKDIR_P=${AM_TESTSUITE_MKDIR_P-'@MKDIR_P@'}
+
 # The shell we use to run our own test scripts, determined at configure
 # time.  It is required in the self tests, and most importantly for the
 # automatic re-execution of test scripts.
diff --git a/doc/automake-ng.texi b/doc/automake-ng.texi
index b1cf903..03cca92 100644
--- a/doc/automake-ng.texi
+++ b/doc/automake-ng.texi
@@ -4197,6 +4197,34 @@ will be built.  It is customary to arrange test 
directories to be
 built after everything else since they are meant to test what has
 been constructed.
 
+In addition to the built-in recursive targets defined by Automake
+(@code{all}, @code{check}, etc.), the developer can also define his
+own recursive targets.  That is done by passing the names of such
+targets as arguments to the m4 macro @code{AM_EXTRA_RECURSIVE_TARGETS}
+in @file{configure.ac}.  Automake generates rules to handle the
+recursion for such targets; and the developer can define real actions
+for them by defining corresponding @code{-local} targets.
+
address@hidden
+% @kbd{cat configure.ac}
+AC_INIT([pkg-name], [1.0]
+AM_INIT_AUTOMAKE
+AM_EXTRA_RECURSIVE_TARGETS([foo])
+AC_CONFIG_FILES([Makefile sub/Makefile sub/src/Makefile])
+AC_OUTPUT
+% @kbd{cat Makefile.am}
+SUBDIRS = sub
+foo-local:
+        @@echo This will be run by "make foo".
+% @kbd{cat sub/Makefile.am}
+SUBDIRS = src
+% @kbd{cat sub/src/Makefile.am}
+foo-local:
+        @@echo This too will be run by a "make foo" issued either in
+        @@echo the 'sub/src/' directory, the 'sub/' directory, or the
+        @@echo top-level directory.
address@hidden example
+
 @node Conditional Subdirectories
 @section Conditional Subdirectories
 @cindex Subdirectories, building conditionally
diff --git a/lib/am/parallel-tests.am b/lib/am/parallel-tests.am
index 910d8d6..83b90d5 100644
--- a/lib/am/parallel-tests.am
+++ b/lib/am/parallel-tests.am
@@ -406,9 +406,10 @@ check-TESTS:
 
 ## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
 ## It must also depend on the 'all' target.  See automake bug#11252.
-## FIXME: this recipe should be fixed not to trip on automake
-## FIXME: bug#11791 anymore.
 recheck: all %CHECK_DEPS%
+## See comments above in the check-TESTS recipe for why remove
+## $(TEST_SUITE_LOG) here.
+       @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
        @bases='$(am__test_bases)'; \
 ## If running a "make recheck", we must only consider tests that had an
 ## unexpected outcome (FAIL or XPASS) in the earlier run.
@@ -416,7 +417,17 @@ recheck: all %CHECK_DEPS%
                 | $(am__list_recheck_tests)` || exit 1; \
 ## Remove newlines and normalize whitespace.
        bases=`echo $$bases`; \
-       $(MAKE) check-TESTS am__test_bases="$$bases"
+       $(MAKE) $(TEST_SUITE_LOG) .am/doing-recheck=yes am__test_bases="$$bases"
 .PHONY: recheck
 
+## One tricky requirement of the "recheck" target is that, in case (say)
+## the test is a compiled program whose compilation fails, we must ensure
+## that any '.log' and '.trs' file referring to such test are preserved,
+## so that future "make recheck" invocations will still try to re-compile
+## and re-run it (automake bug#11791).  This indirection is aimed at
+## satisying such a requirement.
+!ifeq ($(.am/doing-recheck),yes)
+!$(am__test_logs) $(am__test_results): .am/nil
+!endif
+
 AM_RECURSIVE_TARGETS += check recheck
diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am
index 98a7010..5040f55 100644
--- a/lib/am/subdirs.am
+++ b/lib/am/subdirs.am
@@ -17,12 +17,17 @@
 RECURSIVE_TARGETS += all-recursive check-recursive installcheck-recursive
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
   distclean-recursive maintainer-clean-recursive
+
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+
 ## All documented targets which invoke 'make' recursively, or depend
-## on targets that do so.
-AM_RECURSIVE_TARGETS += $(RECURSIVE_TARGETS:-recursive=) \
-  $(RECURSIVE_CLEAN_TARGETS:-recursive=)
+## on targets that do so.  GNUmakefile from gnulib depends on this.
+AM_RECURSIVE_TARGETS += $(am__recursive_targets:-recursive=)
 
-.PHONY: $(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS)
+.PHONY: $(am__recursive_targets)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run 'make' without going through this Makefile.
@@ -31,7 +36,7 @@ AM_RECURSIVE_TARGETS += $(RECURSIVE_TARGETS:-recursive=) \
 #     (which will cause the Makefiles to be regenerated when you run 'make');
 # (2) otherwise, pass the desired values on the 'make' command line.
 
-$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): %-recursive:
+$(am__recursive_targets): %-recursive:
 ## Using $failcom allows "-k" to keep its natural meaning when running a
 ## recursive rule.
        @fail= failcom='exit 1'; \
@@ -63,7 +68,6 @@ $(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): %-recursive:
          $(MAKE) $*-am || exit 1; \
        fi; test -z "$$fail"
 
-
 mostlyclean: mostlyclean-recursive
 clean: clean-recursive
 distclean: distclean-recursive
diff --git a/m4/extra-recurs.m4 b/m4/extra-recurs.m4
new file mode 100644
index 0000000..7b7ecc7
--- /dev/null
+++ b/m4/extra-recurs.m4
@@ -0,0 +1,17 @@
+# AM_EXTRA_RECURSIVE_TARGETS                                -*- Autoconf -*-
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_EXTRA_RECURSIVE_TARGETS
+# --------------------------
+# Define the list of user recursive targets.  This macro exists only to
+# be traced by Automake, which will ensure that a proper definition of
+# user-defined recursive targets (and associated rules) is propagated
+# into all the generated Makefiles.
+AC_DEFUN([AM_EXTRA_RECURSIVE_TARGETS], [_$0(m4_flatten([$1]))])
+# TODO: We should really reject non-literal arguments here...
+m4_define([_AM_EXTRA_RECURSIVE_TARGETS], [])
diff --git a/syntax-checks.mk b/syntax-checks.mk
index 3a525ed..7bd071f 100644
--- a/syntax-checks.mk
+++ b/syntax-checks.mk
@@ -27,13 +27,13 @@ xtests := $(shell \
    fi; \
    for d in $$dirs; do \
      for s in tap sh; do \
-       ls $$d/t/*.$$s $$d/t/ax/*.$$s 2>/dev/null; \
+       ls $$d/t/ax/*.$$s $$d/t/*.$$s $$d/contrib/t/*.$$s 2>/dev/null; \
      done; \
    done | sort)
 
 xdefs = $(srcdir)/t/ax/test-init.sh $(srcdir)/defs $(srcdir)/defs-static.in
 
-ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
+ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '?*.am' -a -print)
 pms := $(dist_perllib_DATA)
 
 # Some simple checks, and then ordinary check.  These are only really
@@ -131,10 +131,14 @@ sc_rm_minus_f:
        else :; fi
 
 ## Never use something like "for file in $(FILES)", this doesn't work
-## if FILES is empty or if it contains shell meta characters (e.g. $ is
-## commonly used in Java filenames).
+## if FILES is empty or if it contains shell meta characters (e.g. '$'
+## is commonly used in Java filenames).  Make an exception for
+## $(am__installdirs), which is already defined as properly quoted.
 sc_no_for_variable_in_macro:
-       @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \
+       @LC_ALL=C; export LC_ALL; \
+       if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:' \
+           | grep -Ev '\bfor [a-zA-Z0-9_]+ in \$$\(am__installdirs\)'; \
+       then \
          echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
          exit 1; \
        else :; fi
@@ -290,7 +294,7 @@ sc_make_simple_include:
 ## by GNU make.  No point in using it.
 sc_no_dotmake_target:
        @files="\
-         `find $(srcdir) -name '*.am'` \
+         $(ams) \
          $(srcdir)/automake.in \
          $(srcdir)/doc/*.texi \
         "; \
diff --git a/t/ax/test-init.sh b/t/ax/test-init.sh
index b92e373..fa479af 100644
--- a/t/ax/test-init.sh
+++ b/t/ax/test-init.sh
@@ -805,7 +805,7 @@ trap 'exit_status=$?
     esac
     test $exit_status -eq 0 || keep_testdirs=yes
   fi
-  am_keeping_testdirs || rm_rf_ $testSubDir
+  am_keeping_testdirs || rm_rf_ $am_test_subdir
   set +x
   echo "$me: exit $exit_status"
   # Spurious escaping to ensure we do not call our "exit" alias.
@@ -840,20 +840,22 @@ trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
 
 # Create and populate the temporary directory, if and as required.
 if test x"$am_create_testdir" = x"no"; then
-  testSubDir=
+  am_test_subdir=
 else
   # The subdirectory where the current test script will run and write its
   # temporary/data files.  This will be created shortly, and will be removed
   # by the cleanup trap below if the test passes.  If the test doesn't pass,
   # this directory will be kept, to facilitate debugging.
-  testSubDir=t/$me.dir
-  test ! -e $testSubDir || rm_rf_ $testSubDir \
+  am_test_subdir=${argv0#$am_rel_srcdir/}
+  case $am_test_subdir in
+    */*) am_test_subdir=${am_test_subdir%/*}/$me.dir;;
+      *) am_test_subdir=$me.dir;;
+  esac
+  test ! -e $am_test_subdir || rm_rf_ $am_test_subdir \
     || framework_failure_ "removing old test subdirectory"
-  test -d t || mkdir t
-  mkdir $testSubDir \
+  $MKDIR_P $am_test_subdir \
     || framework_failure_ "creating test subdirectory"
-  # The leading './' is to avoid CDPATH issues.
-  cd ./$testSubDir \
+  cd $am_test_subdir \
     || framework_failure_ "cannot chdir into test subdirectory"
   if test x"$am_create_testdir" != x"empty"; then
     cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
diff --git a/t/parallel-tests-recheck-pr11791.sh 
b/t/parallel-tests-recheck-pr11791.sh
index 2cb18cf..105d51e 100755
--- a/t/parallel-tests-recheck-pr11791.sh
+++ b/t/parallel-tests-recheck-pr11791.sh
@@ -59,10 +59,8 @@ $EGREP '(X?PASS|X?FAIL|SKIP|ERROR):' stdout && exit 1
 test -f foo.log
 test -f foo.trs
 
-st=0; $MAKE -k recheck >stdout || st=$?
+$MAKE -k recheck >stdout && { cat stdout; exit 1; }
 cat stdout
-# Don't trust the exit status of "make -k" for non-GNU makes.
-if using_gmake && test $st -eq 0; then exit 1; fi
 # We don't get a change to run the testsuite.
 $EGREP '(X?PASS|X?FAIL|SKIP|ERROR):' stdout && exit 1
 test -f foo.log
diff --git a/t/recurs-user-deeply-nested.sh b/t/recurs-user-deeply-nested.sh
new file mode 100755
index 0000000..c9e5c1f
--- /dev/null
+++ b/t/recurs-user-deeply-nested.sh
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Copyright (C) 2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that recursion on user-defined targets can be made to work
+# with "deeply" nested uses of $(SUBDIRS).
+
+. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_CONFIG_FILES([
+    sub1/Makefile
+    sub1/sub2/Makefile
+    sub1/sub2/sub3/Makefile
+    sub1/sub2/sub3/sub4/Makefile
+])
+AM_EXTRA_RECURSIVE_TARGETS([foo])
+AC_OUTPUT
+END
+
+dirs='sub1 sub1/sub2 sub1/sub2/sub3 sub1/sub2/sub3/sub4'
+
+mkdir $dirs
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub1
+
+foo-local:
+       cp sub1/foo foo
+MOSTLYCLEANFILES = foo
+
+.PHONY: test
+test:
+       echo 'It works!' > exp
+       diff exp foo
+       diff exp sub1/foo
+       test ! -f sub1/sub2/foo
+       test ! -f sub1/sub2/sub3/foo
+       diff exp sub1/sub2/sub3/sub4/foo
+       rm -f exp
+
+all-local: foo
+check-local: test
+END
+
+cat > sub1/Makefile.am <<'END'
+SUBDIRS = sub2
+foo-local:
+       test ! -f sub2/sub3/foo
+       cp sub2/sub3/sub4/foo foo
+MOSTLYCLEANFILES = foo
+END
+
+# Here we deliberately lack an explicit definition the 'foo-local'
+# target; that shouldn't stop 'foo' recursion into subdirectory
+# 'sub3/sub4'.
+echo SUBDIRS = sub3 > sub1/sub2/Makefile.am
+echo SUBDIRS = sub4 > sub1/sub2/sub3/Makefile.am
+
+cat > sub1/sub2/sub3/sub4/Makefile.am <<'END'
+foo-local:
+       echo 'It works!' > foo
+MOSTLYCLEANFILES = foo
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for d in $dirs; do
+  $FGREP foo-am $d/Makefile.in || exit 1
+  case $d in
+    */sub4);;
+    *) $FGREP foo-recursive $d/Makefile.in || exit 1;;
+  esac
+done
+
+./configure
+
+$MAKE foo
+$MAKE test
+
+$MAKE distcheck
+
+:
diff --git a/t/recurs-user-indir.sh b/t/recurs-user-indir.sh
new file mode 100755
index 0000000..01d98a7
--- /dev/null
+++ b/t/recurs-user-indir.sh
@@ -0,0 +1,99 @@
+#! /bin/sh
+# Copyright (C) 2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that user recursion works with various types of indirections
+# *involved in the definition of the '*-local' targets*: make macros,
+# AC_SUBST'd strings, automake-time file inclusions, automake
+# conditionals...
+
+. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_CONFIG_FILES([
+    sub1/Makefile
+    sub1/subsub/Makefile
+    sub2/Makefile
+    sub2/subsub/Makefile
+])
+AM_EXTRA_RECURSIVE_TARGETS([foo])
+AC_SUBST([FOO_LOCAL], [foo-local])
+AM_CONDITIONAL([COND], [:])
+AC_OUTPUT
+END
+
+mkdir sub1 sub1/subsub sub2 sub2/subsub
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub1 sub2
+AM_FOO_LOCAL = foo-local
+
+$(AM_FOO_LOCAL):
+       pwd && : > foo
+CLEANFILES = foo
+
+all-local: foo
+check-local:
+       test -f foo
+       test -f sub1/foo
+       test -f sub1/subsub/foo
+       test -f sub2/foo
+       test -f sub2/subsub/foo
+       test ! -r sub2/subsub/bar
+END
+
+cat > sub1/Makefile.am <<'END'
+SUBDIRS = subsub
address@hidden@:
+       pwd && : > foo
+CLEANFILES = foo
+END
+
+cat > sub1/subsub/Makefile.am <<'END'
+$(FOO_LOCAL):
+       pwd && : > foo
+CLEANFILES = foo
+END
+
+cat > sub2/Makefile.am <<'END'
+include $(srcdir)/bar.am
+include $(srcdir)/baz.am
+CLEANFILES = foo
+END
+
+echo 'SUBDIRS = subsub' > sub2/bar.am
+echo 'foo-local: ; pwd && : > foo' > sub2/baz.am
+
+cat > sub2/subsub/Makefile.am <<'END'
+if COND
+foo-local:
+       pwd && : > foo
+CLEANFILES = foo
+else !COND
+foo-local:
+       pwd && : > bar
+endif !COND
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+:
diff --git a/t/recurs-user-keep-going.sh b/t/recurs-user-keep-going.sh
new file mode 100755
index 0000000..3be5eb4
--- /dev/null
+++ b/t/recurs-user-keep-going.sh
@@ -0,0 +1,89 @@
+#! /bin/sh
+# Copyright (C) 2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that user recursion works with "make -k".
+
+. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AM_EXTRA_RECURSIVE_TARGETS([foo])
+AC_CONFIG_FILES([
+    sub1/Makefile
+    sub1/subsub1/Makefile
+    sub2/Makefile
+    sub2/subsub2/Makefile
+    sub3/Makefile
+])
+FAIL='@echo "FAIL $@ in `pwd`"; exit 1'
+PASS='@echo "PASS $@ in `pwd`"; : > foo'
+AC_SUBST([FAIL])
+AC_SUBST([PASS])
+AC_OUTPUT
+END
+
+mkdir sub1 sub1/subsub1 sub2 sub2/subsub2 sub3
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub1 . sub2 sub3
+foo-local:; @FAIL@
+END
+
+cat > sub1/Makefile.am <<'END'
+SUBDIRS = subsub1
+foo-local:; @PASS@
+END
+
+cat > sub2/Makefile.am <<'END'
+SUBDIRS = subsub2
+foo-local:; @FAIL@
+END
+
+echo 'foo-local:; @FAIL@' > sub1/subsub1/Makefile.am
+echo 'foo-local:; @PASS@' > sub2/subsub2/Makefile.am
+echo 'foo-local:; @PASS@' > sub3/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat > exp <<END
+./sub1/foo
+./sub2/subsub2/foo
+./sub3/foo
+END
+
+as_expected ()
+{
+  find . -name foo > t || { cat t; exit 1; }
+  LC_ALL=C sort t > got
+  cat exp
+  cat got
+  diff exp got
+}
+
+# Without "-k", we fail in 'sub1/subsub1', and do nothing else.
+# So, no 'foo' file gets created.
+$MAKE foo && exit 1
+find . -name foo | grep . && exit 1
+
+$MAKE -k foo && exit 1
+as_expected
+$MAKE --keep-going foo && exit 1
+as_expected
+
+:
diff --git a/t/recurs-user-many.sh b/t/recurs-user-many.sh
new file mode 100755
index 0000000..c1e4757
--- /dev/null
+++ b/t/recurs-user-many.sh
@@ -0,0 +1,73 @@
+#! /bin/sh
+# Copyright (C) 2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that many user-defined recursive targets can be supported
+# at once, and that calls to 'AM_EXTRA_RECURSIVE_TARGETS' are
+# cumulative.
+
+. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+## NOTE: extra white spaces, tabs, newlines and backslashes in the
+## lines below: on purpose.
+AM_EXTRA_RECURSIVE_TARGETS([ foo  \
+       bar  ])
+AC_SUBST([CLEANFILES], ['foo bar baz'])
+AC_OUTPUT
+# Yes, this appears after AC_OUTPUT.  So what?
+AM_EXTRA_RECURSIVE_TARGETS([baz])
+END
+
+mkdir sub
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+foo-local:
+       : > foo
+bar-local:
+       echo x > bar
+baz-local: ; touch baz
+check-local: foo bar baz
+       ls -l . sub ;: For debugging.
+       test -f foo
+       test -f bar
+       test -f baz
+       test -f sub/foo
+       test -f sub/bar
+       test -f sub/baz
+END
+
+cat > sub/Makefile.am <<'END'
+foo-local bar-local baz-local:
+       touch `echo $@ | sed 's/-local$$//'`
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for t in foo bar baz; do
+  $FGREP "$t-am" Makefile.in
+  $FGREP "$t-am" sub/Makefile.in
+done
+
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+:
diff --git a/t/colon.sh b/t/recurs-user-no-subdirs.sh
similarity index 62%
copy from t/colon.sh
copy to t/recurs-user-no-subdirs.sh
index f3e95a6..ed56d07 100755
--- a/t/colon.sh
+++ b/t/recurs-user-no-subdirs.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+# Copyright (C) 2012 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
@@ -14,33 +14,39 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test for bug reported by Nyul Laszlo.  When using the ":" syntax in
-# AC_OUTPUT, Automake fails to find the correct file.
+# Check that user recursion can be made to work even when $(SUBDIRS)
+# is empty or undefined.
 
 . ./defs || exit 1
 
 cat >> configure.ac <<'END'
-AC_CONFIG_FILES([foo.h:foo.hin])
+AM_EXTRA_RECURSIVE_TARGETS([foo])
 AC_OUTPUT
 END
 
-: > foo.hin
+$ACLOCAL
+$AUTOCONF
 
+# First try with undefined $(SUBDIRS).
 cat > Makefile.am <<'END'
-.PHONY: test
-test: distdir
-       ls -l . $(distdir)
-       test -f foo.h
-       test -f $(distdir)/foo.hin
+all-local: foo
+foo-local:
+       : > bar
+MOSTLYCLEANFILES = bar
 END
-
-$ACLOCAL
 $AUTOMAKE
-$AUTOCONF
-
 ./configure
+$MAKE foo
+test -f bar
+
+$MAKE distclean
+test ! -r bar # Sanity check.
 
-$MAKE test
-$MAKE distcheck
+# Now try with empty but defined $(SUBDIRS).
+echo SUBDIRS = >> Makefile.am
+$AUTOMAKE
+./configure
+$MAKE foo
+test -f bar
 
 :
diff --git a/t/subdir10.sh b/t/recurs-user-no-top-level.sh
similarity index 67%
copy from t/subdir10.sh
copy to t/recurs-user-no-top-level.sh
index 396aecc..f80010a 100755
--- a/t/subdir10.sh
+++ b/t/recurs-user-no-top-level.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+# Copyright (C) 2012 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
@@ -14,24 +14,37 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# SUDBIRS with $fail set in the environment.
+# Check that user recursion works even for targets that don't exist
+# in the top-level Makefile.
 
 . ./defs || exit 1
 
-mkdir sub
-
 cat >> configure.ac <<'END'
 AC_CONFIG_FILES([sub/Makefile])
+AM_EXTRA_RECURSIVE_TARGETS([foo-bar])
 AC_OUTPUT
 END
 
-echo SUBDIRS = sub >Makefile.am
-: > sub/Makefile.am
+mkdir sub
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+all-local: foo-bar
+END
+
+cat > sub/Makefile.am <<'END'
+foo-bar-local:
+       : > foo-bar
+MOSTLYCLEANFILES = foo-bar
+END
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
+
 ./configure
-env fail=1 $MAKE all clean
+
+$MAKE foo-bar
+test -f sub/foo-bar
 
 :
diff --git a/t/autodist-configure-no-subdir.sh b/t/recurs-user-override.sh
similarity index 52%
copy from t/autodist-configure-no-subdir.sh
copy to t/recurs-user-override.sh
index 458142c..64ef2ee 100755
--- a/t/autodist-configure-no-subdir.sh
+++ b/t/recurs-user-override.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# Copyright (C) 2012 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
@@ -14,51 +14,55 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check that 'configure' and 'configure.ac' are *not* automatically
-# distributed when placed in a subdirectory.
-# Related to automake bug#7819.
+# Check that override of user-defined recursive targets work as
+# expected.
 
 . ./defs || exit 1
 
-cat >> configure.ac <<END
+cat >> configure.ac <<'END'
 AC_CONFIG_FILES([sub/Makefile])
+AM_EXTRA_RECURSIVE_TARGETS([foobar zardoz])
 AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
 SUBDIRS = sub
-dontbuild = echo target $@ should not be built >&2; exit 1
-sub/configure:
-       $(dontbuild)
-sub/configure.ac:
-       $(dontbuild)
-check-local: distdir
-       ls -l $(distdir)/sub
-       test ! -f $(distdir)/sub/configure
-       test ! -f $(distdir)/sub/configure.ac
+all-local: foobar zardoz
+foobar:
+       : > foobar.out
+MOSTLYCLEANFILES = foobar.out
+check-local:
+       test -f foobar.out
+       test ! -r sub/foobar.out
+       test -f sub/zardoz.out
+       test ! -r sub/baz.out
 END
 
 mkdir sub
-
 cat > sub/Makefile.am <<'END'
-dontbuild = echo target $@ should not be built >&2; exit 1
-configure:
-       $(dontbuild)
-configure.ac:
-       $(dontbuild)
-check-local:
-       echo $(am__dist_files) $(am__dist_common) \
-          | grep 'configure' && exit 1; :
+foobar foobar-local:
+       : > foobar.out
+zardoz-local:
+       : > baz.out
+zardoz:
+       : > zardoz.out
+MOSTLYCLEANFILES = zardoz.out
 END
 
-: > sub/configure.ac
-: > sub/configure
-
 $ACLOCAL
-$AUTOMAKE
 $AUTOCONF
 
+AUTOMAKE_fails
+grep '^Makefile\.am:3:.*user target.*foobar' stderr
+grep '^Makefile\.am:.*foobar-local.*instead of foobar$' stderr
+grep '^sub/Makefile\.am:5:.*user target.*zardoz' stderr
+grep '^sub/Makefile\.am:.*zardoz-local.*instead of zardoz$' stderr
+
+$AUTOMAKE -Wno-override
+
 ./configure
+
 $MAKE check
+$MAKE distcheck
 
 :
diff --git a/t/subdir10.sh b/t/recurs-user-phony.sh
similarity index 59%
copy from t/subdir10.sh
copy to t/recurs-user-phony.sh
index 396aecc..93ee973 100755
--- a/t/subdir10.sh
+++ b/t/recurs-user-phony.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+# Copyright (C) 2012 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
@@ -14,24 +14,48 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# SUDBIRS with $fail set in the environment.
+# Check that user-defined recursive targets and their associate
+# '-local', '-am' and '-recursive' targets are declared as phony.
 
 . ./defs || exit 1
 
-mkdir sub
-
 cat >> configure.ac <<'END'
 AC_CONFIG_FILES([sub/Makefile])
+AM_EXTRA_RECURSIVE_TARGETS([foo])
 AC_OUTPUT
 END
 
-echo SUBDIRS = sub >Makefile.am
-: > sub/Makefile.am
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+foo-local:
+       echo 'GOOD!' > foo
+END
+
+mkdir sub
+cat > sub/Makefile.am <<'END'
+foo-local:
+       echo 'GOOD!' > foo
+END
+
+dummy_files='
+  foo
+  foo-local
+  foo-am
+  foo-recursive
+  sub/foo
+  sub/foo-local
+  sub/foo-am
+'
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 ./configure
-env fail=1 $MAKE all clean
+
+touch $dummy_files
+
+$MAKE foo
+grep 'GOOD!' foo
+grep 'GOOD!' sub/foo
 
 :
diff --git a/t/instdir-cond.sh b/t/recurs-user-wrap.sh
similarity index 60%
copy from t/instdir-cond.sh
copy to t/recurs-user-wrap.sh
index d0be1a3..c2e70b4 100755
--- a/t/instdir-cond.sh
+++ b/t/recurs-user-wrap.sh
@@ -14,35 +14,45 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check against automake bug#10997: directories holding only
-# conditionally-installed files should not be created unconditionally.
+# Check that rules generated by user recursion are apt to be wrapped
+# by other makefiles.
 
 . ./defs || exit 1
 
 cat >> configure.ac << 'END'
-AM_CONDITIONAL([ENABLE_FOO], [false])
+AM_EXTRA_RECURSIVE_TARGETS([extra])
+AC_CONFIG_FILES([src/Makefile])
 AC_OUTPUT
 END
 
-: > foo
-: > bar
-
-cat > Makefile.am << 'END'
-pkglibexec_SCRIPTS =
-if ENABLE_FOO
-pkgdata_DATA = foo
-pkglibexec_SCRIPTS += bar
-endif
-END
+mkdir src
+echo SUBDIRS = src > Makefile.am
+echo 'bar: ; : > $@ ' > src/Makefile.am
 
 $ACLOCAL
-$AUTOMAKE
 $AUTOCONF
+$AUTOMAKE
+
+./configure
 
-./configure --prefix="$(pwd)/inst"
+$MAKE extra
+test ! -f extra-local
+test ! -f src/bar
+
+cat > GNUmakefile << 'END'
+.DEFAULT_GOAL = all
+extra-local:
+       : > $@
+include ./Makefile
+END
+
+cat > src/GNUmakefile << 'END'
+include ./Makefile
+extra-local: bar
+END
 
-$MAKE install
-test ! -e inst/share/instdir-cond
-test ! -e inst/libexec/instdir-cond
+$MAKE extra
+test -f extra-local
+test -f src/bar
 
 :
diff --git a/t/vpath-built-sources.sh b/t/recurs-user.sh
similarity index 50%
copy from t/vpath-built-sources.sh
copy to t/recurs-user.sh
index ae58511..34a3fd2 100755
--- a/t/vpath-built-sources.sh
+++ b/t/recurs-user.sh
@@ -14,60 +14,68 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# In a VPATH build, a target starting with $(srcdir) is triggered to
-# build a source with the same name but without the $(srcdir).
+# Basic checks on user-defined recursive rules.
+# Check that user recursion respect $(SUBDIRS) order,
+# and proceeds in a depth-first fashion.
 
-required=cc
 . ./defs || exit 1
 
-ocwd=$(pwd) || fatal_ "couldn't get current working directory"
-
 cat >> configure.ac <<'END'
-AC_PROG_CC
+AM_EXTRA_RECURSIVE_TARGETS([foo])
+AC_CONFIG_FILES([
+    sub1/Makefile
+    sub2/Makefile
+    sub3/Makefile
+    sub3/deeper/Makefile
+])
 AC_OUTPUT
 END
 
+mkdir sub1 sub2 sub3 sub3/deeper
+
 cat > Makefile.am <<'END'
-noinst_PROGRAMS = p1 p2 p3 tp1 tp2 tp3
+SUBDIRS = sub1 . sub3 sub2
+foo-local:
+       echo '.' >> $(top_builddir)/got
+.PHONY: test
+test: foo
+       cat $(srcdir)/exp
+       cat ./got
+       diff $(srcdir)/exp ./got
+check-local: test
+MOSTLYCLEANFILES = got
+EXTRA_DIST = exp
+END
+
+for i in 1 2 3; do
+  cat > sub$i/Makefile.am <<END
+foo-local:
+       echo 'sub$i' >> \$(top_builddir)/got
+END
+done
 
-write-it = echo 'int main (void) { return 0; }' >$@
+echo SUBDIRS = deeper >> sub3/Makefile.am
 
-# We keep all the targets on separate lines to make sure the dumb
-# Automake parser actually sees them all.
-$(srcdir)/p1.c:
-       $(write-it)
-${srcdir}/p2.c:
-       $(write-it)
address@hidden@/p3.c:
-       $(write-it)
-$(top_srcdir)/tp1.c:
-       $(write-it)
-${top_srcdir}/tp2.c:
-       $(write-it)
address@hidden@/tp3.c:
-       $(write-it)
+cat >> sub3/deeper/Makefile.am <<'END'
+foo-local:
+       echo sub3/deeper >> $(top_builddir)/got
+END
+
+cat >> exp <<'END'
+sub1
+.
+sub3/deeper
+sub3
+sub2
 END
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-mkdir build
-cd build
-../configure
-$MAKE all
-
-cd "$ocwd"
-rm -f *.c
-mkdir -p sub1/sub2/sub3
-cd sub1/sub2/sub3
-"$ocwd"/configure --disable-dependency-tracking
-$MAKE all
-
-cd "$ocwd"
-rm -f *.c
 ./configure
-$MAKE all
+
+$MAKE test
 $MAKE distcheck
 
 :
diff --git a/t/recurs-user2.sh b/t/recurs-user2.sh
new file mode 100755
index 0000000..0e4cba5
--- /dev/null
+++ b/t/recurs-user2.sh
@@ -0,0 +1,103 @@
+#! /bin/sh
+# Copyright (C) 2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that user recursion can be made to work when $(SUBDIRS) are
+# not "strictly" nested, as in e.g.:
+#    SUBDIRS = src external/lib external/tests
+# with no Makefile in 'external'.
+
+. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_CONFIG_FILES(
+    sub1/Makefile
+    sub2/Makefile
+dnl There's deliberately no 'sub3/Makefile'.
+    sub3/subsub/Makefile
+    sub4/Makefile
+    sub4/subsub/Makefile
+)
+AM_EXTRA_RECURSIVE_TARGETS([foo])
+AC_OUTPUT
+END
+
+mkdir sub1 sub2 sub3 sub4 sub3/subsub sub4/subsub
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub1 sub2 sub3/subsub sub4 sub4/subsub
+
+foo-local:
+       echo _rootdir_ >foo
+MOSTLYCLEANFILES = foo
+
+.PHONY: test
+test: foo
+       grep _rootdir_ foo
+       grep ':sub1:' sub1/foo
+       grep ',sub1,' sub1/bar
+       test ! -r sub2/foo
+       test ! -r sub3/foo
+       grep '%sub3/subsub%' sub3/subsub/quux
+       test ! -r sub3/subsub/foo
+       test ! -r sub4/foo
+       grep '=sub4/subsub=' sub4/subsub/foo
+
+check-local: test
+END
+
+# A 'foo-local' target with dependencies shouldn't cause problems.
+cat > sub1/Makefile.am <<'END'
+foo-local: bar
+       sed 's/,/:/g' bar >foo
+bar:
+       echo ',sub1,' >$@
+MOSTLYCLEANFILES = foo bar
+END
+
+# The lack of a 'foo' target here shouldn't cause any error in
+# automake nor in make.
+: > sub2/Makefile.am
+
+# The lack of file 'sub3/Makefile.am' shouldn't cause any problem either.
+rm -f sub3/Makefile.am
+
+# A 'foo-local' creating a file != 'foo' shouldn't cause any problem.
+cat > sub3/subsub/Makefile.am <<'END'
+foo-local:
+       echo '%sub3/subsub%' >quux
+MOSTLYCLEANFILES = quux
+END
+
+# No 'foo-local' nor 'foo' target here ...
+: > sub4/Makefile.am
+# ... should not cause errors, nor cause the 'foo-local' target
+# here not to be executed.
+cat > sub4/subsub/Makefile.am <<'END'
+foo-local:
+       echo '=sub4/subsub=' >foo
+MOSTLYCLEANFILES = foo
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE test
+$MAKE distcheck
+
+:
diff --git a/t/suffix-rules-old-fashioned.sh b/t/remake-recurs-user.sh
similarity index 55%
copy from t/suffix-rules-old-fashioned.sh
copy to t/remake-recurs-user.sh
index c0dd3d5..027fbb7 100755
--- a/t/suffix-rules-old-fashioned.sh
+++ b/t/remake-recurs-user.sh
@@ -14,59 +14,75 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Automake-NG still accepts old-fashioned suffix rules.
+# Remake rules and user-defined recursive rules.
 
 . ./defs || exit 1
 
 cat >> configure.ac << 'END'
+m4_include([extra-targets.m4])
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 END
 
+echo 'AM_EXTRA_RECURSIVE_TARGETS([foo])' > extra-targets.m4
+
 cat > Makefile.am << 'END'
 SUBDIRS = sub
-foobar: ; cp $< $@
-.mu.um:
-       cp $< $@
-.SUFFIXES: foo bar .mu .um
-data_DATA = xbar question.um
+all-local: foo
+foo-local:
+       : > foo
+bar-local:
+       : > bar
+MOSTLYCLEANFILES = foo
 END
 
 mkdir sub
 cat > sub/Makefile.am << 'END'
-SUFFIXES = .1 2 .3 4
-.1.3 24:
-       sed 's/@/O/' $< >$@
-all-local: bar.3 bar4
+foo-local:
+       : > foo2
+MOSTLYCLEANFILES = foo2
+bar-local: later-target
 END
 
 $ACLOCAL
+$AUTOCONF
 $AUTOMAKE
 
-grep SUFFIXES Makefile.in sub/Makefile.in # For debugging.
+./configure
 
-$AUTOCONF
-echo foofoofoo > xfoo
-echo 'What is the sound of one hand?' > question.mu
-echo '@NE' > sub/bar.1
-echo 'TW@' > sub/bar2
-
-mkdir build
-cd build
-../configure
 $MAKE
-diff ../xfoo xbar
-diff ../question.mu question.um
-test "$(cat sub/bar.3)" = ONE
-test "$(cat sub/bar4)" = TWO
+test -f foo
+test -f sub/foo2
+test ! -f bar
+test ! -f sub/zardoz
+$MAKE distcheck
 
-cd ..
-./configure
-$MAKE
+$sleep
+
+echo 'AM_EXTRA_RECURSIVE_TARGETS([bar])' >> extra-targets.m4
 
-diff xfoo xbar
-diff question.mu question.um
-test "$(cat sub/bar.3)" = ONE
-test "$(cat sub/bar4)" = TWO
+cat >> Makefile.am <<'END'
+MOSTLYCLEANFILES += bar oof
+all-local: bar
+foo-local: oof
+oof:
+       : > $@
+END
+
+echo 'include $(srcdir)/more.am' >> sub/Makefile.am
+
+cat > sub/more.am << 'END'
+later-target:
+       : > zardoz
+DISTCLEANFILES = zardoz
+END
+
+$MAKE
+test -f foo
+test -f oof
+test -f sub/foo2
+test -f bar
+test -f sub/zardoz
+$MAKE distcheck
 
 :
diff --git a/t/recurs.sh b/t/var-recurs.sh
similarity index 94%
rename from t/recurs.sh
rename to t/var-recurs.sh
index 0dc04d3..6071e66 100755
--- a/t/recurs.sh
+++ b/t/var-recurs.sh
@@ -20,8 +20,6 @@
 
 cat >> configure.ac << 'END'
 AC_PROG_CC
-AM_CONDITIONAL(ONE, true)
-AM_CONDITIONAL(TWO, false)
 END
 
 cat > Makefile.am << 'END'
diff --git a/t/recurs2.sh b/t/var-recurs2.sh
similarity index 99%
rename from t/recurs2.sh
rename to t/var-recurs2.sh
index 9472631..0acdc2a 100755
--- a/t/recurs2.sh
+++ b/t/var-recurs2.sh
@@ -27,3 +27,5 @@ END
 
 $ACLOCAL
 $AUTOMAKE
+
+:
diff --git a/t/vartypos.sh b/t/vartypos.sh
index f612a0b..7927163 100755
--- a/t/vartypos.sh
+++ b/t/vartypos.sh
@@ -107,7 +107,7 @@ $MAKE nihil
 $sleep
 echo none_SOURCES = >> Makefile.am
 
-$MAKE nihil 2>stderr && { cat stderr >&2; Exit 1; }
+$MAKE nihil 2>stderr && { cat stderr >&2; exit 1; }
 cat stderr >&2
 
 grep "variable 'none_SOURCES'" stderr


hooks/post-receive
-- 
GNU Automake



reply via email to

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