Fixed check target handling for parallel make
authorTom Tromey <tromey@redhat.com>
Sun, 24 Nov 1996 07:54:52 +0000 (07:54 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 24 Nov 1996 07:54:52 +0000 (07:54 +0000)
ChangeLog
Makefile.in
TODO
automake.in
m4/Makefile.in
tests/Makefile.in

index f31208d..e1d1bb7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 Sun Nov 24 00:33:50 1996  Tom Tromey  <tromey@cygnus.com>
 
+       Fix for bug reported by François Pinard:
+       * automake.in (do_check_merge_target): New sub.
+       (do_one_merge_target): No longer handle `check'.
+       (handle_merge_targets): Use do_check_merge_target.
+       (initialize_per_input): Set @check_tests.
+       (handle_tests): Push onto @check_tests, not @check.
+
        * automake.in (am_install_var): Typo fix.
        (handle_configure): Require $inputs[0].
 
index 9cfebc8..e7cd527 100644 (file)
@@ -78,10 +78,10 @@ TEXINFOS = automake.texi
 DATA =  $(pkgdata_DATA)
 
 DIST_COMMON =  README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
-Makefile.in NEWS README README-alpha THANKS TODO aclocal.in aclocal.m4 \
-ansi2knr.1 ansi2knr.c automake.in config.guess config.sub configure \
-configure.in elisp-comp install-sh interlock mdate-sh mkinstalldirs \
-stamp-vti texinfo.tex version.texi ylwrap
+Makefile.in NEWS README README-alpha THANKS TODO aclocal.m4 ansi2knr.1 \
+ansi2knr.c automake.in config.guess config.sub configure configure.in \
+elisp-comp install-sh interlock mdate-sh mkinstalldirs stamp-vti \
+texinfo.tex version.texi ylwrap
 
 
 PACKAGE = @PACKAGE@
@@ -111,7 +111,7 @@ $(srcdir)/configure: configure.in $(ACLOCAL) $(CONFIGURE_DEPENDENCIES)
        cd $(srcdir) && autoconf
 automake: $(top_builddir)/config.status automake.in
        cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
-aclocal: $(top_builddir)/config.status aclocal.in
+aclocal: $(top_builddir)/config.status automake.in aclocal.in
        cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
 
 install-binSCRIPTS: $(bin_SCRIPTS)
@@ -435,7 +435,7 @@ uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
 all-recursive check-recursive installcheck-recursive info-recursive \
 dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
 maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir info dvi check \
+distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
 installcheck-local installcheck all-am install-exec-am install-data-am \
 uninstall-am install-exec install-data install uninstall all \
 installdirs mostlyclean-generic distclean-generic clean-generic \
diff --git a/TODO b/TODO
index 2c56d2f..951dd67 100644 (file)
--- a/TODO
+++ b/TODO
@@ -16,6 +16,9 @@ Priorities for release:
 
 * look @ jim's $(t:=foo) problem
 
+* should install-foo target for a new dir (eg fooexecdir) be run via
+  install-data or install-exec?  Consider examining name of variable.
+
 ================================================================
 
 * only remove libtool at top level?
index cc82781..d443252 100755 (executable)
@@ -1433,7 +1433,7 @@ sub handle_scripts
            && &variable_defined ($key . '_SCRIPTS'))
        {
            $scripts_installed = 1;
-           # push (@check, 'check-' . $key . 'SCRIPTS');
+           # push (@check_tests, 'check-' . $key . 'SCRIPTS');
        }
     }
 
@@ -2227,7 +2227,7 @@ sub handle_subdirs
     }
     &push_phony_cleaners ('recursive');
 
-    push (@check, "check-recursive");
+    push (@check_tests, "check-recursive");
     push (@installcheck, "installcheck-recursive");
     push (@info, "info-recursive");
     push (@dvi, "dvi-recursive");
@@ -2561,7 +2561,7 @@ sub handle_merge_targets
 
     &do_one_merge_target ('info', @info);
     &do_one_merge_target ('dvi', @dvi);
-    &do_one_merge_target ('check', @check);
+    &do_check_merge_target;
     &do_one_merge_target ('installcheck', @installcheck);
 
     if (defined $options{'no-installinfo'})
@@ -2766,30 +2766,46 @@ sub do_one_merge_target
        push (@phony, $name . '-local');
     }
 
-    local ($done) = 0;
-    if ($name eq 'check')
+    &pretty_print_rule ($name . ":", "\t\t", @values);
+    push (@phony, $name);
+}
+
+# Handle check merge target specially.
+sub do_check_merge_target
+{
+    if (defined $contents{'check-local'})
     {
-       if (! &variable_defined ('SUBDIRS'))
-       {
-           # 'check' must depend on `all', but not when doing
-           # recursive build.
-           unshift (@values, 'all');
-       }
-       else
-       {
-           # When subdirs are used, do the `all' build and then do
-           # all the recursive stuff.  Actually use `all-am' because
-           # it doesn't recurse; we rely on the check target in the
-           # subdirs to do the required builds there.
-           $output_rules .= "check: all-am\n";
-           &pretty_print_rule ("\t\$(MAKE)", "\t  ", @values);
-           $done = 1;
-       }
+       # User defined local form of target.  So include it.
+       push (@check_tests, 'check-local');
+       push (@phony, 'check-local');
     }
 
