Index: ChangeLog
from Akim Demaille <[EMAIL PROTECTED]>
* automake.in (Language): Replace the attribute `output_arg' with
`compile_flag' and `output_flag'.
(Automake): Adjust language registrations.
(&handle_languages): Transform `-c' and `-o' for both suffix and
per object rules, instead of `OUTARG' and `LTOUTARG' only for
generic rules.
(&handle_single_transform_list): Adjust to `compile_flag' and
`output_flag'.
* depend2.am, ext-compile.am: Use `%-c%' and `%-o%'.
Index: automake.in
--- automake.in Sat, 31 Mar 2001 13:27:13 +0200 akim (am/f/39_automake.i 1.243 755)
+++ automake.in Sat, 31 Mar 2001 14:17:04 +0200 akim (am/f/39_automake.i 1.243 755)
@@ -32,13 +32,16 @@
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.
@@ -738,7 +741,7 @@ sub initialize_per_input ()
'flags' => 'CFLAGS',
'compile' => '$(CC) $(DEFS) $(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',
@@ -747,7 +750,8 @@ sub initialize_per_input ()
'flags' => 'CXXFLAGS',
'compile' => '$(CXX) $(DEFS) $(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);
@@ -757,7 +761,8 @@ sub initialize_per_input ()
'flags' => 'OBJCFLAGS',
'compile' => '$(OBJC) $(DEFS) $(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);
@@ -792,7 +797,7 @@ sub initialize_per_input ()
'compile' => '$(CC) $(DEFS) $(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);
@@ -802,7 +807,8 @@ sub initialize_per_input ()
'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);
@@ -811,7 +817,8 @@ sub initialize_per_input ()
'flags' => 'FFLAGS',
'compile' => '$(F77) $(DEFS) $(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);
@@ -821,7 +828,8 @@ sub initialize_per_input ()
# 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);
@@ -832,7 +840,8 @@ sub initialize_per_input ()
'flags' => 'GCJFLAGS',
'compile' => '$(GCJ) $(DEFS) $(INCLUDES) $(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);
@@ -1350,44 +1359,39 @@ sub handle_languages
{
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
@@ -1430,11 +1434,13 @@ sub handle_languages
$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))
}
@@ -1667,7 +1673,9 @@ sub handle_single_transform_list ($$$@)
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')
Index: depend2.am
--- depend2.am Sat, 31 Mar 2001 12:59:30 +0200 akim (am/g/43_depend2.am 1.14 644)
+++ depend2.am Sat, 31 Mar 2001 14:07:43 +0200 akim (am/g/43_depend2.am 1.14 644)
@@ -35,7 +35,18 @@
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:
@@ -45,14 +56,6 @@
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%`
Index: ext-compile.am
--- ext-compile.am Sat, 31 Mar 2001 13:27:13 +0200 akim (am/h/38_ext-compil 1.3 644)
+++ ext-compile.am Sat, 31 Mar 2001 14:07:57 +0200 akim (am/h/38_ext-compil 1.3 644)
@@ -16,18 +16,17 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-## OUTARG is set to `', or `-c', or `-c -o $@' etc.
-## LTOUTARG is set to `', or `-o $@'.
-
.%EXT%.o:
- %COMPILE% %OUTARG% %SOURCE%
+?-o? %COMPILE% %-c% %-o% $@ %SOURCE%
+?!-o? %COMPILE% %-c% %SOURCE%
.%EXT%.obj:
## FIXME: Using cygpath should be somehow conditional.
- %COMPILE% %OUTARG% `cygpath -w %SOURCE%`
+?-o? %COMPILE% %-c% %-o% $@ `cygpath -w %SOURCE%`
+?!-o? %COMPILE% %-c% `cygpath -w %SOURCE%`
if %?LIBTOOL%
.%EXT%.lo:
-## We don't care if there are several `-o', libtool handles it gracefully.
- %LTCOMPILE% %OUTARG% %LTOUTARG% %SOURCE%
+## We can always use `-o' with Libtool.
+ %LTCOMPILE% %-c% -o $@ %SOURCE%
endif %?LIBTOOL%