struct ('ansi' => '$',
'autodep' => '$',
'compile' => '$',
+ # Flag to require compilation without linking (-c).
+ 'compile_flag' => '$',
'compiler' => '$',
'derived_autodep' => '$',
'extensions' => '@',
'flags' => '$',
'linker' => '$',
'name' => '$',
- 'output_arg' => '$',
+ # Flag to specify the output file (-o).
+ 'output_flag' => '$',
# `pure' is `1' or `'. A `pure' language is one where, if
# all the files in a directory are of that language, then we
# do not require the C compiler or any code to call it.
'flags' => 'CFLAGS',
'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
'compiler' => 'COMPILE',
- 'output_arg' => '-c',
+ 'compile_flag' => '-c',
'extensions' => ['c'],
'_finish' => \&lang_c_finish);
register_language ('name' => 'cxx',
'flags' => 'CXXFLAGS',
'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
'compiler' => 'CXXCOMPILE',
- 'output_arg' => '-c -o $@',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
'pure' => 1,
'extensions' => ['c++', 'cc', 'cpp', 'cxx', 'C'],
'_finish' => \&lang_cxx_finish);
'flags' => 'OBJCFLAGS',
'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
'compiler' => 'OBJCCOMPILE',
- 'output_arg' => '-c -o $@',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
'pure' => 1,
'extensions' => ['m'],
'_finish' => \&lang_objc_finish);
'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
# FIXME: a different compiler?
'compiler' => 'COMPILE',
- 'output_arg' => '-c',
+ 'compile_flag' => '-c',
'extensions' => ['s', 'S'],
# We need the C code for assembly.
'_finish' => \&lang_c_finish);
'flags' => 'FFLAGS',
'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)',
'compiler' => 'F77COMPILE',
- 'output_arg' => '-c -o $@',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
'pure' => 1,
'extensions' => ['f', 'for', 'f90'],
'_finish' => \&lang_f77_finish);
'flags' => 'FFLAGS',
'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
'compiler' => 'PPF77COMPILE',
- 'output_arg' => '-c -o $@',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
'pure' => 1,
'extensions' => ['F'],
'_finish' => \&lang_ppf77_finish);
# FIXME also FFLAGS.
'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)',
'compiler' => 'RCOMPILE',
- 'output_arg' => '-c -o $@',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
'pure' => 1,
'extensions' => ['r'],
'_finish' => \&lang_ratfor_finish);
'flags' => 'GCJFLAGS',
'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)',
'compiler' => 'GCJCOMPILE',
- 'output_arg' => '-c -o $@',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
'pure' => 1,
'extensions' => ['java', 'class', 'zip', 'jar'],
'_finish' => \&lang_java_finish);
{
my $lang = $languages{$extension_map{$ext}};
- # Get information on $LANG.
+ # Get information on $LANG.
my $pfx = $lang->autodep;
my $fpfx = ($pfx eq '') ? 'CC' : $pfx;
- my %transform = ('PFX' => $pfx,
- 'FPFX' => $fpfx,
+ # Some C compilers don't support -c -o. Use it only if really
+ # needed.
+ my $output_flag = $lang->output_flag || '';
+ $output_flag = '-o'
+ if (! $output_flag
+ && $lang->flags eq 'CFLAGS'
+ && defined $options{'subdir-objects'});
+
+ my %transform = ('EXT' => $ext,
+ 'PFX' => $pfx,
+ 'FPFX' => $fpfx,
'LIBTOOL' => $seen_libtool,
- 'AMDEP' => $use_dependencies ? 'AMDEP' : 'FALSE');
+ 'AMDEP' => $use_dependencies ? 'AMDEP' : 'FALSE',
+ '-c' => $lang->compile_flag || '',
+ '-o' => $output_flag);
# First include code for ordinary objects.
{
- my $outarg = $lang->output_arg;
- my $ltoutarg = '';
- if ($lang->flags eq 'CFLAGS')
- {
- # C compilers don't always support -c -o.
- if (defined $options{'subdir-objects'})
- {
- $outarg .= ' -o $@';
- }
- # We can always use -c -o with libtool.
- $ltoutarg = ' -o $@';
- }
-
my %transform = (%transform,
'GENERIC' => 1,
- 'EXT' => $ext,
'BASE' => '$*',
'SOURCE' => '$<',
'OBJ' => '$@',
- 'LTOBJ' => '$@',
'OBJOBJ' => '$@',
+ 'LTOBJ' => '$@',
'COMPILE' => '$(' . $lang->compiler . ')',
- 'LTCOMPILE' => '$(LT' . $lang->compiler . ')',
- 'OUTARG' => $outarg,
- 'LTOUTARG' => $ltoutarg);
+ 'LTCOMPILE' => '$(LT' . $lang->compiler . ')');
# Generate the appropriate rules for this extension. If
$output_rules .= &file_contents ('depend2',
(%transform,
'GENERIC' => 0,
+
'BASE' => $obj,
'SOURCE' => $source,
'OBJ' => "$obj.o",
'OBJOBJ' => "$obj.obj",
'LTOBJ' => "$obj.lo",
+
'COMPILE' => $obj_compile,
'LTCOMPILE' => $obj_ltcompile))
}
my $val = "(${derived}_${flag}";
($rule = $lang->compile) =~ s/\(AM_$flag/$val/;
- $rule .= ' ' . $lang->output_arg;
+ $rule .= ' ' . $lang->compile_flag;
+ $rule .= ' ' . $lang->output_flag . '$@'
+ if $lang->output_flag;
# For C we have to add the -o, because the
# standard rule doesn't include it.
if ($lang->flags eq 'CFLAGS')
depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' @AMDEPBACKSLASH@
$(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
- %COMPILE% -c -o %OBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+?-o? %COMPILE% %-c% %-o% %OBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+?!-o? %COMPILE% %-c% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+
+?GENERIC?.%EXT%.obj:
+?!GENERIC?%OBJOBJ%: %SOURCE%
+if %AMDEP%
+ source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
+ depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' @AMDEPBACKSLASH@
+ $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
+endif %AMDEP%
+?-o? %COMPILE% %-c% %-o% %OBJOBJ% `cygpath -w %SOURCE%`
+?!-o? %COMPILE% %-c% `cygpath -w %SOURCE%`
if %?LIBTOOL%
?GENERIC?.%EXT%.lo:
depfile='$(DEPDIR)/%BASE%.Plo' tmpdepfile='$(DEPDIR)/%BASE%.TPlo' @AMDEPBACKSLASH@
$(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
- %LTCOMPILE% -c -o %LTOBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+## We can always use `-o' with Libtool.
+ %LTCOMPILE% %-c% -o %LTOBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
endif %?LIBTOOL%
-
-?GENERIC?.%EXT%.obj:
-?!GENERIC?%OBJOBJ%: %SOURCE%
-if %AMDEP%
- source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
- depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' @AMDEPBACKSLASH@
- $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
-endif %AMDEP%
- %COMPILE% -c -o %OBJOBJ% `cygpath -w %SOURCE%`
depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' @AMDEPBACKSLASH@
$(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
- %COMPILE% -c -o %OBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+?-o? %COMPILE% %-c% %-o% %OBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+?!-o? %COMPILE% %-c% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+
+?GENERIC?.%EXT%.obj:
+?!GENERIC?%OBJOBJ%: %SOURCE%
+if %AMDEP%
+ source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
+ depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' @AMDEPBACKSLASH@
+ $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
+endif %AMDEP%
+?-o? %COMPILE% %-c% %-o% %OBJOBJ% `cygpath -w %SOURCE%`
+?!-o? %COMPILE% %-c% `cygpath -w %SOURCE%`
if %?LIBTOOL%
?GENERIC?.%EXT%.lo:
depfile='$(DEPDIR)/%BASE%.Plo' tmpdepfile='$(DEPDIR)/%BASE%.TPlo' @AMDEPBACKSLASH@
$(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
- %LTCOMPILE% -c -o %LTOBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+## We can always use `-o' with Libtool.
+ %LTCOMPILE% %-c% -o %LTOBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
endif %?LIBTOOL%
-
-?GENERIC?.%EXT%.obj:
-?!GENERIC?%OBJOBJ%: %SOURCE%
-if %AMDEP%
- source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
- depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' @AMDEPBACKSLASH@
- $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
-endif %AMDEP%
- %COMPILE% -c -o %OBJOBJ% `cygpath -w %SOURCE%`