-    &pretty_print_rule ($name . ":", "\t\t", @values)
-       unless $done;
-    push (@phony, $name);
+    if (! &variable_defined ('SUBDIRS'))
+    {
+       # 'check' must depend on `all', but not when doing recursive
+       # build.
+       unshift (@check, 'all');
+    }
+    else
+    {
+       # When subdirs are used, do the `all' build and then do all
+       # the recursive stuff.  Actually use `all-am' because it
+       # doesn't recurse; we rely on the check target in the subdirs
+       # to do the required builds there.
+       unshift (@check, 'all-am');
+    }
+
+    # The check target must depend on the local equivalent of `all',
+    # to ensure all the primary targets are built.  Also it must
+    # depend on the test code named in @check.
+    &pretty_print_rule ('check:', "\t\t", @check);
+
+    # Now the check rules must explicitly run anything named in
+    # @check_tests.  This is done via a separate make invocation to
+    # avoid problems with parallel makes.  Every time I write code
+    # like this I wonder: how could you invent a parallel make and not
+    # provide any real synchronization facilities?
+    &pretty_print_rule ("\t\$(MAKE)", "\t  ", @check_tests);
 }
 
 # Handle all 'clean' targets.
@@ -2874,7 +2890,7 @@ sub handle_tests
 {
     if (defined $options{'dejagnu'})
     {
-       push (@check, 'check-DEJAGNU');
+       push (@check_tests, 'check-DEJAGNU');
        push (@phony, 'check-DEJAGNU');
 
        local ($xform);
@@ -2948,7 +2964,7 @@ sub handle_tests
 
     if (&variable_defined ('TESTS'))
     {
-       push (@check, 'check-TESTS');
+       push (@check_tests, 'check-TESTS');
        push (@phony, 'check-TESTS');
        # FIXME: use $(SHELL) here?  That is what Ulrich suggests.
        # Maybe a new macro, $(TEST_SHELL), a la $(CONFIG_SHELL)?  For
@@ -3906,6 +3922,7 @@ sub initialize_per_input
     @dvi = ();
     @all = ();
     @check = ();
+    @check_tests = ();
     @installcheck = ();
     @clean = ();
 
index e06cdaf..e6283ec 100644 (file)
@@ -105,6 +105,7 @@ distdir: $(DISTFILES)
 info:
 dvi:
 check: all
+       $(MAKE)
 installcheck:
 install-exec: 
        $(NORMAL_INSTALL)
@@ -151,8 +152,8 @@ maintainer-clean:  maintainer-clean-generic distclean
        @echo "it deletes files that may require special tools to rebuild."
 
 .PHONY: default uninstall-m4dataDATA install-m4dataDATA tags distdir \
-info dvi check installcheck install-exec install-data install uninstall \
-all installdirs mostlyclean-generic distclean-generic clean-generic \
+info dvi installcheck install-exec install-data install uninstall all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
index 5f35989..adbdfe9 100644 (file)
@@ -119,7 +119,8 @@ check-TESTS: $(TESTS)
        fi
 info:
 dvi:
-check: all check-TESTS
+check: all
+       $(MAKE) check-TESTS
 installcheck:
 install-exec: 
        $(NORMAL_INSTALL)
@@ -164,7 +165,7 @@ maintainer-clean:  maintainer-clean-generic distclean
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
-.PHONY: default tags distdir check-TESTS info dvi check installcheck \
+.PHONY: default tags distdir check-TESTS info dvi installcheck \
 install-exec install-data install uninstall all installdirs \
 mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean