automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: suffixes


From: Alexandre Duret-Lutz
Subject: Re: suffixes
Date: Fri, 2 Nov 2001 21:57:58 +0100

On Sat, Oct 20, 2001 at 11:31:46AM +0200, Arkadiusz Miskiewicz wrote:
[...]
> automake (GNU automake) 1.5
[...]
> .asm.lo:
>         $(LIBTOOL) --mode=compile $(STRIP_FPIC) $(NASM) @NASMFLAGS@ $<
[...]
> libhermes_la_SOURCES =          \
>         mmx_main.asm            \
[...]
> As you can see asm files are not processed! I've searched autoconf
> info file for information about SUFFIXES changes and such thing and I
> found nothing so this should work.
> 
> Any hints? (btw. it was working fine with older automake)

It looks like Automake was hardcoding '.o' where sometime you want '.lo'.

--- ChangeLog
+++ ChangeLog
@@ -1,1 +1,11 @@
+2001-11-02  Alexandre Duret-Lutz  <address@hidden>
+
+       * 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 <address@hidden>.
+

--- /tmp/tmp.30190.1    Fri Nov  2 21:43:26 2001
+++ THANKS      Fri Nov  2 21:25:00 2001
@@ -14,6 +14,7 @@
 Andrew Cagney          address@hidden
 Andris Pavenis         address@hidden
 Anthony Green          address@hidden
+Arkadiusz Miskiewicz   address@hidden
 Assar Westerlund       address@hidden
 Axel Belinfante                address@hidden
 Bernard Urban          address@hidden
--- /tmp/tmp.30190.2    Fri Nov  2 21:43:26 2001
+++ automake.in Fri Nov  2 21:13:41 2001
@@ -590,6 +590,9 @@
 
 # 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 @@
        # 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 @@
                 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 @@
 #   $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 @@
        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 @@
                pop @substfroms;
                pop @substtos;
            }
-           else
+           else # $var is a filename
            {
                my $substnum=$#substfroms;
                while ($substnum >= 0)
@@ -5339,16 +5342,16 @@
     $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};
--- /tmp/tmp.30190.3    Fri Nov  2 21:43:27 2001
+++ tests/Makefile.am   Fri Nov  2 21:17:18 2001
@@ -289,6 +289,7 @@
 suffix2.test \
 suffix3.test \
 suffix4.test \
+suffix5.test \
 symlink.test \
 symlink2.test \
 symlink3.test \
--- /dev/null   Sat Jun 16 10:38:42 2001
+++ tests/suffix5.test  Fri Nov  2 21:14:34 2001
@@ -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 <address@hidden>.
+
+. $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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]