From: Alexandre Duret-Lutz Date: Mon, 5 Nov 2001 17:32:08 +0000 (+0000) Subject: * automake.in (handle_single_transform_list): Pass $nonansi_obj to X-Git-Tag: Release-1-5b~44 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=997ab1879b35d509a4b3dfede5fdea0bee1b7d8b;p=automake.git * automake.in (handle_single_transform_list): Pass $nonansi_obj to derive_suffix. Don't use an hardcoded 'o' for object extensions. (derive_suffix): Accept $OBJ as a second argument, don't hardcode 'o'. * tests/suffix5.test: New test. * tests/Makefile.am (TESTS): Add suffix5.test. Reported by Arkadiusz Miskiewicz . --- diff --git a/ChangeLog b/ChangeLog index 5afc7966..c6cbab5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,14 @@ -2001-11-01 Alexandre Duret-Lutz +2001-11-05 Alexandre Duret-Lutz + + * automake.in (handle_single_transform_list): Pass $nonansi_obj to + derive_suffix. Don't use an hardcoded 'o' for object extensions. + (derive_suffix): Accept $OBJ as a second argument, don't + hardcode 'o'. + * tests/suffix5.test: New test. + * tests/Makefile.am (TESTS): Add suffix5.test. + Reported by Arkadiusz Miskiewicz . + +2001-11-05 Alexandre Duret-Lutz * automake.in (handle_single_transform_list): Don't call $lang->target_hook for undefinied langages. diff --git a/THANKS b/THANKS index 3198aeec..90274228 100644 --- a/THANKS +++ b/THANKS @@ -14,6 +14,7 @@ Andreas Schwab schwab@lamothe.informatik.uni-dortmund.de Andrew Cagney cagney@tpgi.com.au Andris Pavenis pavenis@lanet.lv Anthony Green green@cygnus.com +Arkadiusz Miskiewicz misiek@pld.ORG.PL Assar Westerlund assar@sics.se Axel Belinfante Axel.Belinfante@cs.utwente.nl Bernard Urban Bernard.Urban@meteo.fr diff --git a/automake.in b/automake.in index b436e639..d248e8c9 100755 --- a/automake.in +++ b/automake.in @@ -590,6 +590,9 @@ my %de_ansi_files; # This maps the source extension of a suffix rule to its # corresponding output extension. +# FIXME: because this hash maps one input extension to one output +# extension, Automake cannot handle two suffix rules with the same +# input extension. my %suffix_rules; # This is the name of the redirect `all' target to use. @@ -1744,7 +1747,7 @@ sub handle_single_transform_list ($$$$@) # language function. my $aggregate = 'AM'; - $extension = &derive_suffix ($extension); + $extension = &derive_suffix ($extension, $nonansi_obj); my $lang; if ($extension_map{$extension} && ($lang = $languages{$extension_map{$extension}})) @@ -1865,12 +1868,11 @@ sub handle_single_transform_list ($$$$@) push (@{$lang_specific_files{$lang->name}}, $val); } } - elsif ($extension eq 'o') + elsif (".$extension" eq $nonansi_obj) { # This is probably the result of a direct suffix rule. - # In this case we just accept the rewrite. FIXME: - # this fails if we want libtool objects. - $object = $base . '.' . $extension; + # In this case we just accept the rewrite. + $object = "$base.$extension"; $linker = ''; } else @@ -1984,7 +1986,7 @@ sub handle_single_transform_list ($$$$@) # $NODEFINE is a boolean: if true, $OBJVAR will not be defined (but # work done to determine the linker will be). # $ONE_FILE is the canonical (transformed) name of object to build -# $OBJ is the object extension (ie either `.o' or `$o'. +# $OBJ is the object extension (ie either `.o' or `.lo'). # $PARENT is the variable in which $VAR is used, or $VAR if not applicable. # $TOPPARENT is the _SOURCES variable being processed. # @@ -2014,9 +2016,10 @@ sub define_objects_from_sources ($$$$$$$) my @result; foreach my $val (&variable_value_as_list ($var, $cond, $parent)) { + # If $val is a variable (i.e. ${foo} or $(bar), not a filename), + # handle the sub variable recursively. if ($val =~ /^\$\{([^}]*)\}$/ || $val =~ /^\$\(([^)]*)\)$/) { - # Handle a sub variable my $subvar = $1; # If the user uses a losing variable name, just ignore it. @@ -2046,7 +2049,7 @@ sub define_objects_from_sources ($$$$$$$) pop @substfroms; pop @substtos; } - else + else # $var is a filename { my $substnum=$#substfroms; while ($substnum >= 0) @@ -5333,16 +5336,16 @@ sub register_language (%) $languages{$lang->name} = $lang; } -# This function is used to find a path from a user-specified suffix to -# `o' or to some other suffix we recognize internally, eg `cc'. -sub derive_suffix +# derive_suffix ($EXT, $OBJ) +# ========================== +# This function is used to find a path from a user-specified suffix $EXT +# to $OBJ or to some other suffix we recognize internally, eg `cc'. +sub derive_suffix ($$) { - my ($source_ext) = @_; + my ($source_ext, $obj) = @_; - # FIXME: hard-coding `o' is a mistake. Doing something - # intelligent is harder. while (! $extension_map{$source_ext} - && $source_ext ne 'o' + && ".$source_ext" ne $obj && defined $suffix_rules{$source_ext}) { $source_ext = $suffix_rules{$source_ext}; diff --git a/tests/Makefile.am b/tests/Makefile.am index c195075f..62ef0973 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -289,6 +289,7 @@ suffix.test \ suffix2.test \ suffix3.test \ suffix4.test \ +suffix5.test \ symlink.test \ symlink2.test \ symlink3.test \ diff --git a/tests/suffix5.test b/tests/suffix5.test new file mode 100755 index 00000000..5196c38f --- /dev/null +++ b/tests/suffix5.test @@ -0,0 +1,28 @@ +#! /bin/sh + +# Test to make sure Automake include libtool objects resulting +# from user-defined implicit rules. +# Based on a report from Arkadiusz Miskiewicz . + +. $srcdir/defs || exit 1 + +cat >> configure.in << 'END' +AC_PROG_LIBTOOL +END + +cat > Makefile.am << 'END' +.k.lo: + echo $< > $@ + +noinst_LTLIBRARIES = libfoo.la +libfoo_la_SOURCES = foo.k +END + +: > ltmain.sh +: > config.guess +: > config.sub + +$ACLOCAL || exit 1 +$AUTOMAKE --Wno-error || exit 1 +grep '_OBJECTS.*foo.lo' Makefile.in || exit 1 +exit 0