use Class::Struct;
struct ('ansi' => '$',
'autodep' => '$',
+ 'compile' => '$',
+ 'compiler' => '$',
'derived_autodep' => '$',
+ 'flags' => '$',
'linker' => '$',
'pure' => '$');
if ($use_dependencies && $lang_obj->autodep ne 'no')
{
# Don't generate the rule, but still generate the variables.
- if (exists $language_map{"$lang-compile"})
+ if (defined $lang_obj->compile)
{
- $comp = $language_map{"$lang-compile"};
+ $comp = $lang_obj->compile
}
}
- elsif (exists $language_map{"$lang-compile"})
+ elsif (defined $lang_obj->compile)
{
- $comp = $language_map{"$lang-compile"};
+ $comp = $lang_obj->compile;
my $outarg = $language_map{"$lang-output-arg"};
my $ltoutarg;
- if ($language_map{"$lang-flags"} eq 'CFLAGS')
+ if ($lang_obj->flags eq 'CFLAGS')
{
# C compilers don't always support -c -o.
if (defined $options{'subdir-objects'})
$ltoutarg = ' -o $@';
}
- my $compiler = $language_map{"$lang-compiler-name"};
$output_rules .= file_contents ('ext-compile',
('EXT' => $ext,
- 'COMPILER' => $compiler,
+ 'COMPILER' => $lang_obj->compiler,
'OUTARG' => $outarg,
'LTOUTARG' => $ltoutarg));
}
# probably corner cases here that do not work properly.
# People linking Java code to Fortran code deserve pain.
$non_c = 0
- if $language_map{"$lang-pure"} eq 'no';
+ if $lang_obj->pure eq 'no';
if ($comp ne '')
{
- &define_compiler_variable ($language_map{"$lang-compiler-name"},
- $ltcompile, $comp);
+ &define_compiler_variable ($lang_obj->compiler, $ltcompile, $comp);
}
# The compiler's flag must be a configure variable.
- if (exists $language_map{"$lang-flags"})
+ if (defined $lang_obj->flags)
{
- &define_configure_variable ($language_map{"$lang-flags"});
+ &define_configure_variable ($lang_obj->flags);
}
# Compute the function name of the finisher and then call it.
{
if (! defined $done{'c'})
{
- &define_configure_variable ($language_map{'c-flags'});
- &define_compiler_variable ($language_map{'c-compiler-name'},
+ &define_configure_variable ($languages{'c'}->flags);
+ &define_compiler_variable ($languages{'c'}->compiler,
$ltcompile,
- $language_map{'c-compile'});
+ $languages{'c'}->compile);
}
&define_variable ('CCLD', '$(CC)');
&define_variable ('LINK',
next if $r == $LANG_IGNORE;
# Now extract linker and other info.
- $linker = $language_map{"$lang-linker"};
+ $linker = $lang_obj->linker;
my $this_obj_ext;
prog_error ("$lang-ansi-p = " . $language_map{"$lang-ansi-p"}
$this_obj_ext = $nonansi_obj;
}
- if (exists $language_map{"$lang-flags"}
- && &variable_defined ($derived . '_'
- . $language_map{"$lang-flags"}))
+ if (defined $lang_obj->flags
+ && &variable_defined ($derived . '_' . $lang_obj->flags))
{
# We have a per-executable flag in effect for this
# object. In this case we rewrite the object's
if $lang eq 'c';
&prog_error ("$lang flags defined without compiler")
- if ! defined $language_map{"$lang-compile"};
+ if ! defined $lang_obj->compile;
# Compute the rule to compile this object.
- my $flag = $language_map{"$lang-flags"};
+ my $flag = $lang_obj->flags;
my $val = "(${derived}_${flag}";
- ($rule = $language_map{"$lang-compile"}) =~
- s/\(AM_$flag/$val/;
+ ($rule = $lang_obj->compile) =~ s/\(AM_$flag/$val/;
$rule .= ' ' . $language_map{"$lang-output-arg"};
# For C we have to add the -o, because the
# standard rule doesn't include it.
- if ($language_map{"$lang-flags"} eq 'CFLAGS')
+ if ($lang_obj->flags eq 'CFLAGS')
{
$rule .= ' -o $@';
}
# Get information on $LANG.
my $pfx = $lang_obj->autodep;
my $fpfx = ($pfx eq '') ? 'CC' : $pfx;
- my $flag = $language_map{"$lang-flags"} || '';
+ my $flag = $lang_obj->flags || '';
# First include code for ordinary objects.
my %transform = ('PFX' => $pfx,
my $val = "${derived}_${flag}";
- my $obj_compile = $language_map{"$lang-compile"};
- $obj_compile =~ s/\(AM_$flag/\($val/;
+ (my $obj_compile = $lang_obj->compile) =~ s/\(AM_$flag/\($val/;
my $obj_ltcompile = '$(LIBTOOL) --mode=compile ' . $obj_compile;
# Generate a transform which will turn suffix targets in
my $obj = new Language;
$obj->ansi ($language_map{"$lang-ansi-p"});
$obj->autodep ($language_map{"$lang-autodep"});
+ $obj->compile ($language_map{"$lang-compile"})
+ if defined $language_map{"$lang-compile"};
+ $obj->compiler ($language_map{"$lang-compiler-name"})
+ if defined $language_map{"$lang-compiler-name"};
$obj->derived_autodep ($language_map{"$lang-derived-autodep"});
+ $obj->flags ($language_map{"$lang-flags"})
+ if defined $language_map{"$lang-flags"};
$obj->linker ($language_map{"$lang-linker"});
$obj->pure ($language_map{"$lang-pure"});