automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 2/2] [ng] all, check, install: move more processing


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 2/2] [ng] all, check, install: move more processing at make runtime
Date: Fri, 15 Jun 2012 00:05:08 +0200

A welcome collateral effect of this change is that now the 'check-local',
'all-local' and 'installdirs-local' targets can also be defined in
wrapper Makefiles or in Makefile fragments only included at make (not
automake) runtime, without their definition ever having to be seen by
Automake.

* lib/am/all-target.am: New file, implementing the 'all' target.
* lib/am/check-target.am: New file, implementing the 'check' target.
* automake.in (handle_install): Adjust by processing it simply with
'&preprocess_file', and placing its content in '$output_verbatim'
rather than in '$output_rules'.
(handle_all, )
* lib/am/install.am: Largely rewritten to rely on GNU make runtime
capabilities rather than on automake-runtime preprocessing.
* automake.in (handle_install): Adjust by processing it simply with
'&preprocess_file', and placing its content in '$output_verbatim'
rather than in '$output_rules'.
* automake.in (handle_all, do_check_merge_target): Merged into ...
(handle_all_and_check): ... this, and largely rewritten to rely
on the new 'lib/am/{all,check}-target.am' files.
(generate_makefile): Adjust.
* Makefile.am (dist_am_DATA): Add the new '.am' files.
(XFAIL_TESTS): Add test 't/override-suggest-local.sh', that has been
broken by this change (we consider this an acceptable trade-off).
* doc/automake-ng.texi: Remove reference to removed test.
* lib/am/header-vars.am: Sanitize $(SUBDIRS), by setting it to the
empty value if it is not set, but not from the Makefile not any
command-line override.
* t/built-sources-check.sh: Remove obsolete grepping checks.
* t/remake-all-1.sh: Likewise.
* t/bsource.sh: Adjust and enhance.
* t/check.sh: Remove as basically obsolete.
* t/check2.sh: Relax grepping checks.
* t/doc-parsing-buglets-tabs.sh: Remove as too brittle.
* t/local-targets.sh: New test.
* t/tap-diagnostic.sh: Fix grepping of "make check" stdout to avoid
spurious errors.
* t/phony.sh: Tweak, to avoid spurious failure.
* t/vartar.sh: Likewise.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 Makefile.am                   |    3 ++
 automake.in                   |  115 ++++++-----------------------------------
 doc/automake-ng.texi          |    1 -
 lib/am/all-target.am          |   34 ++++++++++++
 lib/am/check-target.am        |   38 ++++++++++++++
 lib/am/header-vars.am         |   10 ++++
 lib/am/install.am             |   80 ++++++++++++++--------------
 t/bsource.sh                  |   10 +++-
 t/built-sources-check.sh      |    5 --
 t/check.sh                    |   41 ---------------
 t/check2.sh                   |    6 +--
 t/doc-parsing-buglets-tabs.sh |   59 ---------------------
 t/local-targets.sh            |   62 ++++++++++++++++++++++
 t/phony.sh                    |    2 +-
 t/remake-all-1.sh             |    4 +-
 t/tap-diagnostic.sh           |    4 +-
 t/vartar.sh                   |   14 ++---
 17 files changed, 225 insertions(+), 263 deletions(-)
 create mode 100644 lib/am/all-target.am
 create mode 100644 lib/am/check-target.am
 delete mode 100755 t/check.sh
 delete mode 100755 t/doc-parsing-buglets-tabs.sh
 create mode 100755 t/local-targets.sh

diff --git a/Makefile.am b/Makefile.am
index 09ecc3f..c072b3f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -185,6 +185,8 @@ EXTRA_DIST += lib/Automake/Config.in
 ## --------------------- ##
 
 dist_am_DATA = \
+  lib/am/all-target.am \
+  lib/am/check-target.am \
   lib/am/serial-tests.am \
   lib/am/parallel-tests.am \
   lib/am/check-typos.am \
@@ -333,6 +335,7 @@ perl_fake_XFAIL_TESTS = \
 
 XFAIL_TESTS = \
   t/all.sh \
+  t/override-suggest-local.sh \
   t/yacc-bison-skeleton-cxx.sh \
   t/yacc-bison-skeleton.sh \
   t/comments-in-var-def.sh \
