]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
For PR automake/312:
authorTom Tromey <tromey@redhat.com>
Sat, 30 Mar 2002 00:26:06 +0000 (00:26 +0000)
committerTom Tromey <tromey@redhat.com>
Sat, 30 Mar 2002 00:26:06 +0000 (00:26 +0000)
* lib/am/libtool.am (clean-libtool): Use LTRMS.
* automake.in (handle_single_transform_list): When processing a
libtool object, clean the ordinary object and register the
directory.
(libtool_clean_directories): New global.
(initialize_per_input): Initialize it.
(generate_makefile): Call handle_libtool later.
(handle_libtool): Handle libtool_clean_directories.
* tests/subobj9.test: New file.
* tests/Makefile.am (TESTS): Added subobj9.test.

ChangeLog
automake.in
lib/am/libtool.am
stamp-vti
tests/Makefile.am
tests/Makefile.in
tests/subobj9.test [new file with mode: 0755]
version.texi

index 1d66ce7eadda6ee27752e9c68644d29278e3f7e9..f954edef72c4a0dea2c57353e1db63f7807898a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2002-03-29  Tom Tromey  <tromey@redhat.com>
+
+       For PR automake/312:
+       * lib/am/libtool.am (clean-libtool): Use LTRMS.
+       * automake.in (handle_single_transform_list): When processing a
+       libtool object, clean the ordinary object and register the
+       directory.
+       (libtool_clean_directories): New global.
+       (initialize_per_input): Initialize it.
+       (generate_makefile): Call handle_libtool later.
+       (handle_libtool): Handle libtool_clean_directories.
+       * tests/subobj9.test: New file.
+       * tests/Makefile.am (TESTS): Added subobj9.test.
+
 2002-03-26  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        * tests/extra6.test, tests/subdir5.test: Require GNU make.
index 604941d5fd8b6807fe93468e88647f817e00c846..fce34face18f26f86db95340a748b9a8d1cf8c6e 100755 (executable)
@@ -557,6 +557,11 @@ my @maintainer_clean_files;
 # when the file should be removed.
 my %compile_clean_files;
 
+# Keys in this hash table are directories where we expect to build a
+# libtool object.  We use this information to decide what directories
+# to delete.
+my %libtool_clean_directories;
+
 # Value of `$(SOURCES)', used by tags.am.
 my @sources;
 # Sources which go in the distribution.
@@ -785,6 +790,9 @@ sub initialize_per_input ()
     $get_object_extension_was_run = 0;
 
     %compile_clean_files = ();
+
+    # We always include `.'.  This isn't strictly correct.
+    %libtool_clean_directories = ('.' => 1);
 }
 
 
@@ -1245,8 +1253,6 @@ sub generate_makefile
        }
     }
 
-    &handle_libtool;
-
     # At the toplevel directory, we might need config.guess, config.sub
     # or libtool scripts (ltconfig and ltmain.sh).
     if ($relative_dir eq '.')
@@ -1294,6 +1300,9 @@ sub generate_makefile
     # This must be run after all the sources are scanned.
     &handle_languages;
 
+    # We have to run this after dealing with all the programs.
+    &handle_libtool;
+
     # Re-init SOURCES.  FIXME: other code shouldn't depend on this
     # (but currently does).
     macro_define ('SOURCES', 1, '', 'TRUE', "@sources", 'internal');
@@ -2137,6 +2146,15 @@ sub handle_single_transform_list ($$$$@)
 
                # Make sure object is removed by `make mostlyclean'.
                $compile_clean_files{$object} = MOSTLY_CLEAN;
+               # If we have a libtool object then we also must remove
+               # the ordinary .o.
+               if ($object =~ /\.lo$/)
+               {
+                   (my $xobj = $object) =~ s,lo$,\$(OBJEXT),;
+                   $compile_clean_files{$xobj} = MOSTLY_CLEAN;
+
+                   $libtool_clean_directories{$directory} = 1;
+               }
 
                 push (@dep_list, require_build_directory ($directory));
 
