# Content of the linking variable.
'link' => "\$",
+ # Name of the compiler variable (CC).
+ 'ccer' => "\$",
+
# Name of the linker variable (LD).
'lder' => "\$",
# Content of the linker variable ($(CC)).
my ($self) = @_;
if (defined $self->_finish)
{
- &{$self->_finish} ();
+ &{$self->_finish} (@_);
}
}
# Keep track of all programs declared in this Makefile, without
# $(EXEEXT). @substitutions@ are not listed.
my %known_programs;
+my %known_libraries;
# Keys in this hash are the basenames of files which must depend on
# ansi2knr. Values are either the empty string, or the directory in
@dist_targets = ();
%known_programs = ();
+ %known_libraries= ();
%de_ansi_files = ();
'ansi' => 1,
'autodep' => '',
'flags' => ['CFLAGS', 'CPPFLAGS'],
+ 'ccer' => 'CC',
'compiler' => 'COMPILE',
'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
'lder' => 'CCLD',
'autodep' => 'CXX',
'flags' => ['CXXFLAGS', 'CPPFLAGS'],
'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
+ 'ccer' => 'CXX',
'compiler' => 'CXXCOMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
'autodep' => 'OBJC',
'flags' => ['OBJCFLAGS', 'CPPFLAGS'],
'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
+ 'ccer' => 'OBJC',
'compiler' => 'OBJCCOMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
'autodep' => 'UPC',
'flags' => ['UPCFLAGS', 'CPPFLAGS'],
'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)',
+ 'ccer' => 'UPC',
'compiler' => 'UPCCOMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
# Nothing to do.
'_finish' => sub { });
+# Vala
+register_language ('name' => 'vala',
+ 'Name' => 'Vala',
+ 'config_vars' => ['VALAC'],
+ 'flags' => ['VALAFLAGS'],
+ 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
+ 'ccer' => 'VALAC',
+ 'compiler' => 'VALACOMPILE',
+ 'extensions' => ['.vala'],
+ 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/;
+ return ($ext,) },
+ 'rule_file' => 'vala',
+ '_finish' => \&lang_vala_finish,
+ '_target_hook' => \&lang_vala_target_hook,
+ 'nodist_specific' => 1);
+
# Yacc (C & C++).
register_language ('name' => 'yacc',
'Name' => 'Yacc',
'config_vars' => ['YACC'],
'flags' => ['YFLAGS'],
'compile' => '$(YACC) $(YFLAGS) $(AM_YFLAGS)',
+ 'ccer' => 'YACC',
'compiler' => 'YACCCOMPILE',
'extensions' => ['.y'],
'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/;
'config_vars' => ['YACC'],
'rule_file' => 'yacc',
'flags' => ['YFLAGS'],
+ 'ccer' => 'YACC',
'compiler' => 'YACCCOMPILE',
'compile' => '$(YACC) $(YFLAGS) $(AM_YFLAGS)',
'extensions' => ['.y++', '.yy', '.yxx', '.ypp'],
'rule_file' => 'lex',
'flags' => ['LFLAGS'],
'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)',
+ 'ccer' => 'LEX',
'compiler' => 'LEXCOMPILE',
'extensions' => ['.l'],
'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
'rule_file' => 'lex',
'flags' => ['LFLAGS'],
'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)',
+ 'ccer' => 'LEX',
'compiler' => 'LEXCOMPILE',
'extensions' => ['.l++', '.ll', '.lxx', '.lpp'],
'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
# or anything else required. They can also set CCAS.
# Or simply use Preprocessed Assembler.
'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+ 'ccer' => 'CCAS',
'compiler' => 'CCASCOMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
'autodep' => 'CCAS',
'flags' => ['CCASFLAGS', 'CPPFLAGS'],
'compile' => '$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+ 'ccer' => 'CPPAS',
'compiler' => 'CPPASCOMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
'flags' => ['FFLAGS'],
'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)',
+ 'ccer' => 'F77',
'compiler' => 'F77COMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
'flags' => ['FCFLAGS'],
'compile' => '$(FC) $(AM_FCFLAGS) $(FCFLAGS)',
+ 'ccer' => 'FC',
'compiler' => 'FCCOMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
'lder' => 'FCLD',
'ld' => '$(FC)',
'flags' => ['FCFLAGS', 'CPPFLAGS'],
+ 'ccer' => 'PPFC',
'compiler' => 'PPFCCOMPILE',
'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
'compile_flag' => '-c',
'lder' => 'F77LD',
'ld' => '$(F77)',
'flags' => ['FFLAGS', 'CPPFLAGS'],
+ 'ccer' => 'PPF77',
'compiler' => 'PPF77COMPILE',
'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
'compile_flag' => '-c',
'flags' => ['RFLAGS', 'FFLAGS'],
# FIXME also FFLAGS.
'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)',
+ 'ccer' => 'F77',
'compiler' => 'RCOMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
'autodep' => 'GCJ',
'flags' => ['GCJFLAGS'],
'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)',
+ 'ccer' => 'GCJ',
'compiler' => 'GCJCOMPILE',
'compile_flag' => '-c',
'output_flag' => '-o',
################################################################
+# `silent-rules' mode handling functions.
+
+# verbose_var (NAME)
+# ------------------
+# The public variable stem used to implement `silent-rules'.
+sub verbose_var ($)
+{
+ my ($name) = @_;
+ return 'AM_V_' . $name;
+}
+
+# verbose_private_var (NAME)
+# --------------------------
+# The naming policy for the private variables for `silent-rules'.
+sub verbose_private_var ($)
+{
+ my ($name) = @_;
+ return 'am__v_' . $name;
+}
+
+# define_verbose_var (NAME, VAL)
+# ------------------------------
+# For `silent-rules' mode, setup VAR and dispatcher, to expand to VAL if silent.
+sub define_verbose_var ($$)
+{
+ my ($name, $val) = @_;
+ my $var = verbose_var ($name);
+ my $pvar = verbose_private_var ($name);
+ if (option 'silent-rules')
+ {
+ # Using `$V' instead of `$(V)' breaks IRIX make.
+ define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL);
+ define_variable ($pvar . '_', '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))', INTERNAL);
+ define_variable ($pvar . '_0', $val, INTERNAL);
+ }
+}
+
+# Above should not be needed in the general automake code.
+
+# verbose_flag (NAME)
+# -------------------
+# Contents of %VERBOSE%: variable to expand before rule command.
+sub verbose_flag ($)
+{
+ my ($name) = @_;
+ return '$(' . verbose_var ($name) . ')'
+ if (option 'silent-rules');
+ return '';
+}
+
+# silent_flag
+# -----------
+# Contents of %SILENT%: variable to expand to `@' when silent.
+sub silent_flag ()
+{
+ return verbose_flag ('at');
+}
+
+# define_verbose_tagvar (NAME)
+# ----------------------------
+# Engage the needed `silent-rules' machinery for tag NAME.
+sub define_verbose_tagvar ($)
+{
+ my ($name) = @_;
+ if (option 'silent-rules')
+ {
+ define_verbose_var ($name, '@echo " '. $name . ' ' x (6 - length ($name)) . '" $@;');
+ define_verbose_var ('at', '@');
+ }
+}
+
+# define_verbose_libtool
+# ----------------------
+# Engage the needed `silent-rules' machinery for `libtool --silent'.
+sub define_verbose_libtool ()
+{
+ define_verbose_var ('lt', '--silent');
+ return verbose_flag ('lt');
+}
+
+
+################################################################
+
# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
sub handle_options
}
}
+ # Override portability-recursive warning.
+ switch_warning ('no-portability-recursive')
+ if option 'silent-rules';
+
if ($strictness == GNITS)
{
set_option ('readme-alpha', INTERNAL);
(option 'no-dependencies' || $lang->autodep eq 'no')
? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx");
+ my $verbose = verbose_flag ($lang->ccer || 'GEN');
+ my $silent = silent_flag ();
+
my %transform = ('EXT' => $ext,
'PFX' => $pfx,
'FPFX' => $fpfx,
SUBDIROBJ => 0,
'DERIVED-EXT' => 'BUG',
DIST_SOURCE => 1,
+ VERBOSE => $verbose,
+ SILENT => $silent,
);
# Generate the appropriate rules for this extension.
my $ptltflags = "${derived}_LIBTOOLFLAGS";
$ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags;
+ my $ltverbose = define_verbose_libtool ();
my $obj_ltcompile =
- "\$(LIBTOOL) $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
+ "\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
. "--mode=compile $obj_compile";
# We _need_ `-o' for per object rules.
OBJOBJ => "$obj.obj",
LTOBJ => "$obj.lo",
+ VERBOSE => $verbose,
+ SILENT => $silent,
COMPILE => $obj_compile,
LTCOMPILE => $obj_ltcompile,
-o => $output_flag,
unless defined $done{$languages{'c'}};
define_linker_variable ($languages{'c'});
}
+
+ # Always provide the user with `AM_V_GEN' for `silent-rules' mode.
+ define_verbose_tagvar ('GEN');
}
{
my $obj_sans_ext = substr ($object, 0,
- length ($this_obj_ext));
- my $full_ansi = $full;
+ my $full_ansi;
+ if ($directory ne '')
+ {
+ $full_ansi = $directory . '/' . $base . $extension;
+ }
+ else
+ {
+ $full_ansi = $base . $extension;
+ }
+
if ($lang->ansi && option 'ansi2knr')
{
$full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/;
set_seen ($xname . '_LDFLAGS');
# Determine program to use for link.
- my $xlink = &define_per_target_linker_variable ($linker, $xname);
+ my($xlink, $vlink) = &define_per_target_linker_variable ($linker, $xname);
+ $vlink = verbose_flag ($vlink || 'GEN');
# If the resulting program lies into a subdirectory,
# make sure this directory will exist.
PROGRAM => $one_file,
XPROGRAM => $xname,
XLINK => $xlink,
+ VERBOSE => $vlink,
DIRSTAMP => $dirstamp,
EXEEXT => '$(EXEEXT)');
&define_variable ('AR', 'ar', INTERNAL);
&define_variable ('ARFLAGS', 'cru', INTERNAL);
+ &define_verbose_tagvar ('AR');
foreach my $pair (@liblist)
{
. "did you mean `$suggestion'?")
}
+ ($known_libraries{$onelib} = $bn) =~ s/\.a$//;
+
$where->push_context ("while processing library `$onelib'");
$where->set (INTERNAL->get);
# If the resulting library lies into a subdirectory,
# make sure this directory will exist.
my $dirstamp = require_build_directory_maybe ($onelib);
+ my $verbose = verbose_flag ('AR');
+ my $silent = silent_flag ();
$output_rules .= &file_contents ('library',
$where,
+ VERBOSE => $verbose,
+ SILENT => $silent,
LIBRARY => $onelib,
XLIBRARY => $xlib,
DIRSTAMP => $dirstamp);
. "did you mean `$suggestion'?")
}
+ ($known_libraries{$onelib} = $bn) =~ s/\.la$//;
+
$where->push_context ("while processing Libtool library `$onelib'");
$where->set (INTERNAL->get);
NONLIBTOOL => 0, LIBTOOL => 1);
# Determine program to use for link.
- my $xlink = &define_per_target_linker_variable ($linker, $xlib);
+ my($xlink, $vlink) = &define_per_target_linker_variable ($linker, $xlib);
+ $vlink = verbose_flag ($vlink || 'GEN');
my $rpathvar = "am_${xlib}_rpath";
my $rpath = "\$($rpathvar)";
XLTLIBRARY => $xlib,
RPATH => $rpath,
XLINK => $xlink,
+ VERBOSE => $vlink,
DIRSTAMP => $dirstamp);
if ($seen_libobjs)
{
{
$varname =~ /^(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
msg_var ('syntax', $var, "variable `$varname' is defined but no"
- . " program or\nlibrary has `$1' as canonic name"
+ . " program or\nlibrary has `$1' as canonical name"
. " (possible typo)")
unless $var->rdef ($cond)->seen;
}
}
-# $TEXICLEANS
+# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN)
# handle_texinfo_helper ($info_texinfos)
# --------------------------------------
# Handle all Texinfo source; helper for handle_texinfo.
my (@infobase, @info_deps_list, @texi_deps);
my %versions;
my $done = 0;
- my @texi_cleans;
+ my (@mostly_cleans, @texi_cleans, @maint_cleans) = ('', '', '');
# Build a regex matching user-cleaned files.
my $d = var 'DISTCLEANFILES';
my ($out_file, $vtexi, @clean_files) =
scan_texinfo_file ("$relative_dir/$texi")
or next;
- push (@texi_cleans, @clean_files);
+ push (@mostly_cleans, @clean_files);
# If the Texinfo source is in a subdirectory, create the
# resulting info in this subdirectory. If it is in the current
}
}
- return makefile_wrap ("", "\t ", @texi_cleans);
+ return (makefile_wrap ("", "\t ", @mostly_cleans),
+ makefile_wrap ("", "\t ", @texi_cleans),
+ makefile_wrap ("", "\t ", @maint_cleans));
}
reject_var 'html_TEXINFOS', "HTML generation not yet supported";
my $info_texinfos = var ('info_TEXINFOS');
- my $texiclean = "";
+ my ($mostlyclean, $clean, $maintclean) = ('', '', '');
if ($info_texinfos)
{
- $texiclean = handle_texinfo_helper ($info_texinfos);
+ ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
+ chomp $mostlyclean;
+ chomp $clean;
+ chomp $maintclean;
}
+
$output_rules .= file_contents ('texinfos',
new Automake::Location,
- TEXICLEAN => $texiclean,
+ MOSTLYCLEAN => $mostlyclean,
+ TEXICLEAN => $clean,
+ MAINTCLEAN => $maintclean,
'LOCAL-TEXIS' => !!$info_texinfos);
}
define_pretty_variable ('am__configure_deps', TRUE, INTERNAL,
@configuredeps);
+ my $automake_options = '--' . (global_option 'cygnus' ? 'cygnus' : $strictness_name)
+ . (global_option 'no-dependencies' ? ' --ignore-deps' : '');
+
$output_rules .= file_contents
('configure',
new Automake::Location,
'MAKEFILE-IN' => $rel_makefile_in,
'MAKEFILE-IN-DEPS' => "@include_stack",
'MAKEFILE-AM' => $rel_makefile_am,
- STRICTNESS => global_option 'cygnus'
- ? 'cygnus' : $strictness_name,
- 'USE-DEPS' => global_option 'no-dependencies'
- ? ' --ignore-deps' : '',
+ 'AUTOMAKE-OPTIONS' => $automake_options,
'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile",
- 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4);
+ 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4,
+ VERBOSE => verbose_flag ('GEN'));
if ($relative_dir eq '.')
{
{
push (@check_tests, 'check-TESTS');
$output_rules .= &file_contents ('check', new Automake::Location,
- COLOR => !! option 'color-tests');
+ COLOR => !! option 'color-tests',
+ PARALLEL_TESTS => !! option 'parallel-tests');
# Tests that are known programs should have $(EXEEXT) appended.
# For matching purposes, we need to adjust XFAIL_TESTS as well.
append_exeext { exists $known_programs{$_[0]} } 'TESTS';
append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
if (var ('XFAIL_TESTS'));
+
+ if (option 'parallel-tests')
+ {
+ define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
+ define_variable ('TEST_SUITE_HTML', '$(TEST_SUITE_LOG:.log=.html)', INTERNAL);
+ my $suff = '.test';
+ my $at_exeext = '';
+ my $handle_exeext = exists $configure_vars{'EXEEXT'};
+ if ($handle_exeext)
+ {
+ $at_exeext = subst ('EXEEXT');
+ $suff = $at_exeext . ' ' . $suff;
+ }
+ define_variable ('TEST_EXTENSIONS', $suff, INTERNAL);
+ # FIXME: this mishandles conditions.
+ my @test_suffixes = (var 'TEST_EXTENSIONS')->value_as_list_recursive;
+ if ($handle_exeext)
+ {
+ unshift (@test_suffixes, $at_exeext)
+ unless $test_suffixes[0] eq $at_exeext;
+ }
+ unshift (@test_suffixes, '');
+
+ transform_variable_recursively
+ ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL,
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+ my $obj = $val;
+ return $obj
+ if $val =~ /^\@.*\@$/;
+ $obj =~ s/\$\(EXEEXT\)$//o;
+
+ if ($val =~ /(\$\((top_)?srcdir\))\//o)
+ {
+ msg ('error', $subvar->rdef ($cond)->location,
+ "parallel-tests: using `$1' in TESTS is currently broken: `$val'");
+ }
+
+ foreach my $test_suffix (@test_suffixes)
+ {
+ next
+ if $test_suffix eq $at_exeext || $test_suffix eq '';
+ return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log'
+ if substr ($obj, - length ($test_suffix)) eq $test_suffix;
+ }
+ $obj .= '.log';
+ my $compile = 'LOG_COMPILE';
+ define_variable ($compile,
+ '$(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)', INTERNAL);
+ $output_rules .= file_contents ('check2', new Automake::Location,
+ GENERIC => 0,
+ OBJ => $obj,
+ SOURCE => $val,
+ COMPILE =>'$(' . $compile . ')',
+ EXT => '',
+ am__EXEEXT => 'FALSE');
+ return $obj;
+ });
+
+ my $nhelper=1;
+ my $prev = 'TESTS';
+ my $post = '';
+ my $last_suffix = $test_suffixes[$#test_suffixes];
+ my $cur = '';
+ foreach my $test_suffix (@test_suffixes)
+ {
+ if ($test_suffix eq $last_suffix)
+ {
+ $cur = 'TEST_LOGS';
+ }
+ else
+ {
+ $cur = 'am__test_logs' . $nhelper;
+ }
+ define_variable ($cur,
+ '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL);
+ $post = '.log';
+ $prev = $cur;
+ $nhelper++;
+ if ($test_suffix ne $at_exeext && $test_suffix ne '')
+ {
+ (my $ext = $test_suffix) =~ s/^\.//;
+ $ext = uc $ext;
+ my $compile = $ext . '_LOG_COMPILE';
+ define_variable ($compile,
+ '$(' . $ext . '_LOG_COMPILER) $(AM_' . $ext . '_LOG_FLAGS)'
+ . ' $(' . $ext . '_LOG_FLAGS)', INTERNAL);
+ my $am_exeext = $handle_exeext ? 'am__EXEEXT' : 'FALSE';
+ $output_rules .= file_contents ('check2', new Automake::Location,
+ GENERIC => 1,
+ OBJ => '',
+ SOURCE => '$<',
+ COMPILE => '$(' . $compile . ')',
+ EXT => $test_suffix,
+ am__EXEEXT => $am_exeext);
+ }
+ }
+
+ define_variable ('TEST_LOGS_TMP', '$(TEST_LOGS:.log=.log-t)', INTERNAL);
+
+ $clean_files{'$(TEST_LOGS_TMP)'} = MOSTLY_CLEAN;
+ $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
+ $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
+ $clean_files{'$(TEST_SUITE_HTML)'} = MOSTLY_CLEAN;
+ }
}
}
AM_INIT_AUTOMAKE => 0,
AM_MAINTAINER_MODE => 0,
AM_PROG_CC_C_O => 0,
+ AM_SILENT_RULES => 0,
_AM_SUBST_NOTMAKE => 1,
_AM_COND_IF => 1,
_AM_COND_ELSE => 1,
{
$seen_cc_c_o = $where;
}
+ elsif ($macro eq 'AM_SILENT_RULES')
+ {
+ set_global_option ('silent-rules', $where);
+ }
elsif ($macro eq '_AM_COND_IF')
{
cond_stack_if ('', $args[1], $where);
return LANG_IGNORE;
}
+# Rewrite a single Vala source file.
+sub lang_vala_rewrite
+{
+ my ($directory, $base, $ext) = @_;
+
+ (my $newext = $ext) =~ s/vala$/c/;
+ return (LANG_SUBDIR, $newext);
+}
+
# Rewrite a single yacc file.
sub lang_yacc_rewrite
{
}
}
+sub lang_vala_finish_target ($$)
+{
+ my ($self, $name) = @_;
+
+ my $derived = canonicalize ($name);
+ my $varname = $derived . '_SOURCES';
+ my $var = var ($varname);
+
+ if ($var)
+ {
+ foreach my $file ($var->value_as_list_recursive)
+ {
+ $output_rules .= "$file: ${derived}_vala.stamp\n".
+ "\t\@if test -f \$@; then :; else \\\n".
+ "\t rm -f ${derived}_vala.stamp; \\\n".
+ "\t \$(MAKE) \$(AM_MAKEFLAGS) ${derived}_vala.stamp; \\\n".
+ "\tfi\n"
+ if $file =~ s/(.*)\.vala$/$1.c/;
+ }
+ }
+
+ my $compile = $self->compile;
+
+ # Rewrite each occurrence of `AM_$flag' in the compile
+ # rule into `${derived}_$flag' if it exists.
+ for my $flag (@{$self->flags})
+ {
+ my $val = "${derived}_$flag";
+ $compile =~ s/\(AM_$flag\)/\($val\)/
+ if set_seen ($val);
+ }
+
+ my $dirname = dirname ($name);
+
+ # Only generate C code, do not run C compiler
+ $compile .= " -C";
+
+ my $verbose = verbose_flag ('VALAC');
+ my $silent = silent_flag ();
+
+ $output_rules .=
+ "${derived}_vala.stamp: \$(${derived}_SOURCES)\n".
+ "\t${verbose}${compile} \$(${derived}_SOURCES)\n".
+ "\t${silent}touch \$@\n";
+
+ push_dist_common ("${derived}_vala.stamp");
+
+ $clean_files{"${derived}_vala.stamp"} = MAINTAINER_CLEAN;
+}
+
+# Add output rules to invoke valac and create stamp file as a witness
+# to handle multiple outputs. This function is called after all source
+# file processing is done.
+sub lang_vala_finish
+{
+ my ($self) = @_;
+
+ foreach my $prog (keys %known_programs)
+ {
+ lang_vala_finish_target ($self, $prog);
+ }
+
+ while (my ($name) = each %known_libraries)
+ {
+ lang_vala_finish_target ($self, $name);
+ }
+}
+
+# The built .c files should be cleaned only on maintainer-clean
+# as the .c files are distributed. This function is called for each
+# .vala source file.
+sub lang_vala_target_hook
+{
+ my ($self, $aggregate, $output, $input, %transform) = @_;
+
+ $clean_files{$output} = MAINTAINER_CLEAN;
+}
+
# This is a yacc helper which is called whenever we have decided to
# compile a yacc file.
sub lang_yacc_target_hook
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
&define_variable ($var, $value, INTERNAL);
- &define_variable ("LT$var",
- "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) "
- . "\$(LIBTOOLFLAGS) --mode=compile $value",
- INTERNAL)
- if var ('LIBTOOL');
+ if (var ('LIBTOOL'))
+ {
+ my $verbose = define_verbose_libtool ();
+ &define_variable ("LT$var",
+ "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
+ . "\$(LIBTOOLFLAGS) --mode=compile $value",
+ INTERNAL);
+ }
+ define_verbose_tagvar ($lang->ccer || 'GEN');
}
# CCLD = $(CC).
&define_variable ($lang->lder, $lang->ld, INTERNAL);
# CCLINK = $(CCLD) blah blah...
- &define_variable ($lang->linker,
- ((var ('LIBTOOL') ?
- "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) "
- . "\$(LIBTOOLFLAGS) --mode=link " : '')
- . $lang->link),
- INTERNAL);
+ my $link = '';
+ if (var ('LIBTOOL'))
+ {
+ my $verbose = define_verbose_libtool ();
+ $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
+ . "\$(LIBTOOLFLAGS) --mode=link ";
+ }
+ &define_variable ($lang->linker, $link . $lang->link, INTERNAL);
+ &define_variable ($lang->compiler, $lang);
+ &define_verbose_tagvar ($lang->lder || 'GEN');
}
sub define_per_target_linker_variable ($$)
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
+ my $verbose = define_verbose_libtool ();
$link_command =
- "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) "
+ "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) "
. "--mode=link " . $link_command;
}
# If the computed command is the same as the generic command, use
# the command linker variable.
- return $lang->linker
+ return ($lang->linker, $lang->lder)
if $link_command eq $orig_command;
&define_variable ("${target}_LINK", $link_command, INTERNAL);
- return "${target}_LINK";
+ return ("${target}_LINK", $lang->lder);
}
################################################################
'f|force-missing' => \$force_missing,
'o|output-dir=s' => \$output_directory,
'a|add-missing' => \$add_missing,
- 'c|copy' => \$copy_missing,
+ 'c|copy' => \$copy_missing,
'v|verbose' => sub { setup_channel 'verb', silent => 0; },
'W|warnings=s' => \&parse_warnings,
# These long options (--Werror and --Wno-error) for backward