diff --git a/automake.in b/automake.in
index 7080132..c5912aa 100644
--- a/automake.in
+++ b/automake.in
@@ -4139,110 +4139,27 @@ sub handle_footer
 # Generate 'make install' rules.
 sub handle_install ()
 {
-  $output_rules .= &file_contents
-    ('install',
-     new Automake::Location,
-     maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
-                            ? (" \$(BUILT_SOURCES)\n"
-                               . "\t\$(MAKE)")
-                            : ''),
-     'installdirs-local' => (user_phony_rule 'installdirs-local'
-                            ? ' installdirs-local' : ''),
-     am__installdirs => variable_value ('am__installdirs') || '');
+  $output_verbatim .= preprocess_file ("$libdir/am/install.am");
 }
 
-
-# Deal with all and all-am.
-sub handle_all ($)
+# Generate "make all" and "make check" rules.
+sub handle_all_and_check ()
 {
-    my ($makefile) = @_;
-
-    # Output 'all-am'.
-
-    # Put this at the beginning for the sake of non-GNU makes.  This
-    # is still wrong if these makes can run parallel jobs.  But it is
-    # right enough.
-    unshift (@all, basename ($makefile));
-
-    foreach my $spec (@config_headers)
-      {
-       my ($out, @ins) = split_config_file_spec ($spec);
-       push (@all, basename ($out))
-         if dirname ($out) eq $relative_dir;
-      }
-
-    # Install 'all' hooks.
-    push (@all, "all-local")
-      if user_phony_rule "all-local";
-
-    &pretty_print_rule ("all-am:", "\t\t", @all);
-    &depend ('.PHONY', 'all-am', 'all');
-
-
-    # Output 'all'.
-
-    my @local_headers = ();
-    push @local_headers, '$(BUILT_SOURCES)'
-      if var ('BUILT_SOURCES');
-    foreach my $spec (@config_headers)
-      {
-       my ($out, @ins) = split_config_file_spec ($spec);
-       push @local_headers, basename ($out)
-         if dirname ($out) eq $relative_dir;
-      }
-
-    if (@local_headers)
-      {
-       # We need to make sure config.h is built before we recurse.
-       # We also want to make sure that built sources are built
-       # before any ordinary 'all' targets are run.  We can't do this
-       # by changing the order of dependencies to the "all" because
-       # that breaks when using parallel makes.  Instead we handle
-       # things explicitly.
-        $output_rules .= ("all: @local_headers"
-                          . "\n\t\$(MAKE) "
-                          . (var ('SUBDIRS') ? 'all-recursive' : 'all-am')
-                          . "\n\n");
-      }
-    else
-      {
-        $output_rules .= "all: " . (var ('SUBDIRS')
-                                    ? 'all-recursive' : 'all-am') . "\n\n";
-      }
-}
-
-
-# &do_check_merge_target ()
-# -------------------------
-# Handle check merge target specially.
-sub do_check_merge_target ()
-{
-  # Include user-defined local form of target.
-  push @check_tests, 'check-local'
-    if user_phony_rule 'check-local';
-
-  # The check target must depend on the local equivalent of
-  # 'all', to ensure all the primary targets are built.  Then it
-  # must build the local check rules.
-  $output_rules .= "check-am: all-am\n";
-  if (@check)
+  my @local_headers = ();
+  foreach my $spec (@config_headers)
     {
-      pretty_print_rule ("\t\$(MAKE)", "\t  ", @check);
+      my ($out, @ins) = split_config_file_spec ($spec);
+      push (@local_headers, basename ($out))
+        if dirname ($out) eq $relative_dir;
     }
 
-  if (@check_tests)
-    {
-      pretty_print_rule ("\t\$(MAKE)", "\t  ", @check_tests);
-    }
+  $output_verbatim .= preprocess_file ("$libdir/am/all-target.am",
+                                       'ALL-DEPS' => "@all",
+                                       'LOCAL-HEADERS' => "@local_headers");
 
-  depend '.PHONY', 'check', 'check-am';
-  # Handle recursion.  We have to honor BUILT_SOURCES like for 'all:'.
-  $output_rules .= ("check: "
-                   . (var ('BUILT_SOURCES')
-                      ? "\$(BUILT_SOURCES)\n\t\$(MAKE) "
-                      : '')
-                   . (var ('SUBDIRS') ? 'check-recursive' : 'check-am')
-                   . "\n");
+  $output_verbatim .= preprocess_file ("$libdir/am/check-target.am",
+                                       'CHECK-DEPS' => "@check",
+                                       'CHECK-TESTS' => "@check_tests");
 }
 
 # handle_clean ($MAKEFILE)
