automake-patches
[Top][All Lists]
Advanced

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

5-kludge.o.patch


From: Alexandre Duret-Lutz
Subject: 5-kludge.o.patch
Date: Wed, 14 Nov 2001 19:54:54 +0100

Index: ChangeLog
--- ChangeLog
+++ ChangeLog
@@ -1,1 +1,9 @@
+2001-11-14  Alexandre Duret-Lutz  <address@hidden>
+
+       * automake.in (SUFFIX_RULE_PATTERN): Add '_(){}$@' to the
+       set of accepted characters in extensions.
+       (rule_define): Convert '.o' and '.obj' into '$(OBJEXT)' for
+       internall use.
+       * tests/suffix6.test: Ensure that `.o' is handled like `.$(OBJEXT)'.
+

Index: automake.in
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011109-2037/automake.in,v
retrieving revision 1.4
diff -u -r1.4 automake.in
--- automake.in 13 Nov 2001 20:29:49 -0000      1.4
+++ automake.in 14 Nov 2001 18:22:58 -0000
@@ -137,7 +137,7 @@
 my $RULE_PATTERN =
   "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$";
 
-my $SUFFIX_RULE_PATTERN = '^(\.[a-zA-Z0-9+]+)(\.[a-zA-Z0-9+]+)$';
+my $SUFFIX_RULE_PATTERN = 
'^(\.[a-zA-Z0-9_()address@hidden)(\.[a-zA-Z0-9_()address@hidden)$';
 # Only recognize leading spaces, not leading tabs.  If we recognize
 # leading tabs here then we need to make the reader smarter, because
 # otherwise it will think rules like `foo=bar; \' are errors.
@@ -6616,26 +6616,32 @@
       $target_conditional{$target}{$cond} = $where;
   }
 
-
   # Check the rule for being a suffix rule. If so, store in a hash.
   # Either it's a rule for two known extensions...
-  if ($target =~ /^($KNOWN_EXTENSIONS_PATTERN)($KNOWN_EXTENSIONS_PATTERN)$/)
-  {
-      $suffix_rules{$1} = $2;
-      verbose "Sources ending in $1 become $2";
-      push @suffixes, $1, $2;
-  }
+  if ($target =~ /^($KNOWN_EXTENSIONS_PATTERN)($KNOWN_EXTENSIONS_PATTERN)$/
   # ...or it's a rule with unknown extensions (.i.e, the rule looks like
   # `.foo.bar:' but `.foo' or `.bar' are not declared in SUFFIXES
   # and are not known language extensions).
   # Automake will complete SUFFIXES from @suffixes automatically
   # (see handle_footer).
-  elsif ($target =~ /$SUFFIX_RULE_PATTERN/o)
+      || ($target =~ /$SUFFIX_RULE_PATTERN/o && accept_extensions($1)))
   {
-      $suffix_rules{$1} = $2;
+      my $internal_ext = $2;
+
+      # When tranforming sources to objects, Automake uses the
+      # %suffix_rules to move from each source extension to
+      # `.$(OBJEXT)', not to `.o' or `.obj'.  However some people
+      # define suffix rules for `.o' or `.obj', so internally we will
+      # consider these extensions equivalent to `.$(OBJEXT)'.  We
+      # CANNOT rewrite the target (i.e., automagically replace `.o'
+      # and `.obj' by `.$(OBJEXT)' in the output), or warn the user
+      # that (s)he'd better use `.$(OBJEXT)', because Automake itself
+      # output suffix rules for `.o' or `.obj'...
+      $internal_ext = '.$(OBJEXT)' if ($2 eq '.o' || $2 eq '.obj');
+
+      $suffix_rules{$1} = $internal_ext;
       verbose "Sources ending in $1 become $2";
       push @suffixes, $1, $2;
-      accept_extensions($1);
   }
 
   return 1;
Index: tests/suffix6.test
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011109-2037/tests/suffix6.test,v
retrieving revision 1.1
diff -u -r1.1 suffix6.test
--- tests/suffix6.test  13 Nov 2001 20:29:49 -0000      1.1
+++ tests/suffix6.test  14 Nov 2001 18:45:59 -0000
@@ -1,18 +1,20 @@
 #! /bin/sh
 
 # Test to make sure Automake supports implicit rules with dot-less
-# extensions.
+# extensions.  Also make sure that `.o' is handled like `.$(OBJEXT)'.
 
 . $srcdir/defs || exit 1
 
 cat > Makefile.am << 'END'
-SUFFIXES = a b .$(OBJEXT)
+SUFFIXES = a b .$(OBJEXT) c .o
 bin_PROGRAMS = foo
-foo_SOURCES = fooa
+foo_SOURCES = fooa fuc
 ab:
         cp $< $@
 b.$(OBJEXT):
        cp $< $@
+c.o:
+       cp $< $@
 END
 
 : > fooa
@@ -20,7 +22,9 @@
 $ACLOCAL || exit 1
 $AUTOMAKE || exit 1
 
-# Automake must figure that fooa translates to foo.o using the
-# following rules:
+# Automake must figure that fooa translates to foo.$(OBJEXT) and
+# foo.$(OBJEXT) using the following rules:
 #  fooa --[ab]--> foob --[b.$(OBJEXT)]--> foo.$(OBJEXT)
-grep '_OBJECTS.*foo\.$(OBJEXT)' Makefile.in || exit 1
+grep '_OBJECTS.* foo\.$(OBJEXT)' Makefile.in || exit 1
+#  fuc --[c.o]--> fu.$(OBJEXT)  ## This is really meant !
+grep '_OBJECTS.* fu\.$(OBJEXT)' Makefile.in || exit 1



reply via email to

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