From: Tom Tromey Date: Tue, 8 May 2001 17:58:02 +0000 (+0000) Subject: Fixes test subobj6.test and PR automake/160: X-Git-Tag: Release-1-4-p1~11 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=e021c67f4803ab32f627ca0fd9eb18c74a8b8ebb;p=automake.git Fixes test subobj6.test and PR automake/160: * tests/Makefile.am (XFAIL_TESTS): Removed subobj6.test. * compile.am (mostlyclean-compile): Added MOSTLYRMS. (distclean-compile): Added DISTRMS. * tests/subobj6.test (wish_SOURCES): Updated to reflect `mostlyclean' use; added test for non-subdir case. * automake.in (compile_clean_files): New global. (MOSTLY_CLEAN, DIST_CLEAN): New constants. (initialize_per_input): Initialize compile_clean_files. (handle_single_transform_list): Set compile_clean_files entries. (handle_compile): Handle compilation cleanups. --- diff --git a/ChangeLog b/ChangeLog index 08c1b67e..c7d115c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-05-08 Tom Tromey + + Fixes test subobj6.test and PR automake/160: + * tests/Makefile.am (XFAIL_TESTS): Removed subobj6.test. + * compile.am (mostlyclean-compile): Added MOSTLYRMS. + (distclean-compile): Added DISTRMS. + * tests/subobj6.test (wish_SOURCES): Updated to reflect + `mostlyclean' use; added test for non-subdir case. + * automake.in (compile_clean_files): New global. + (MOSTLY_CLEAN, DIST_CLEAN): New constants. + (initialize_per_input): Initialize compile_clean_files. + (handle_single_transform_list): Set compile_clean_files entries. + (handle_compile): Handle compilation cleanups. + 2001-05-08 Lars J. Aas * automake.texi (Canonicalizing Automake macros): Document not diff --git a/automake.in b/automake.in index cdf0fc32..e69e3184 100755 --- a/automake.in +++ b/automake.in @@ -162,6 +162,12 @@ my $GNITS = 2; my $AC_CANONICAL_HOST = 1; my $AC_CANONICAL_SYSTEM = 2; +# Values indicating when something should be cleaned. Right now we +# only need to handle `mostly'- and `dist'-clean; add more as +# required. +my $MOSTLY_CLEAN = 0; +my $DIST_CLEAN = 1; + # Files installed by libtoolize. my @libtoolize_files = ('ltmain.sh', 'config.guess', 'config.sub'); # ltconfig appears here for compatibility with old versions of libtool. @@ -557,6 +563,12 @@ my %actions; # A list of files deleted by `maintainer-clean'. my @maintainer_clean_files; +# Keys in this hash table are object files or other files in +# subdirectories which need to be removed. This only holds files +# which are created by compilations. The value in the hash indicates +# when the file should be removed. +my %compile_clean_files; + # These are pretty obvious, too. They are used to define the # SOURCES and OBJECTS variables. my @sources; @@ -776,6 +788,8 @@ sub initialize_per_input () @var_list = (); $get_object_extension_was_run = 0; + + %compile_clean_files = (); } @@ -1975,6 +1989,9 @@ sub handle_single_transform_list ($$$@) &am_error ("`$full' contains `..' component but should not"); } + # Make sure object is removed by `make mostlyclean'. + $compile_clean_files{$object} = $MOSTLY_CLEAN; + push (@dep_list, $directory . '/.dirstamp'); # If we're generating dependencies, we also want @@ -1988,6 +2005,10 @@ sub handle_single_transform_list ($$$@) if (! defined $directory_map{$directory}) { $directory_map{$directory} = 1; + + # Directory must be removed by `make distclean'. + $compile_clean_files{$directory . "/.dirstamp"} = + $DIST_CLEAN; $output_rules .= ($directory . "/.dirstamp:\n" . "\t\@\$(mkinstalldirs) $directory\n" . "\t\@: > $directory/.dirstamp\n"); @@ -2303,9 +2324,28 @@ sub handle_compile () } } + my (@mostly_rms, @dist_rms); + foreach my $item (sort keys %compile_clean_files) + { + if ($compile_clean_files{$item} == $MOSTLY_CLEAN) + { + push (@mostly_rms, "\t-rm -f $item"); + } + elsif ($compile_clean_files{$item} == $DIST_CLEAN) + { + push (@dist_rms, "\t-rm -f $item"); + } + else + { + &prog_error ("invalid entry in \%compile_clean_files"); + } + } + my ($coms, $vars, $rules) = &file_contents_internal (1, "$am_dir/compile.am", - ('DEFAULT_INCLUDES' => $default_includes)); + ('DEFAULT_INCLUDES' => $default_includes, + 'MOSTLYRMS' => join ("\n", @mostly_rms), + 'DISTRMS' => join ("\n", @dist_rms))); $output_vars .= $vars; $output_rules .= "$coms$rules"; diff --git a/compile.am b/compile.am index 63b3d474..d179f846 100644 --- a/compile.am +++ b/compile.am @@ -28,9 +28,11 @@ mostlyclean-compile: ## Don't remove 'core.*' because some distributions have eg "core.c". ## 4.4BSD systems use `PROG.core'. -rm -f *.$(OBJEXT) core *.core +?MOSTLYRMS?%MOSTLYRMS% distclean-am: distclean-compile distclean-compile: -rm -f *.tab.c +?DISTRMS?%DISTRMS% .PHONY: mostlyclean-compile distclean-compile diff --git a/lib/am/compile.am b/lib/am/compile.am index 63b3d474..d179f846 100644 --- a/lib/am/compile.am +++ b/lib/am/compile.am @@ -28,9 +28,11 @@ mostlyclean-compile: ## Don't remove 'core.*' because some distributions have eg "core.c". ## 4.4BSD systems use `PROG.core'. -rm -f *.$(OBJEXT) core *.core +?MOSTLYRMS?%MOSTLYRMS% distclean-am: distclean-compile distclean-compile: -rm -f *.tab.c +?DISTRMS?%DISTRMS% .PHONY: mostlyclean-compile distclean-compile diff --git a/tests/Makefile.am b/tests/Makefile.am index d836663a..47ab004d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = gnits XFAIL_TESTS = objc.test subobj2.test yaccvpath.test texinfo10.test \ -subobj6.test subdir5.test +subdir5.test TESTS = \ acinclude.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 91137d9b..d4b81f03 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -75,7 +75,7 @@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = gnits XFAIL_TESTS = objc.test subobj2.test yaccvpath.test texinfo10.test \ -subobj6.test subdir5.test +subdir5.test TESTS = \ diff --git a/tests/subobj6.test b/tests/subobj6.test index c1b0f0c8..1044d80b 100755 --- a/tests/subobj6.test +++ b/tests/subobj6.test @@ -1,12 +1,12 @@ #! /bin/sh -# Test of subdir make dist rules. +# Test of subdir make distclean rules. # From Robert Collins . $srcdir/defs || exit 1 cat > configure.in << 'END' -AC_INIT(generic/a.c) +AC_INIT(f) AM_INIT_AUTOMAKE(nonesuch, nonesuch) AM_PROG_CC_C_O AC_PROG_CC @@ -19,6 +19,9 @@ bin_PROGRAMS = wish wish_SOURCES = generic/a.c END +# The ac-init file. +: > f + mkdir generic cat > generic/a.c << 'END' #include @@ -42,9 +45,31 @@ cd build ../configure $MAKE -$MAKE distclean +$MAKE mostlyclean test -f generic/a.o && exit 1 + +$MAKE distclean test -f generic/.dirstamp && exit 1 -exit 0 +cd .. + +# Now test without the subdir. +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +bin_PROGRAMS = wish +wish_SOURCES = a.c +END + +mv generic/a.c a.c + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --include-deps --copy --add-missing + +mkdir build2 +cd build2 + +../configure +$MAKE +$MAKE mostlyclean