@@ -7254,8 +7171,8 @@ sub generate_makefile ($$)
   handle_dist;
 
   handle_footer;
-  do_check_merge_target;
-  handle_all ($makefile);
+  # Special targets "all" and "check".
+  handle_all_and_check;
 
   # FIXME: Gross!
   if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS'))
diff --git a/doc/automake-ng.texi b/doc/automake-ng.texi
index b446fee..558ad0a 100644
--- a/doc/automake-ng.texi
+++ b/doc/automake-ng.texi
@@ -1836,7 +1836,6 @@ variable definitions.
 Generally, Automake is not particularly smart in the parsing of unusual
 Makefile constructs, so you're advised to avoid fancy constructs or
 ``creative'' use of whitespaces.
address@hidden Keep this in sync with doc-parsing-buglets-tabs.sh
 For example, @key{TAB} characters cannot be used between a target name
 and the following address@hidden:}'' character, and variable assignments
 shouldn't be indented with @key{TAB} characters.
diff --git a/lib/am/all-target.am b/lib/am/all-target.am
new file mode 100644
index 0000000..25b075a
--- /dev/null
+++ b/lib/am/all-target.am
@@ -0,0 +1,34 @@
+## automake - create Makefile.in from Makefile.am
+## 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/>.
+
+## The 'all' target.
+
+.PHONY: all all-am all-local
+ifdef SUBDIRS
+.PHONY: all-recursive
+endif
+
+all-am: all-local %ALL-DEPS%
+
+# We need to make sure config.h is built before we recurse.
+# We also want to make sure that built sources are built
+# before any ordinary 'all' targets are run.
+ifeq ($(strip %LOCAL-HEADERS% $(BUILT_SOURCES)),)
+all: $(if $(SUBDIRS),all-recursive,all-am)
+else
+all: %LOCAL-HEADERS% $(BUILT_SOURCES)
+       $(MAKE) $(if $(SUBDIRS),all-recursive,all-am)
+endif
diff --git a/lib/am/check-target.am b/lib/am/check-target.am
new file mode 100644
index 0000000..cc3d25d
--- /dev/null
+++ b/lib/am/check-target.am
@@ -0,0 +1,38 @@
+## automake - create Makefile.in from Makefile.am
+## 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/>.
+
+## The 'check' target.
+
+.PHONY: check check-am check-local
+ifdef SUBDIRS
+.PHONY: check-recursive
+endif
+
+# The check target must depend on the local equivalent of 'all', to
+# 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 %CHECK-DEPS%,$(MAKE) %CHECK-DEPS%,@:)
+       $(MAKE) %CHECK-TESTS% check-local
+
+# Handle recursion.  We have to honor BUILT_SOURCES like for 'all:'.
+ifdef BUILT_SOURCES
+check: $(BUILT_SOURCES)
+       $(MAKE) $(if $(SUBDIRS),check-recursive,check-am)
+else
+check: $(if $(SUBDIRS),check-recursive,check-am)
+endif
diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index 74870c6..c4f14d0 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -50,6 +50,16 @@ ifndef .FEATURES
   $(error Automake-NG based builds require GNU make 3.81 or later)
 endif
 
+## Neutralize unwarranted environment settings that might interfere with
+## our Makefiles.
+ifdef SUBDIRS
+  ifneq "$(origin SUBDIRS)" "file"
+    ifneq "$(origin SUBDIRS)" "command line"
+      SUBDIRS :=
+    endif
+  endif
+endif
+
 am__mkdir = test -d $1 || $(MKDIR_P) $1
 
 # In a recipe, ensure the given directory exists, creating it if
diff --git a/lib/am/install.am b/lib/am/install.am
index ec7aa52..80af8a1 100644
--- a/lib/am/install.am
+++ b/lib/am/install.am
@@ -18,28 +18,24 @@
 ## installdirs -- Creating the installdirs.  ##
 ## ----------------------------------------- ##
 
