From: Alexandre Duret-Lutz Date: Fri, 16 Nov 2001 10:25:57 +0000 (+0000) Subject: At every place where an "$extension" is used, include the leading X-Git-Tag: Release-1-5b~26 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=0474be940c1d2ab196672b7f64fa61d52f241a84;p=automake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 67ced092..82570b73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2001-11-16 Alexandre Duret-Lutz + + 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. + 2001-11-12 Akim Demaille * m4/make.m4 (AM_MAKE_INCLUDE): Serial 2. diff --git a/automake.in b/automake.in index 47800359..9c94bb7b 100755 --- a/automake.in +++ b/automake.in @@ -137,7 +137,7 @@ my $TARGET_PATTERN='[$a-zA-Z_.@][-.a-zA-Z0-9_(){}/$+@]*'; 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 @@ register_language ('name' => 'c', '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 @@ register_language ('name' => 'cxx', '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 @@ register_language ('name' => 'objc', '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 @@ register_language ('name' => 'yacc', '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 @@ register_language ('name' => 'yaccxx', '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 @@ register_language ('name' => 'lex', '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 @@ register_language ('name' => 'lexxx', '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 @@ register_language ('name' => 'asm', '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 @@ register_language ('name' => 'f77', 'lder' => 'F77LD', 'ld' => '$(F77)', 'pure' => 1, - 'extensions' => ['f', 'for', 'f90']); + 'extensions' => ['.f', '.for', '.f90']); # Preprocessed Fortran 77 # @@ -924,7 +925,7 @@ register_language ('name' => 'ppf77', 'compile_flag' => '-c', 'output_flag' => '-o', 'pure' => 1, - 'extensions' => ['F']); + 'extensions' => ['.F']); # Ratfor. register_language ('name' => 'ratfor', @@ -941,7 +942,7 @@ register_language ('name' => 'ratfor', 'compile_flag' => '-c', 'output_flag' => '-o', 'pure' => 1, - 'extensions' => ['r']); + 'extensions' => ['.r']); # Java via gcj. register_language ('name' => 'java', @@ -958,7 +959,7 @@ register_language ('name' => 'java', 'lder' => 'GCJLD', 'ld' => '$(GCJ)', 'pure' => 1, - 'extensions' => ['java', 'class', 'zip', 'jar']); + 'extensions' => ['.java', '.class', '.zip', '.jar']); ################################################################ @@ -1526,7 +1527,7 @@ sub handle_languages (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 @@ sub handle_single_transform_list ($$$$@) # 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 @@ sub handle_single_transform_list ($$$$@) 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 @@ sub handle_single_transform_list ($$$$@) 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 @@ sub handle_lib_objects_cond 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 @@ sub handle_headers 'noinst', 'check'); foreach (@r) { - next unless /\.(.*)$/; - &saw_extension ($1); + next unless /\..*$/; + &saw_extension ($&); } } @@ -5321,7 +5322,7 @@ sub derive_suffix ($$) 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 @@ sub rule_define ($$$$) 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; diff --git a/lib/am/depend2.am b/lib/am/depend2.am index 466f165e..0540e9d0 100644 --- a/lib/am/depend2.am +++ b/lib/am/depend2.am @@ -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 @@ endif %AMDEP% ?-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 @@ endif %AMDEP% ?!-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@ diff --git a/lib/am/lex.am b/lib/am/lex.am index 8d0f996c..a61663f5 100644 --- a/lib/am/lex.am +++ b/lib/am/lex.am @@ -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% diff --git a/lib/am/yacc.am b/lib/am/yacc.am index 2032f0c1..8fda29df 100644 --- a/lib/am/yacc.am +++ b/lib/am/yacc.am @@ -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%