+2001-11-16 Alexandre Duret-Lutz <duret_g@epita.fr>
+
+ 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 <akim@epita.fr>
* m4/make.m4 (AM_MAKE_INCLUDE): Serial 2.
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.
'linker' => 'LINK',
'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
'compile_flag' => '-c',
- 'extensions' => ['c'],
+ 'extensions' => ['.c'],
'_finish' => \&lang_c_finish);
# C++.
'lder' => 'CXXLD',
'ld' => '$(CXX)',
'pure' => 1,
- 'extensions' => ['c++', 'cc', 'cpp', 'cxx', 'C']);
+ 'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']);
# Objective C.
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 { });
'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);
'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);
'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++)',
'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.
'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);
'lder' => 'F77LD',
'ld' => '$(F77)',
'pure' => 1,
- 'extensions' => ['f', 'for', 'f90']);
+ 'extensions' => ['.f', '.for', '.f90']);
# Preprocessed Fortran 77
#
'compile_flag' => '-c',
'output_flag' => '-o',
'pure' => 1,
- 'extensions' => ['F']);
+ 'extensions' => ['.F']);
# Ratfor.
register_language ('name' => 'ratfor',
'compile_flag' => '-c',
'output_flag' => '-o',
'pure' => 1,
- 'extensions' => ['r']);
+ 'extensions' => ['.r']);
# Java via gcj.
register_language ('name' => 'java',
'lder' => 'GCJLD',
'ld' => '$(GCJ)',
'pure' => 1,
- 'extensions' => ['java', 'class', 'zip', 'jar']);
+ 'extensions' => ['.java', '.class', '.zip', '.jar']);
################################################################
(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,
# is in effect.
# Split file name into base and extension.
- next if ! /^(?:(.*)\/)?([^\/]*)\.(.*)$/;
+ next if ! /^(?:(.*)\/)?([^\/]*)(\..*?)$/;
my $full = $_;
my $directory = $1 || '';
my $base = $2;
my $this_obj_ext;
if (defined $source_extension)
{
- $this_obj_ext = '.' . $source_extension;
+ $this_obj_ext = $source_extension;
$derived_source = 1;
}
elsif ($lang->ansi)
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
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$/)
'noinst', 'check');
foreach (@r)
{
- next unless /\.(.*)$/;
- &saw_extension ($1);
+ next unless /\..*$/;
+ &saw_extension ($&);
}
}
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};
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;