-## The reason we loop over %am__installdirs% (instead of simply running
-## $(MKDIR_P) %am__installdirs%) is that directories variable such as
-## "$(DESTDIR)$(mydir)" can potentially expand to "" if $(mydir) is
-## conditionally defined.  BTW, those directories are quoted in order
-## to support installation paths with spaces.
-
-if %?SUBDIRS%
-.PHONY: installdirs installdirs-am
+.PHONY: installdirs installdirs-local
+ifdef SUBDIRS
+.PHONY: installdirs-am
 RECURSIVE_TARGETS += installdirs-recursive
 installdirs: installdirs-recursive
-installdirs-am:%installdirs-local%
-?am__installdirs?      for dir in %am__installdirs%; do \
-?am__installdirs?        test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-?am__installdirs?      done
-else !%?SUBDIRS%
-.PHONY: installdirs
-installdirs:%installdirs-local%
-?am__installdirs?      for dir in %am__installdirs%; do \
-?am__installdirs?        test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-?am__installdirs?      done
-endif !%?SUBDIRS%
+endif
 
+$(if $(SUBDIRS),installdirs-am,installdirs): installdirs-local
+ifdef am__installdirs
+## The reason we loop over $(am__installdirs), instead of simply running
+## "$(MKDIR_P) $(am__installdirs), is that directories variable such as
+## "$(DESTDIR)$(mydir)" can potentially expand to "" if $(mydir) is
+## conditionally defined.  BTW, those directories are quoted in order
+## to support installation paths with spaces.
+       for dir in $(am__installdirs); do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+endif
 
 ## ----------------- ##
 ## Install targets.  ##
@@ -48,19 +44,24 @@ endif !%?SUBDIRS%
 .PHONY: install install-exec install-data uninstall
 .PHONY: install-exec-am install-data-am uninstall-am
 
-if %?SUBDIRS%
-RECURSIVE_TARGETS += install-data-recursive install-exec-recursive \
-                    install-recursive uninstall-recursive
-install:%maybe_BUILT_SOURCES% install-recursive
+ifdef SUBDIRS
+RECURSIVE_TARGETS += install-data-recursive install-exec-recursive
+RECURSIVE_TARGETS += install-recursive uninstall-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
 uninstall: uninstall-recursive
-else !%?SUBDIRS%
-install:%maybe_BUILT_SOURCES% install-am
+else
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
-endif !%?SUBDIRS%
+endif
+
+ifdef BUILT_SOURCES
+install: $(BUILT_SOURCES)
+       $(MAKE) $(if $(SUBDIRS),install-recursive,install-am)
+else
+install: $(if $(SUBDIRS),install-recursive,install-am)
+endif
 
 .PHONY: install-am
 install-am: all-am
@@ -68,16 +69,18 @@ install-am: all-am
 
 
 .PHONY: installcheck
-?SUBDIRS?installcheck: installcheck-recursive
-?!SUBDIRS?installcheck: installcheck-am
-?!SUBDIRS?.PHONY: installcheck-am
-?!SUBDIRS?installcheck-am:
+ifdef SUBDIRS
+installcheck: installcheck-recursive
+else
+installcheck: installcheck-am
+.PHONY: installcheck-am
+installcheck-am:
+endif
 
 ## If you ever modify this, keep in mind that INSTALL_PROGRAM is used
 ## in subdirectories, so never set it to a value relative to the top
 ## directory.
 .PHONY: install-strip
-install-strip:
 ## Beware that there are two variables used to install programs:
 ##   INSTALL_PROGRAM is used for ordinary *_PROGRAMS
 ##   install_sh_PROGRAM is used for nobase_*_PROGRAMS (because install-sh
@@ -90,12 +93,9 @@ install-strip:
 ##
 ## The case for empty $(STRIP) is separate so that it is quoted correctly for
 ## multiple words, but does not expand to an empty words if STRIP is empty.
