From 714dfe8c30d3d87f7edb118251bb9868a4132fe1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 12 Feb 2001 16:49:52 +0000 Subject: [PATCH] 2001-02-12 Tom Tromey Fix for subdirbuiltsources.test: * automake.in (initialize_per_input): [all_target] Initialize to empty string. (handle_merge_targets): Use all-redirect target to handle built sources. (do_one_merge_target): Don't generate all-redirect rule. 2001-02-11 Peter Muir * tests/subdirbuiltsources.test: New file. * tests/Makefile.am (TESTS): Added new file. --- ChangeLog | 14 ++++++++ THANKS | 1 + automake.in | 53 +++++++++++++++++------------- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/subdirbuiltsources.test | 62 +++++++++++++++++++++++++++++++++++ 6 files changed, 109 insertions(+), 23 deletions(-) create mode 100755 tests/subdirbuiltsources.test diff --git a/ChangeLog b/ChangeLog index d7047425..26dadd18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-02-12 Tom Tromey + + Fix for subdirbuiltsources.test: + * automake.in (initialize_per_input): [all_target] Initialize to + empty string. + (handle_merge_targets): Use all-redirect target to handle built + sources. + (do_one_merge_target): Don't generate all-redirect rule. + +2001-02-11 Peter Muir + + * tests/subdirbuiltsources.test: New file. + * tests/Makefile.am (TESTS): Added new file. + 2001-02-10 Tom Tromey * tests/condlib.test: New file. diff --git a/THANKS b/THANKS index 463a8aae..0c06acf8 100644 --- a/THANKS +++ b/THANKS @@ -109,6 +109,7 @@ Pavel Roskin pavel_roskin@geocities.com Per Bothner bothner@cygnus.com Per Cederqvist ceder@lysator.liu.se Peter Mattis petm@scam.XCF.Berkeley.EDU +Peter Muir iyhi@yahoo.com Petter Reinholdtsen pere@hungry.com Phil Nelson phil@cs.wwu.edu Raja R Harinath harinath@cs.umn.edu diff --git a/automake.in b/automake.in index 94bca1b3..8c13a5d0 100755 --- a/automake.in +++ b/automake.in @@ -3679,19 +3679,20 @@ sub handle_merge_targets } if ($local_headers) { - # This is kind of a hack, but I couldn't see a better way - # to handle it. In this particular case, we need to make - # sure config.h is built before we recurse. 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-recursive-am: ${local_headers}" - . "\n\t" - . '$(MAKE) $(AM_MAKEFLAGS)' - . " all-recursive" - . "\n\n"); - $all_target = 'all-recursive-am'; - &depend ('.PHONY', 'all-recursive-am'); + # 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-redirect: ${local_headers}" + . "\n\t" + . '$(MAKE) $(AM_MAKEFLAGS) ' + . ($recursive_install + ? 'all-recursive' : 'all-am') + . "\n\n"); + $all_target = 'all-redirect'; + &depend ('.PHONY', 'all-redirect'); } } @@ -3755,18 +3756,24 @@ sub do_one_merge_target . "\n"); } - local ($lname) = $name . ($recursive_install ? '-recursive' : '-am'); - local ($tname) = $name; # To understand this special case, see handle_merge_targets. if ($name eq 'all') { - $tname = 'all-redirect'; - $lname = $all_target if $recursive_install; - &depend ('.PHONY', 'all-redirect'); - $output_all = "all: all-redirect\n"; + # If we aren't using a redirect target then find the + # appropriate actual redirect. + if ($all_target eq '') + { + $all_target = $recursive_install ? 'all-recursive' : 'all-am'; + } + + $output_all = "all: $all_target\n"; + } + else + { + local ($lname) = $name . ($recursive_install ? '-recursive' : '-am'); + &pretty_print_rule ($name . ":", "\t\t", $lname); + &depend ('.PHONY', $name . '-am', $name); } - &pretty_print_rule ($tname . ":", "\t\t", $lname); - &depend ('.PHONY', $name . '-am', $name); } # Handle check merge target specially. @@ -6815,8 +6822,8 @@ sub initialize_per_input # position of a suffix rule. $source_suffix_pattern = ''; - # This is the name of the recursive `all' target to use. - $all_target = 'all-recursive'; + # This is the name of the redirect `all' target to use. + $all_target = ''; # This keeps track of which extensions we've seen (that we care # about). diff --git a/tests/Makefile.am b/tests/Makefile.am index 37027165..1c46b23d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -234,6 +234,7 @@ subdir.test \ subdir2.test \ subdir3.test \ subdir4.test \ +subdirbuiltsources.test \ subobj.test \ subobj2.test \ subobj3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index b8783a5e..7bb2cb49 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -304,6 +304,7 @@ subdir.test \ subdir2.test \ subdir3.test \ subdir4.test \ +subdirbuiltsources.test \ subobj.test \ subobj2.test \ subobj3.test \ diff --git a/tests/subdirbuiltsources.test b/tests/subdirbuiltsources.test new file mode 100755 index 00000000..264d5b27 --- /dev/null +++ b/tests/subdirbuiltsources.test @@ -0,0 +1,62 @@ +#! /bin/sh + +set -e +# Make sure when using SUBDIR that all BUILT_SOURCES are built. +# A bug occurred where subdirs do not have all-recursive or +# all-recursive-am which depended on BUILT_SOURCES. + +. $srcdir/defs || exit 1 + +mkdir lib + +cat > configure.in << 'END' +AC_INIT +AM_INIT_AUTOMAKE(nonesuch, nonesuch) +AC_ARG_PROGRAM +AC_PROG_MAKE_SET +AC_PROG_INSTALL +AC_PROG_RANLIB +AC_PROG_CC +AC_OUTPUT(Makefile lib/Makefile) +END + +# Files required because we are using `--gnu'. +: > INSTALL +: > NEWS +: > README +: > COPYING +: > AUTHORS +: > ChangeLog + +cat > Makefile.am << 'END' +SUBDIRS = lib +END + +cat > lib/Makefile.am << 'END' +pkgdata_DATA = +noinst_LIBRARIES = libfoo.a +libfoo_a_SOURCES = foo.c +BUILT_SOURCES=foo.h +foo.h: + echo \#define FOO_DEFINE 1 >$@ +END + +cat > lib/foo.c << 'END' +#include +int foo () { return !FOO_DEFINE;} +END + + +$ACLOCAL + +$AUTOCONF + +$AUTOMAKE --include-deps --copy --force-missing --add-missing --gnu + +./configure + +# Remove the comment to get a successful test. +# $MAKE -C lib foo.h +$MAKE + +exit 0 -- 2.43.5