automake-patches
[Top][All Lists]
Advanced

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

2-match-extensions.patch


From: Alexandre Duret-Lutz
Subject: 2-match-extensions.patch
Date: Tue, 13 Nov 2001 22:05:54 +0100

This will temporary broke the suffix rules handling (e.g., suffix3.test
and suffix5.test) because $KNOWN_EXTENSIONS_PATTERN does not contain
user suffixes.  The next patch fixes that.


Index: ChangeLog
--- ChangeLog
+++ ChangeLog
@@ -1,1 +1,8 @@
+2001-11-12  Alexandre Duret-Lutz  <address@hidden>
+
+       * automake.in (KNOWN_EXTENSIONS_PATTERN): New variable.
+       (handle_single_transform_list, lang_yacc_target_hook): Use it.
+       (accept_extension): New function.
+       (register_language): Call it.
+

Index: automake.in
===================================================================
RCS file: /home/adl/CVSROOT/automake-20011109-2037/automake.in,v
retrieving revision 1.2
diff -u -r1.2 automake.in
--- automake.in 9 Nov 2001 21:08:30 -0000 1.2
+++ automake.in 12 Nov 2001 20:31:40 -0000
@@ -1062,6 +1062,32 @@
 
 ################################################################
 
+# Pattern that matches all know input extensions
+# (i.e. extensions used by the languages supported by Automake).
+# Use as `($KNOWN_EXTENSIONS_PATTERN)$'.  Using this pattern
+# (instead of `\..*$') to match extensions allows Automake to support
+# dot-less extensions.
+my $KNOWN_EXTENSIONS_PATTERN = undef;
+
+# accept_extensions (@EXTS)
+# -------------------------
+# Update $KNOWN_EXTENSIONS_PATTERN to recognize the extensions
+# listed @EXTS.  Extensions should contain a dot if needed.
+sub accept_extensions (@)
+{
+    my $pat = join ('|', map (quotemeta, @_));
+    if (defined $KNOWN_EXTENSIONS_PATTERN)
+    {
+        $KNOWN_EXTENSIONS_PATTERN .= "|$pat";
+    }
+    else
+    {
+        $KNOWN_EXTENSIONS_PATTERN = $pat;
+    }
+}
+
+################################################################
+
 # Parse command line.
 sub parse_arguments ()
 {
@@ -1724,7 +1750,7 @@
         # is in effect.
 
         # Split file name into base and extension.
-        next if ! /^(?:(.*)\/)?([^\/]*)(\..*?)$/;
+        next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/;
         my $full = $_;
         my $directory = $1 || '';
         my $base = $2;
@@ -5128,7 +5154,7 @@
        || (variable_defined ('YFLAGS')
            && &variable_value ('YFLAGS') =~ /$DASH_D_PATTERN/o))
     {
-       (my $output_base = $output) =~ s/\..*$//;
+       (my $output_base = $output) =~ s/(?:$KNOWN_EXTENSIONS_PATTERN)$//;
        my $header = $output_base . '.h';
 
        # Found a `-d' that applies to the compilation of this file.
@@ -5311,6 +5337,9 @@
     # Fill indexes.
     grep ($extension_map{$_} = $lang->name, @{$lang->extensions});
     $languages{$lang->name} = $lang;
+
+    # Update the pattern of known extensions.
+    accept_extensions (@{$lang->extensions});
 }
 
 # derive_suffix ($EXT, $OBJ)
@@ -6314,7 +6343,7 @@
 # @VALUE
 # &variable_value_as_list_recursive_worker ($VAR, $COND, $PARENT)
 # ---------------------------------------------------------------
-# Return contents of variable as list, split as whitespace.  This will
+# Return contents of VAR as a list, split on whitespace.  This will
 # recursively follow $(...) and ${...} inclusions.  It preserves @...@
 # substitutions.  If COND is 'all', then all values under all
 # conditions should be returned; if COND is a particular condition



reply via email to

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