-       if test -z '$(STRIP)'; then \
-         $(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s 
\
-             install; \
-       else \
-         $(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s 
\
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
+install-strip:
+       $(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+               install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+               INSTALL_STRIP_FLAG=-s \
+               $(if $(STRIP),"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'") \
+               install
diff --git a/t/bsource.sh b/t/bsource.sh
index 482015f..0ab31f7 100755
--- a/t/bsource.sh
+++ b/t/bsource.sh
@@ -27,6 +27,14 @@ END
 
 $ACLOCAL
 $AUTOMAKE
-grep 'install-recursive' Makefile.in && Exit 1
+$AUTOCONF
+
+./configure
+
+for t in all check install; do
+  $MAKE -n $t-recursive 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep " [Nn]o rule to make target.*[\`\"']$t-recursive" stderr
+done
 
 :
diff --git a/t/built-sources-check.sh b/t/built-sources-check.sh
index 8ac82f9..37a5da3 100755
--- a/t/built-sources-check.sh
+++ b/t/built-sources-check.sh
@@ -63,11 +63,6 @@ cat stdout
 grep '^PASS: subrun\.sh *$' stdout
 grep 'PASS.*echo\.sh' stdout && Exit 1
 
-# check should depend directly on $(BUILT_SOURCES) (similar tests
-# are in check.test and check2.test).
-$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' Makefile.in
-$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' dir/Makefile.in
-
 $MAKE distcheck
 
 :
diff --git a/t/check.sh b/t/check.sh
deleted file mode 100755
index 1edd60f..0000000
--- a/t/check.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-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/>.
-
-# Test Automake style tests.
-
-# For gen-testsuite-part: ==> try-with-serial-tests <==
-. ./defs || Exit 1
-
-cat > Makefile.am << 'END'
-TESTS = frob.test
-END
-
-test x"$am_serial_tests" = x"yes" || : > test-driver
-
-$ACLOCAL
-$AUTOMAKE
-
-grep 'check-TESTS.*:' Makefile.in
-grep 'check-DEJAGNU' Makefile.in && Exit 1
-
-# 'check-TESTS' is phony.
-sed -n '/^\.PHONY:/,/^$/p' Makefile.in | $EGREP '(^| )check-TESTS($| )'
-
-# 'check' should depend directly on 'check-am' (similar tests are
-# in check2.test and check3.test).
-$EGREP '^check:.* check-am( |$)' Makefile.in
-
-:
diff --git a/t/check2.sh b/t/check2.sh
index 66ea973..439f04b 100755
--- a/t/check2.sh
+++ b/t/check2.sh
@@ -56,10 +56,8 @@ cat stdout
 grep '^PASS: subrun\.sh *$' stdout
 grep 'PASS.*echo\.sh' stdout && Exit 1
 
-# 'check' should depend directly on 'check-am' (similar tests are
-# in check.test and check3.test).
-$EGREP '^check:.* check-recursive( |$)' Makefile.in
-$EGREP '^check:.* check-am( |$)' dir/Makefile.in
+$EGREP '^check:.*check-recursive' Makefile.in
+$EGREP '^check:.*check-am' dir/Makefile.in
 
 # Make sure subrun.sh is still on its line as above.  This means Automake
 # hasn't rewritten the TESTS line unnecessarily.
diff --git a/t/doc-parsing-buglets-tabs.sh b/t/doc-parsing-buglets-tabs.sh
deleted file mode 100755
index 22c981c..0000000
--- a/t/doc-parsing-buglets-tabs.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011-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 the documented limitation of the Automake's Makefile parser w.r.t.
-# use of TAB characters; see Section "General Operation" in the Automake
-# manual, and automake bug#8360.
-# If you cause some parts of this test to fail, chances are that you've
-# improved the Automake parser ;-)
-
-. ./defs || Exit 1
-
-cat > Makefile.am <<END
-.PHONY: test
-test: all check
-
-fail:
address@hidden "'\$@ recipe executed'"; exit 1
-
-## This won't be recognized as a target+recipe by Automake.
-all-local${tab}:
address@hidden 1
-
-## This won't be recognized as a target+rdependency by Automake.
-all-local${tab}: fail
-
-just_to_separate: dummy deps
-
-## This won't be recognized as a variable assignment by Automake.
-${tab}bin_PROGRAMS = foo
-END
-
-echo AC_OUTPUT >> configure.ac
-
-$ACLOCAL
-$AUTOMAKE
-
-$FGREP '$(EXEEEXT)' Makefile.in && Exit 1
-grep 'all:.*all-local' Makefile.in && Exit 1
-grep "^${tab}bin_PROGRAMS = foo" Makefile.in
-
-$AUTOCONF
-./configure
-
-$MAKE test
-
-:
diff --git a/t/local-targets.sh b/t/local-targets.sh
new file mode 100755
index 0000000..003a7e3
--- /dev/null
+++ b/t/local-targets.sh
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2001-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/>.
+
+# The 'all-local', 'check-local' and 'installdirs-local' targets can
+# also be defined by included or wrapper Makefiles that Automake never
+# sees, as well as through GNU make constructs that Automake does not
+# parse.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_SUBST([SafeInclude], [include])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
address@hidden@ ./inc.mk
+$(foreach x,all check installdirs,$(eval $(x)-local:: ; : > main-$(x)))
+END
+
+cat > inc.mk << 'END'
+all-local check-local installdirs-local:: %-local:
+       : > incl-$*
+END
+
+cat > GNUmakefile << 'END'
+include ./Makefile
+all-local check-local installdirs-local:: %-local:
+       : > wrap-$*
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE check installdirs
+test -f wrap-all
+test -f wrap-check
+test -f wrap-installdirs
+test -f incl-all
+test -f incl-check
+test -f incl-installdirs
+test -f main-all
+test -f main-check
+test -f main-installdirs
+
+:
diff --git a/t/phony.sh b/t/phony.sh
index a818cfb..5382470 100755
--- a/t/phony.sh
+++ b/t/phony.sh
@@ -26,4 +26,4 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
-test `$FGREP .PHONY: Makefile.in | wc -l` = 3
+test `$FGREP .PHONY: Makefile.in | wc -l` -gt 3
diff --git a/t/remake-all-1.sh b/t/remake-all-1.sh
index 066d6e2..92beb09 100755
--- a/t/remake-all-1.sh
+++ b/t/remake-all-1.sh
@@ -37,11 +37,9 @@ echo SUBDIRS = sub > $mkfile.am
 : > sub/$mkfile.am
 
 $ACLOCAL
+$AUTOCONF
 $AUTOMAKE
 
-$EGREP "^all-am:.* $mkfile( |$)" $mkfile.in sub/$mkfile.in
-
-$AUTOCONF
 ./configure
 
 $FGREP "$magic1" mkfile.in && Exit 1 # Sanity check.
diff --git a/t/tap-diagnostic.sh b/t/tap-diagnostic.sh
index e7aaff5..29b8628 100755
--- a/t/tap-diagnostic.sh
+++ b/t/tap-diagnostic.sh
@@ -54,7 +54,7 @@ END
 
 $MAKE check >stdout || { cat stdout; Exit 1; }
 cat stdout
-$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
+$EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
 count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
 
 echo 'AM_TEST_LOG_DRIVER_FLAGS = --comments' >> Makefile
@@ -69,7 +69,7 @@ count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 
skip=1 error=0
 $MAKE check TEST_LOG_DRIVER_FLAGS="--no-comments" >stdout \
   || { cat stdout; Exit 1; }
 cat stdout
-$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
+$EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
 count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
 
 # The "#"-prepended lines here shouldn't be parsed as test results.
diff --git a/t/vartar.sh b/t/vartar.sh
index ebac14b..d5ddf65 100755
--- a/t/vartar.sh
+++ b/t/vartar.sh
@@ -19,21 +19,21 @@
 . ./defs || Exit 1
 
 cat > Makefile.am << 'END'
-install = install
-install:
-       $(install) install
+xinstall = xinstall
+xinstall:
+       $(xinstall) xinstall
 END
 
 $ACLOCAL
 $AUTOMAKE -Wno-override
 
-grep '^install = install$' Makefile.in
+grep '^xinstall = xinstall$' Makefile.in
 
 cat > target.expected <<'EOF'
-install:
-       $(install) install
+xinstall:
+       $(xinstall) xinstall
 EOF
-sed -n '/^install:/,/^ /p' Makefile.in > target.value
+sed -n '/^xinstall:/,/^        /p' Makefile.in > target.value
 diff target.expected target.value
 
 :
-- 
1.7.9.5




reply via email to

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