From: Tom Tromey Date: Sat, 30 Mar 2002 00:26:06 +0000 (+0000) Subject: For PR automake/312: X-Git-Tag: branchpoint-1-6~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca3ac71a453a99d76665e072962c8f60a2b50ce8;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 1d66ce7ea..f954edef7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-03-29 Tom Tromey + + 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 * tests/extra6.test, tests/subdir5.test: Require GNU make. diff --git a/automake.in b/automake.in index 604941d5f..fce34face 100755 --- a/automake.in +++ b/automake.in @@ -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. diff --git a/lib/am/libtool.am b/lib/am/libtool.am index deff4b567..3a9093731 100644 --- a/lib/am/libtool.am +++ b/lib/am/libtool.am @@ -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: diff --git a/stamp-vti b/stamp-vti index fd2b2a315..5ec0e844d 100644 --- 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 diff --git a/tests/Makefile.am b/tests/Makefile.am index fbbd652d8..b090ba846 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -315,6 +315,7 @@ subobj5.test \ subobj6.test \ subobj7.test \ subobj8.test \ +subobj9.test \ subst.test \ substref.test \ substtarg.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 44000741a..2c4811164 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..3a5ebde90 --- /dev/null +++ b/tests/subobj9.test @@ -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 diff --git a/version.texi b/version.texi index fd2b2a315..5ec0e844d 100644 --- a/version.texi +++ b/version.texi @@ -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