From: Stefano Lattarini Date: Mon, 30 Jul 2012 10:01:52 +0000 (+0200) Subject: [ng] check: avoid extra recursive make invocations X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd5adbfbbfee8c6b16946250dc151c5ffa67db76;p=thirdparty%2Fautomake.git [ng] check: avoid extra recursive make invocations After this change, "make check" will not cause any recursive make invocation by default (unless there are $(SUBDIRS) to descend into, of course). One little price to pay is that the targets 'check-TESTS', 'check-DEJAGNU' and 'check-local' will always be defined (being dummy by default). The other one is that the old semantics are not 100% preserved, so corner cases that worked in mainline Automake might not work anymore out-of-the-box with Automake-NG, thus requiring the user to make his dependency declarations more complete or precises. We believe these prices are well worth paying. * lib/am/check-target.am: Rewrite 'check-am' handling to avoid the extra make recursion(s). A side effect of this is that the transform '%CHECK-DEPS%' is no more needed. Accordingly ... * automake.in (@check_tests): ... drop definition and updating of this variable throughout, and ... (handle_all_and_check): ... the definition of the '%CHECK-TESTS%' transform when processing the 'check-target.am' file. * t/local-targets.sh: Adjust to avoid spurious failures. * t/checkall.sh: Remove, it's quite obsolete (and has just started to spuriously fail). Signed-off-by: Stefano Lattarini --- diff --git a/automake.in b/automake.in index f7055c57e..698549fa7 100644 --- a/automake.in +++ b/automake.in @@ -528,7 +528,6 @@ my @include_stack; # List of dependencies for the obvious targets. my @all; my @check; -my @check_tests; # Keys in this hash table are files and directories to delete. The # associated value tells when this should happen (MOSTLY_CLEAN, @@ -647,7 +646,6 @@ sub initialize_per_input () @all = (); @check = (); - @check_tests = (); %clean_files = (); %clean_dirs = (); @@ -3905,8 +3903,7 @@ sub handle_all_and_check () 'ALL-DEPS' => "@all", 'LOCAL-HEADERS' => "@local_headers"); - almost_verbatim ('check-target', - 'CHECK-TESTS' => "@check_tests"); + almost_verbatim ('check-target'); } # Generate helper targets for user recursion, where needed. @@ -4078,7 +4075,6 @@ sub handle_factored_dependencies # ------------------------ sub handle_tests_dejagnu { - push (@check_tests, 'check-DEJAGNU'); $output_rules .= file_contents ('dejagnu', new Automake::Location); } @@ -4100,7 +4096,6 @@ sub handle_tests if (var ('TESTS')) { - push (@check_tests, 'check-TESTS'); almost_verbatim ('color-tests'); if (option 'serial-tests') { diff --git a/lib/am/check-target.am b/lib/am/check-target.am index dba23d146..29d73acc3 100644 --- a/lib/am/check-target.am +++ b/lib/am/check-target.am @@ -25,8 +25,9 @@ endif # ensure all the primary targets are built; then it must build the # local check dependencies, and finally run the actual tests (as given # by $(TESTS), by DejaGNU, and by the 'check-local' target). -check-am: all-am - $(if $(am.test-suite.deps),$(MAKE) $(am.test-suite.deps),@:) - $(MAKE) %CHECK-TESTS% check-local +am.test-suite.check-targets = check-DEJAGNU check-TESTS check-local +.PHONY: $(am.test-suite.check-targets) +check-am: $(am.test-suite.check-targets) +$(am.test-suite.check-targets): all-am $(am.test-suite.deps) check: $(if $(SUBDIRS),check-recursive,check-am) diff --git a/t/checkall.sh b/t/checkall.sh deleted file mode 100755 index 43205745e..000000000 --- a/t/checkall.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# Copyright (C) 1996-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 . - -# Test for bug where check target doesn't depend on all. - -. ./defs || exit 1 - -cat > Makefile.am << 'END' -bin_SCRIPTS = derived -check-local: - true -END - -$ACLOCAL -$AUTOMAKE - -grep '^check-am:.*all-am' Makefile.in -grep 'MAKE.*check-local' Makefile.in diff --git a/t/local-targets.sh b/t/local-targets.sh index d15bc809a..d7db7d493 100755 --- a/t/local-targets.sh +++ b/t/local-targets.sh @@ -28,17 +28,19 @@ END cat > Makefile.am <<'END' @SafeInclude@ ./inc.mk -$(foreach x,all check installdirs,$(eval $(x)-local:: ; : > main-$(x))) +$(foreach x,all check installdirs,$(eval $(x)-local: ; : > main-$(x))) END cat > inc.mk << 'END' -all-local check-local installdirs-local:: %-local: +all-local check-local installdirs-local: %-local: %-incl +all-incl check-incl installdirs-incl: %-incl: : > incl-$* END cat > GNUmakefile << 'END' include ./Makefile -all-local check-local installdirs-local:: %-local: +all-local check-local installdirs-local: %-local: %-wrap +all-wrap check-wrap installdirs-wrap: %-wrap: : > wrap-$* END