-2001-11-01 Alexandre Duret-Lutz <duret_g@epita.fr>
+2001-11-05 Alexandre Duret-Lutz <duret_g@epita.fr>
+
+ * 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 <misiek@pld.ORG.PL>.
+
+2001-11-05 Alexandre Duret-Lutz <duret_g@epita.fr>
* automake.in (handle_single_transform_list): Don't call
$lang->target_hook for undefinied langages.
# 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.
# 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}}))
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
# $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.
#
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.
pop @substfroms;
pop @substtos;
}
- else
+ else # $var is a filename
{
my $substnum=$#substfroms;
while ($substnum >= 0)
$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};
--- /dev/null
+#! /bin/sh
+
+# Test to make sure Automake include libtool objects resulting
+# from user-defined implicit rules.
+# Based on a report from Arkadiusz Miskiewicz <misiek@pld.ORG.PL>.
+
+. $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