1999-12-13 Tom Tromey <tromey@cygnus.com>
+ Fix for PR automake/30 and PR automake/23. Fixes test
+ suffix3.test.
+ * automake.in (initialize_per_input): Initialize
+ source_suffix_pattern.
+ (derive_suffix): New function.
+ (handle_single_transform_list): Call it.
+
* automake.in (add_depend2): Handle the no-dependency-tracking
case. Fixes test suffix2.test.
local ($rule) = '';
local ($renamed) = 0;
+ $extension = &derive_suffix ($extension);
local ($lang) = $extension_map{$extension};
if ($lang)
{
. ' ' . $obj_sans_ext);
}
}
- elsif ($extension =~ /^$source_suffix_pattern$/)
+ elsif ($extension eq 'o')
{
- # We just rewrite it. Maybe we should do more.
- # FIXME: what about subdir handling here?
- $object = $base . '.' . $suffix_rules{$extension};
+ # 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;
$linker = '';
}
else
}
}
+# 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
+{
+ local ($source_ext) = @_;
+
+ # FIXME: hard-coding `o' is a mistake. Doing something
+ # intelligent is harder.
+ while ($extension_map{$source_ext} eq ''
+ && $source_ext ne 'o'
+ && defined $suffix_rules{$source_ext})
+ {
+ $source_ext = $suffix_rules{$source_ext};
+ }
+
+ return $source_ext;
+}
+
################################################################
{
$suffix_rules{$source_suffix} = $object_suffix;
print "Sources ending in .$source_suffix become .$object_suffix\n" if $verbose;
- $source_suffix_pattern = "(" . join('|', keys %suffix_rules) . ")";
+ $source_suffix_pattern = "(" . join ('|', keys %suffix_rules) . ")";
}
# FIXME: make sure both suffixes are in SUFFIXES? Or set
# corresponding output extension.
%suffix_rules = ();
+ # This is a regular expression which matches all the known source
+ # suffix. A source suffix is one that appears in the first
+ # position of a suffix rule.
+ $source_suffix_pattern = '';
+
# This is the name of the recursive `all' target to use.
$all_target = 'all-recursive';