@@ -2672,8 +2690,17 @@ sub handle_libtool
     require_conf_file ($seen_libtool, FOREIGN, @libtool_files)
        if $relative_dir eq '.';
 
+    my @libtool_rms;
+    foreach my $item (sort keys %libtool_clean_directories)
+    {
+       my $dir = ($item eq '.') ? '' : "$item/";
+       # .libs is for Unix, _libs for DOS.
+       push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs");
+    }
+
     # Output the libtool compilation rules.
-    $output_rules .= &file_contents ('libtool');
+    $output_rules .= &file_contents ('libtool',
+                                    ('LTRMS' => join ("\n", @libtool_rms)));
 }
 
 # handle_programs ()
@@ -3051,8 +3078,8 @@ sub check_typos ()
        foreach my $primary ('_SOURCES', '_LIBADD', '_LDADD', '_LDFLAGS',
                             '_DEPENDENCIES')
        {
-         macro_error ($varname,
-                      "invalid unused variable name: `$varname'")
+           macro_error ($varname,
+                        "invalid unused variable name: `$varname'")
            # Note that a configure variable is always legitimate.
            # It is natural to name such variables after the
            # primary, so we explicitly allow it.
index deff4b56761138d00cd1314110bdf42cc10c1db3..3a90937316cae22993f976079fa6f4eda65e787e 100644 (file)
@@ -24,8 +24,7 @@ mostlyclean-libtool:
 
 clean-am: clean-libtool
 clean-libtool:
-## .libs is for Unix, _libs for DOS.
-       -rm -rf .libs _libs
+?LTRMS?%LTRMS%
 
 ?TOPDIR?distclean-am: distclean-libtool
 ?TOPDIR?distclean-libtool:
index fd2b2a315aea2b02212be52a93b2dce1a1b9e550..5ec0e844dab79e882849e6b1263f24532b49d88a 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 17 March 2002
+@set UPDATED 18 March 2002
 @set UPDATED-MONTH March 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
index fbbd652d8748bbb03fde2b1d074cce31cfd067ce..b090ba846ac248cc4582b0ffb0cdb16ddb2c6709 100644 (file)
@@ -315,6 +315,7 @@ subobj5.test \
 subobj6.test \
 subobj7.test \
 subobj8.test \
+subobj9.test \
 subst.test \
 substref.test \
 substtarg.test \
index 44000741a2d79891f9ca71f348f5d371b6adecf5..2c4811164228ec99a6173f2e14624d98a48b754b 100644 (file)
@@ -391,6 +391,7 @@ subobj5.test \
 subobj6.test \
 subobj7.test \
 subobj8.test \
+subobj9.test \
 subst.test \
 substref.test \
 substtarg.test \
diff --git a/tests/subobj9.test b/tests/subobj9.test
new file mode 100755 (executable)
index 0000000..3a5ebde
--- /dev/null
@@ -0,0 +1,43 @@
+#! /bin/sh
+
+# Test for PR 312.
+
+required='libtoolize gcc'
+. $srcdir/defs || exit 1
+
+cat > configure.ac << 'END'
+AC_INIT(x, 0, x)
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+
+AC_PROG_CXX
+AM_PROG_LIBTOOL
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+rm -f configure.in
+
+cat > Makefile.am << 'END'
+noinst_LTLIBRARIES = libfoo.la
+libfoo_la_SOURCES = src/foo.cc
+END
+
+mkdir src
+cat > src/foo.cc << 'END'
+int doit (void)
+{
+   return 23;
+}
+END
+
+set -e
+
+libtoolize --force
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure CXX=gcc
+$MAKE
+$MAKE distcheck
index fd2b2a315aea2b02212be52a93b2dce1a1b9e550..5ec0e844dab79e882849e6b1263f24532b49d88a 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 17 March 2002
+@set UPDATED 18 March 2002
 @set UPDATED-MONTH March 2002
 @set EDITION 1.6a
 @set VERSION 1.6a