]> sourceware.org Git - automake.git/commitdiff
Fixes test subobj6.test and PR automake/160:
authorTom Tromey <tromey@redhat.com>
Tue, 8 May 2001 17:58:02 +0000 (17:58 +0000)
committerTom Tromey <tromey@redhat.com>
Tue, 8 May 2001 17:58:02 +0000 (17:58 +0000)
* 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.

ChangeLog
automake.in
compile.am
lib/am/compile.am
tests/Makefile.am
tests/Makefile.in
tests/subobj6.test

index 08c1b67eb66c7d7364edec06134954c4867b2050..c7d115c71662ae4c397299a5ce56186b39a680a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2001-05-08  Tom Tromey  <tromey@redhat.com>
+
+       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  <larsa@sim.no>
 
        * automake.texi (Canonicalizing Automake macros): Document not
index cdf0fc3233fe9e3202bd457cd29c22a109a2e49e..e69e318408c29361701dff122451547fc618ad1c 100755 (executable)
@@ -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";
 
index 63b3d474dfd814c6f921d60d512e9d5b63404cb8..d179f846e9228d2123629df30882ff0678a6c00b 100644 (file)
@@ -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
index 63b3d474dfd814c6f921d60d512e9d5b63404cb8..d179f846e9228d2123629df30882ff0678a6c00b 100644 (file)
@@ -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
index d836663a00453260755dd63067388dc440687d75..47ab004dcf8a54818c77de4389376a6f256ab8a4 100644 (file)
@@ -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 \
index 91137d9b44c71eb9dcb4a979a673d91ab4dc6e91..d4b81f0316622f65efe51c2dcdf934f6194ea619 100644 (file)
@@ -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 = \
index c1b0f0c887b92b45ca91d9cd13f01ca4cc8e2626..1044d80b94770ca612bc65c27cc855a580f81d29 100755 (executable)
@@ -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 <stdio.h>
@@ -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
This page took 0.047451 seconds and 5 git commands to generate.