+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.
# 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.
$get_object_extension_was_run = 0;
%compile_clean_files = ();
+
+ # We always include `.'. This isn't strictly correct.
+ %libtool_clean_directories = ('.' => 1);
}
}
}
- &handle_libtool;
-
# At the toplevel directory, we might need config.guess, config.sub
# or libtool scripts (ltconfig and ltmain.sh).
if ($relative_dir eq '.')
# 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');
# 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));
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 ()
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.