automake-patches
[Top][All Lists]
Advanced

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

1-include-dot-in-exts.patch


From: Alexandre Duret-Lutz
Subject: 1-include-dot-in-exts.patch
Date: Tue, 13 Nov 2001 22:05:54 +0100

This set of patches allow Automake to support dot-less extensions in 
suffix rules.   See the testcase (tests/suffix6.test) in 
3-dot-less-suffix-rules.patch for an example.

Index: ChangeLog
--- ChangeLog
+++ ChangeLog
@@ -1,1 +1,21 @@
+2001-11-09  Alexandre Duret-Lutz  <address@hidden>
+
+       At every place where an "$extension" is used, include the leading
+       dot in the extension, don't hardcode it when building the filename.
+       That will make any support for a dot-less extension easier to add.
+
+       * automake.in (SUFFIX_RULE_PATTERN): Include extension dots in
+       backref groups.
+       ("main"): Prepend a '.' to the supported extensions of all
+       languages (e.g. 'c' becomes '.c').
+       (handle_languages, handle_single_transform_list,
+       handle_lib_objects_cond, handle_headers, derive_suffix,
+       rule_define): Do not add a dot
+       before extensions, and include dots in matching groups.
+       * lib/am/depend2.am (.%EXT%.o, .%EXT%.obj, .%EXT%.lo): Rename as ...
+       (%EXT%.o, %EXT%.obj, %EXT%.lo): ... these.
+       * lib/am/lex.am (.%EXT%.%DERIVED-EXT%): Rename as ...
+       (%EXT%%DERIVED-EXT%): ... this.
+       * lib/am/yacc.am: Likewise.
+

Index: automake.in
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011109-2037/automake.in,v
retrieving revision 1.1
diff -u -r1.1 automake.in
--- automake.in 9 Nov 2001 19:38:05 -0000       1.1
+++ automake.in 9 Nov 2001 20:59:56 -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+]+)(\.[a-zA-Z0-9+]+)$';
 # 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.
@@ -775,7 +775,7 @@
                   'linker' => 'LINK',
                   'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS) -o $@',
                   'compile_flag' => '-c',
-                  'extensions' => ['c'],
+                  'extensions' => ['.c'],
                   '_finish' => \&lang_c_finish);
 
 # C++.
@@ -793,7 +793,7 @@
                   'lder' => 'CXXLD',
                   'ld' => '$(CXX)',
                   'pure' => 1,
-                  'extensions' => ['c++', 'cc', 'cpp', 'cxx', 'C']);
+                  'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']);
 
 # Objective C.
 register_language ('name' => 'objc',
@@ -810,12 +810,13 @@
                   'lder' => 'OBJCLD',
                   'ld' => '$(OBJC)',
                   'pure' => 1,
-                  'extensions' => ['m']);
+                  'extensions' => ['.m']);
 
 # Headers.
 register_language ('name' => 'header',
                   'Name' => 'Header',
-                  'extensions' => ['h', 'H', 'hxx', 'h++', 'hh', 'hpp', 'inc'],
+                  'extensions' => ['.h', '.H', '.hxx', '.h++', '.hh',
+                                   '.hpp', '.inc'],
                   # Nothing to do.
                   '_finish' => sub { });
 
@@ -827,7 +828,7 @@
                   'define_flag' => 0,
                   'compile' => '$(YACC) $(YFLAGS) $(AM_YFLAGS)',
                   'compiler' => 'YACCCOMPILE',
-                  'extensions' => ['y'],
+                  'extensions' => ['.y'],
                   'rule_file' => 'yacc',
                   '_finish' => \&lang_yacc_finish,
                   '_target_hook' => \&lang_yacc_target_hook);
@@ -839,7 +840,7 @@
                   'define_flag' => 0,
                   'compiler' => 'YACCCOMPILE',
                   'compile' => '$(YACC) $(YFLAGS) $(AM_YFLAGS)',
-                  'extensions' => ['y++', 'yy', 'yxx', 'ypp'],
+                  'extensions' => ['.y++', '.yy', '.yxx', '.ypp'],
                   '_finish' => \&lang_yacc_finish,
                   '_target_hook' => \&lang_yacc_target_hook);
 
