automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch: FYI: PR 312


From: Tom Tromey
Subject: Patch: FYI: PR 312
Date: 29 Mar 2002 17:26:24 -0700

I'm checking this in.  This fixes PR 312.  It also adds a test case.
This patch is a little ugly.  Perhaps we need to unify clean handling
in some nicer way.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        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.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1285
diff -u -r1.1285 automake.in
--- automake.in 2002/03/20 22:27:09 1.1285
+++ automake.in 2002/03/30 00:25:16
@@ -557,6 +557,11 @@
 # 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 @@
     $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 @@
        }
     }
 
-    &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 @@
     # 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 @@
 
                # 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 @@
     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 @@
        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: stamp-vti
===================================================================
RCS file: /cvs/automake/automake/stamp-vti,v
retrieving revision 1.170
diff -u -r1.170 stamp-vti
--- stamp-vti 2002/03/18 01:37:52 1.170
+++ stamp-vti 2002/03/30 00:25:16
@@ -1,4 +1,4 @@
address@hidden UPDATED 17 March 2002
address@hidden UPDATED 18 March 2002
 @set UPDATED-MONTH March 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
Index: version.texi
===================================================================
RCS file: /cvs/automake/automake/version.texi,v
retrieving revision 1.243
diff -u -r1.243 version.texi
--- version.texi 2002/03/18 01:37:52 1.243
+++ version.texi 2002/03/30 00:25:16
@@ -1,4 +1,4 @@
address@hidden UPDATED 17 March 2002
address@hidden UPDATED 18 March 2002
 @set UPDATED-MONTH March 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
Index: lib/am/libtool.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/libtool.am,v
retrieving revision 1.13
diff -u -r1.13 libtool.am
--- lib/am/libtool.am 2001/07/03 04:19:36 1.13
+++ lib/am/libtool.am 2002/03/30 00:25:16
@@ -24,8 +24,7 @@
 
 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: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.382
diff -u -r1.382 Makefile.am
--- tests/Makefile.am 2002/03/26 10:48:37 1.382
+++ tests/Makefile.am 2002/03/30 00:25:16
@@ -315,6 +315,7 @@
 subobj6.test \
 subobj7.test \
 subobj8.test \
+subobj9.test \
 subst.test \
 substref.test \
 substtarg.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.496
diff -u -r1.496 Makefile.in
--- tests/Makefile.in 2002/03/26 10:48:37 1.496
+++ tests/Makefile.in 2002/03/30 00:25:16
@@ -391,6 +391,7 @@
 subobj6.test \
 subobj7.test \
 subobj8.test \
+subobj9.test \
 subst.test \
 substref.test \
 substtarg.test \
Index: tests/subobj9.test
===================================================================
RCS file: subobj9.test
diff -N subobj9.test
--- /dev/null   Tue May  5 13:32:27 1998
+++ tests/subobj9.test Fri Mar 29 16:25:17 2002
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]