@@ -852,7 +853,7 @@
                   'define_flag' => 0,
                   'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)',
                   'compiler' => 'LEXCOMPILE',
-                  'extensions' => ['l'],
+                  'extensions' => ['.l'],
                   '_finish' => \&lang_lex_finish);
 register_language ('name' => 'lexxx',
                   'Name' => 'Lex (C++)',
@@ -862,7 +863,7 @@
                   'define_flag' => 0,
                   'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)',
                   'compiler' => 'LEXCOMPILE',
-                  'extensions' => ['l++', 'll', 'lxx', 'lpp'],
+                  'extensions' => ['.l++', '.ll', '.lxx', '.lpp'],
                   '_finish' => \&lang_lex_finish);
 
 # Assembler.
@@ -876,7 +877,7 @@
                   'compile' => '$(AS) $(AM_ASFLAGS) $(ASFLAGS)',
                   'compiler' => 'ASCOMPILE',
                   'compile_flag' => '-c',
-                  'extensions' => ['s', 'S'],
+                  'extensions' => ['.s', '.S'],
 
                   # With assembly we still use the C linker.
                   '_finish' => \&lang_c_finish);
@@ -894,7 +895,7 @@
                   'lder' => 'F77LD',
                   'ld' => '$(F77)',
                   'pure' => 1,
-                  'extensions' => ['f', 'for', 'f90']);
+                  'extensions' => ['.f', '.for', '.f90']);
 
 # Preprocessed Fortran 77
 #
@@ -924,7 +925,7 @@
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'pure' => 1,
-                  'extensions' => ['F']);
+                  'extensions' => ['.F']);
 
 # Ratfor.
 register_language ('name' => 'ratfor',
@@ -941,7 +942,7 @@
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'pure' => 1,
-                  'extensions' => ['r']);
+                  'extensions' => ['.r']);
 
 # Java via gcj.
 register_language ('name' => 'java',
@@ -958,7 +959,7 @@
                   'lder' => 'GCJLD',
                   'ld' => '$(GCJ)',
                   'pure' => 1,
-                  'extensions' => ['java', 'class', 'zip', 'jar']);
+                  'extensions' => ['.java', '.class', '.zip', '.jar']);
 
 ################################################################
 
@@ -1526,7 +1527,7 @@
            (my $der_ext = $ext) =~ tr/yl/cc/;
 
            # Another yacc/lex hack.
-           my $destfile = '$*.' . $der_ext;
+           my $destfile = '$*' . $der_ext;
 
            $output_rules .=
              file_contents ($rule_file,
@@ -1723,7 +1724,7 @@
         # is in effect.
 
         # Split file name into base and extension.
-        next if ! /^(?:(.*)\/)?([^\/]*)\.(.*)$/;
+        next if ! /^(?:(.*)\/)?([^\/]*)(\..*?)$/;
         my $full = $_;
         my $directory = $1 || '';
         my $base = $2;
@@ -1771,7 +1772,7 @@
             my $this_obj_ext;
            if (defined $source_extension)
            {
-               $this_obj_ext = '.' . $source_extension;
+               $this_obj_ext = $source_extension;
                $derived_source = 1;
            }
            elsif ($lang->ansi)
@@ -1865,11 +1866,11 @@
                 push (@{$lang_specific_files{$lang->name}}, $val);
             }
         }
-        elsif (".$extension" eq $nonansi_obj)
+        elsif ($extension eq $nonansi_obj)
         {
             # This is probably the result of a direct suffix rule.
             # In this case we just accept the rewrite.
-            $object = "$base.$extension";
+            $object = "$base$extension";
             $linker = '';
         }
         else
@@ -2292,10 +2293,10 @@
 
            foreach my $iter (keys %libsources)
            {
-               if ($iter =~ /\.([cly])$/)
+               if ($iter =~ /\.[cly]$/)
                {
-                   &saw_extension ($1);
-                   &saw_extension ('c');
+                   &saw_extension ($&);
+                   &saw_extension ('.c');
                }
 
                if ($iter =~ /\.h$/)
@@ -3868,8 +3869,8 @@
                             'noinst', 'check');
     foreach (@r)
     {
-       next unless /\.(.*)$/;
-       &saw_extension ($1);
+       next unless /\..*$/;
+       &saw_extension ($&);
     }
 }
 
@@ -5321,7 +5322,7 @@
     my ($source_ext, $obj) = @_;
 
     while (! $extension_map{$source_ext}
-          && ".$source_ext" ne $obj
+          && $source_ext ne $obj
           && defined $suffix_rules{$source_ext})
     {
        $source_ext = $suffix_rules{$source_ext};
@@ -6570,9 +6571,9 @@
   if ((my ($source_suffix, $object_suffix)) = ($target =~ 
$SUFFIX_RULE_PATTERN))
   {
       $suffix_rules{$source_suffix} = $object_suffix;
-      verbose "Sources ending in .$source_suffix become .$object_suffix";
+      verbose "Sources ending in $source_suffix become $object_suffix";
       # Set SUFFIXES from suffix_rules.
-      push @suffixes, ".$source_suffix", ".$object_suffix";
+      push @suffixes, $source_suffix, $object_suffix;
   }
 
   return 1;
Index: lib/am/depend2.am
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011109-2037/lib/am/depend2.am,v
retrieving revision 1.1
diff -u -r1.1 depend2.am
--- lib/am/depend2.am   9 Nov 2001 19:38:06 -0000       1.1
+++ lib/am/depend2.am   9 Nov 2001 20:04:32 -0000
@@ -30,7 +30,7 @@
 ##   the `if AMDEP' chunk is prefix with @AMDEP_TRUE@ just like for any
 ##   other configure-time conditional.
 
-?GENERIC?.%EXT%.o:
+?GENERIC?%EXT%.o:
 ?!GENERIC?%OBJ%: %SOURCE%
 if %AMDEP%
        source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
@@ -40,7 +40,7 @@
 ?-o?   %COMPILE% %-c% %-o% %OBJ% `test -f %SOURCE% || echo 
'$(srcdir)/'`%SOURCE%
 ?!-o?  %COMPILE% %-c% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
 
-?GENERIC?.%EXT%.obj:
+?GENERIC?%EXT%.obj:
 ?!GENERIC?%OBJOBJ%: %SOURCE%
 if %AMDEP%
        source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
@@ -51,7 +51,7 @@
 ?!-o?  %COMPILE% %-c% `cygpath -w %SOURCE%`
 
 if %?LIBTOOL%
-?GENERIC?.%EXT%.lo:
+?GENERIC?%EXT%.lo:
 ?!GENERIC?%LTOBJ%: %SOURCE%
 if  %AMDEP%
        source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
Index: lib/am/lex.am
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011109-2037/lib/am/lex.am,v
retrieving revision 1.1
diff -u -r1.1 lex.am
--- lib/am/lex.am       9 Nov 2001 19:38:06 -0000       1.1
+++ lib/am/lex.am       9 Nov 2001 20:05:34 -0000
@@ -21,7 +21,7 @@
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
 LEXLIB = @LEXLIB@
 
-?GENERIC?.%EXT%.%DERIVED-EXT%:
+?GENERIC?%EXT%%DERIVED-EXT%:
 ?!GENERIC?%OBJ%: %SOURCE%
 if %?MORE-THAN-ONE%
        $(SHELL) $(YLWRAP) %SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE%
Index: lib/am/yacc.am
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011109-2037/lib/am/yacc.am,v
retrieving revision 1.1
diff -u -r1.1 yacc.am
--- lib/am/yacc.am      9 Nov 2001 19:38:06 -0000       1.1
+++ lib/am/yacc.am      9 Nov 2001 20:06:00 -0000
@@ -16,7 +16,7 @@
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
 
-?GENERIC?.%EXT%.%DERIVED-EXT%:
+?GENERIC?%EXT%%DERIVED-EXT%:
 ?!GENERIC?%OBJ%: %SOURCE%
 if %?MORE-THAN-ONE%
        $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h -- %COMPILE%



reply via email to

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