summaryrefslogtreecommitdiff
path: root/bin/automake.in
diff options
context:
space:
mode:
Diffstat (limited to 'bin/automake.in')
-rw-r--r--bin/automake.in2323
1 files changed, 556 insertions, 1767 deletions
diff --git a/bin/automake.in b/bin/automake.in
index c06fc0fa4..d699ec6ee 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -37,16 +37,6 @@ BEGIN
}
use Automake::Config;
-BEGIN
-{
- if ($perl_threads)
- {
- require threads;
- import threads;
- require Thread::Queue;
- import Thread::Queue;
- }
-}
use Automake::General;
use Automake::XFile;
use Automake::Channels;
@@ -136,24 +126,50 @@ use constant MAINTAINER_CLEAN => 3;
# Libtool files.
my @libtool_files = qw(ltmain.sh config.guess config.sub);
-# ltconfig appears here for compatibility with old versions of libtool.
-my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh);
# Commonly found files we look for and automatically include in
-# DISTFILES.
-my @common_files =
- (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB
- COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO
- ar-lib compile config.guess config.rpath
- config.sub depcomp install-sh libversion.in mdate-sh
- missing mkinstalldirs py-compile texinfo.tex ylwrap),
- @libtool_files, @libtool_sometimes);
+# distributed files.
+my @common_files = (
+ qw(
+ ABOUT-GNU
+ ABOUT-NLS
+ AUTHORS
+ COPYING
+ COPYING.DOC
+ COPYING.LIB
+ COPYING.LESSER
+ ChangeLog
+ INSTALL
+ NEWS
+ README
+ THANKS
+ TODO
+ ar-lib
+ compile
+ config.guess
+ config.rpath
+ config.sub
+ depcomp
+ install-sh
+ libversion.in
+ mdate-sh
+ missing
+ py-compile
+ texinfo.tex
+ ylwrap
+ ),
+ @libtool_files,
+);
# Commonly used files we auto-include, but only sometimes. This list
# is used for the --help output only.
my @common_sometimes =
- qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure
- configure.ac stamp-vti);
+ qw(
+ aclocal.m4
+ configure
+ configure.ac
+ stamp-vti
+ );
# Standard directories from the GNU Coding Standards, and additional
# pkg* directories from Automake. Stored in a hash for fast member check.
@@ -187,11 +203,6 @@ use constant COMPILE_ORDINARY => 2;
# when it's defined by Automake. We use INTERNAL in this case.
use constant INTERNAL => new Automake::Location;
-# Serialization keys for message queues.
-use constant QUEUE_MESSAGE => "msg";
-use constant QUEUE_CONF_FILE => "conf file";
-use constant QUEUE_LOCATION => "location";
-use constant QUEUE_STRING => "string";
## ---------------------------------- ##
## Variables related to the options. ##
@@ -281,9 +292,6 @@ my $libtool_new_api = 0;
# Most important AC_CANONICAL_* macro seen so far.
my $seen_canonical = 0;
-# Where AM_MAINTAINER_MODE appears.
-my $seen_maint_mode;
-
# Actual version we've seen.
my $package_version = '';
@@ -323,7 +331,7 @@ my %configure_cond = ();
# This maps extensions onto language names.
my %extension_map = ();
-# List of the DIST_COMMON files we discovered while reading
+# List of the distributed files we discovered while reading
# configure.ac.
my @configure_dist_common = ();
@@ -373,9 +381,6 @@ my %required_targets =
'install-man' => 1,
);
-# Queue to push require_conf_file requirements to.
-my $required_conf_file_queue;
-
# The name of the Makefile currently being processed.
my $am_file = 'BUG';
@@ -395,8 +400,7 @@ my $output_deps_greatest_timestamp;
# These variables are used when generating each Makefile.in.
# They hold the Makefile.in until it is ready to be printed.
my $output_vars;
-my $output_all;
-my $output_header;
+my $output_verbatim;
my $output_rules;
my $output_trailer;
@@ -410,22 +414,11 @@ my @include_stack;
# List of dependencies for the obvious targets.
my @all;
my @check;
-my @check_tests;
-
-# Keys in this hash table are files to delete. The associated
-# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.)
-my %clean_files;
-# Keys in this hash table are object files or other files in
-# subdirectories which need to be removed. This only holds files
-# which are created by compilations. The value in the hash indicates
-# when the file should be removed.
-my %compile_clean_files;
-
-# Keys in this hash table are directories where we expect to build a
-# libtool object. We use this information to decide what directories
-# to delete.
-my %libtool_clean_directories;
+# Keys in this hash table are files and directories to delete. The
+# associated value tells when this should happen (MOSTLY_CLEAN,
+# DIST_CLEAN, etc).
+my (%clean_files, %clean_dirs);
# Value of $(SOURCES), used by tags.am.
my @sources;
@@ -442,23 +435,17 @@ my %object_map;
# libtool compilation (the COMPILE_* constants).
my %object_compilation_map;
-
-# This keeps track of the directories for which we've already
-# created dirstamp code. Keys are directories, values are stamp files.
-# Several keys can share the same stamp files if they are equivalent
-# (as are './/foo' and 'foo').
-my %directory_map;
-
# All .P files.
my %dep_files;
# This is a list of all targets to run during "make dist".
my @dist_targets;
-# Keep track of all programs declared in this Makefile, without
-# $(EXEEXT). @substitutions@ are not listed.
+# Keep track of all programs and libraries declared in this Makefile,
+# without $(EXEEXT). @substitutions@ are not listed.
my %known_programs;
my %known_libraries;
+my %known_ltlibraries;
# This keeps track of which extensions we've seen (that we care
# about).
@@ -472,8 +459,8 @@ my %language_scratch;
# handling on a per-language basis.
my %lang_specific_files;
-# List of distributed files to be put in DIST_COMMON.
-my @dist_common;
+# List of the "auto-discovered" distributed files.
+my @dist_common = ();
# This is set when 'handle_dist' has finished. Once this happens,
# we should no longer push on dist_common.
@@ -507,24 +494,6 @@ my %am_file_cache;
################################################################
-# var_SUFFIXES_trigger ($TYPE, $VALUE)
-# ------------------------------------
-# This is called by Automake::Variable::define() when SUFFIXES
-# is defined ($TYPE eq '') or appended ($TYPE eq '+').
-# The work here needs to be performed as a side-effect of the
-# macro_define() call because SUFFIXES definitions impact
-# on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing
-# the input am file.
-sub var_SUFFIXES_trigger
-{
- my ($type, $value) = @_;
- accept_extensions (split (' ', $value));
-}
-Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
-
-################################################################
-
-
# initialize_per_input ()
# -----------------------
# (Re)-Initialize per-Makefile.am variables.
@@ -537,8 +506,7 @@ sub initialize_per_input ()
$output_deps_greatest_timestamp = 0;
$output_vars = '';
- $output_all = '';
- $output_header = '';
+ $output_verbatim = '';
$output_rules = '';
$output_trailer = '';
@@ -552,13 +520,9 @@ sub initialize_per_input ()
@all = ();
@check = ();
- @check_tests = ();
%clean_files = ();
- %compile_clean_files = ();
-
- # We always include '.'. This isn't strictly correct.
- %libtool_clean_directories = ('.' => 1);
+ %clean_dirs = ();
@sources = ();
@dist_sources = ();
@@ -566,8 +530,6 @@ sub initialize_per_input ()
%object_map = ();
%object_compilation_map = ();
- %directory_map = ();
-
%dep_files = ();
@dist_targets = ();
@@ -577,6 +539,7 @@ sub initialize_per_input ()
%known_programs = ();
%known_libraries = ();
+ %known_ltlibraries = ();
%extension_seen = ();
@@ -599,8 +562,7 @@ sub initialize_per_input ()
my @cpplike_flags =
qw{
$(DEFS)
- $(DEFAULT_INCLUDES)
- $(INCLUDES)
+ $(AM_DEFAULT_INCLUDES)
$(AM_CPPFLAGS)
$(CPPFLAGS)
};
@@ -725,7 +687,7 @@ register_language ('name' => 'yacc',
'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/;
return ($ext,) },
'rule_file' => 'yacc',
- '_finish' => \&lang_yacc_finish,
+ '_finish' => \&lang_yacc_lex_finish,
'_target_hook' => \&lang_yacc_target_hook,
'nodist_specific' => 1);
register_language ('name' => 'yaccxx',
@@ -739,7 +701,7 @@ register_language ('name' => 'yaccxx',
'extensions' => ['.y++', '.yy', '.yxx', '.ypp'],
'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/;
return ($ext,) },
- '_finish' => \&lang_yacc_finish,
+ '_finish' => \&lang_yacc_lex_finish,
'_target_hook' => \&lang_yacc_target_hook,
'nodist_specific' => 1);
@@ -755,7 +717,7 @@ register_language ('name' => 'lex',
'extensions' => ['.l'],
'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
return ($ext,) },
- '_finish' => \&lang_lex_finish,
+ '_finish' => \&lang_yacc_lex_finish,
'_target_hook' => \&lang_lex_target_hook,
'nodist_specific' => 1);
register_language ('name' => 'lexxx',
@@ -769,7 +731,7 @@ register_language ('name' => 'lexxx',
'extensions' => ['.l++', '.ll', '.lxx', '.lpp'],
'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
return ($ext,) },
- '_finish' => \&lang_lex_finish,
+ '_finish' => \&lang_yacc_lex_finish,
'_target_hook' => \&lang_lex_target_hook,
'nodist_specific' => 1);
@@ -779,9 +741,9 @@ register_language ('name' => 'asm',
'config_vars' => ['CCAS', 'CCASFLAGS'],
'flags' => ['CCASFLAGS'],
- # Users can set AM_CCASFLAGS to include $(DEFS),
- # $(INCLUDES), or anything else required. They can also
- # set CCAS. Or simply use Preprocessed Assembler.
+ # Users can set AM_CCASFLAGS to include, say, $(DEFS),
+ # or anything else required. They can also set CCAS.
+ # Or simply use Preprocessed Assembler.
'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)',
'ccer' => 'CCAS',
'compiler' => 'CCASCOMPILE',
@@ -850,11 +812,11 @@ register_language ('name' => 'ppfc',
# Preprocessed Fortran 77
#
# The current support for preprocessing Fortran 77 just involves
-# passing "$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
-# $(CPPFLAGS)" as additional flags to the Fortran 77 compiler, since
-# this is how GNU Make does it; see the "GNU Make Manual, Edition 0.51
-# for 'make' Version 3.76 Beta" (specifically, from info file
-# '(make)Catalogue of Rules').
+# passing "$(DEFS) $(AM_DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)"
+# as additional flags to the Fortran 77 compiler, since this is how
+# GNU Make does it; see the "GNU Make Manual, Edition 0.51 for 'make'
+# Version 3.76 Beta" (specifically, from info file '(make)Catalogue
+# of Rules').
#
# A better approach would be to write an Autoconf test
# (i.e. AC_PROG_FPP) for a Fortran 77 preprocessor, because not all
@@ -1005,15 +967,6 @@ sub verbose_var
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-IF-SILENT, [VAL-IF-VERBOSE])
# ----------------------------------------------------------
# For silent rules, setup VAR and dispatcher, to expand to
@@ -1024,22 +977,13 @@ sub define_verbose_var
my ($name, $silent_val, $verbose_val) = @_;
$verbose_val = '' unless defined $verbose_val;
my $var = verbose_var ($name);
- my $pvar = verbose_private_var ($name);
- my $silent_var = $pvar . '_0';
- my $verbose_var = $pvar . '_1';
- # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V)
- # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY).
- # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead.
- # See AM_SILENT_RULES in m4/silent.m4.
- define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
- define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)',
- INTERNAL);
- Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE,
- $silent_val, '', INTERNAL, VAR_ASIS)
- if (! vardef ($silent_var, TRUE));
- Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE,
- $verbose_val, '', INTERNAL, VAR_ASIS)
- if (! vardef ($verbose_var, TRUE));
+ define_variable ($var, INTERNAL, "\$($var/\$V)");
+ Automake::Variable::define ("$var/0", VAR_AUTOMAKE, '', TRUE,
+ $silent_val, '', INTERNAL)
+ if (! vardef ("$var/0", TRUE));
+ Automake::Variable::define ("$var/1", VAR_AUTOMAKE, '', TRUE,
+ $verbose_val, '', INTERNAL)
+ if (! vardef ("$var/1", TRUE));
}
# verbose_flag (NAME)
@@ -1082,8 +1026,8 @@ sub define_verbose_texinfo ()
{
define_verbose_tagvar($tag);
}
- define_verbose_var('texinfo', '-q');
- define_verbose_var('texidevnull', '> /dev/null');
+ define_verbose_var('TEXI_QUIETOPTS', '-q');
+ define_verbose_var('TEXI_DEVNULL_REDIRECT', '> /dev/null');
}
# Engage the needed silent rules machinery for 'libtool --silent'.
@@ -1153,7 +1097,7 @@ sub shadow_unconditionally
{
$varname = "am__${varname}_DIST";
my @files = uniq ($var->value_as_list_recursive);
- define_pretty_variable ($varname, TRUE, $where, @files);
+ define_variable ($varname, $where, @files);
}
return "\$($varname)"
}
@@ -1194,10 +1138,8 @@ sub handle_languages ()
if (keys %extension_seen && keys %dep_files)
{
# Set location of depcomp.
- define_variable ('depcomp',
- "\$(SHELL) $am_config_aux_dir/depcomp",
- INTERNAL);
- define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
+ define_variable ('depcomp', INTERNAL,
+ '$(SHELL) $(am.conf.aux-dir)/depcomp');
require_conf_file ("$am_file.am", FOREIGN, 'depcomp');
@@ -1207,28 +1149,16 @@ sub handle_languages ()
# variable expansion; generating many separate includes
# seems safest.
$output_rules .= "\n";
- foreach my $iter (@deplist)
+ foreach my $depfile (@deplist)
{
- $output_rules .= (subst ('AMDEP_TRUE')
- . subst ('am__include')
- . ' '
- . subst ('am__quote')
- . $iter
- . subst ('am__quote')
- . "\n");
+ $output_rules .= subst ('AMDEP_TRUE') . "-include $depfile\n";
+ $clean_dirs{dirname ($depfile)} = DIST_CLEAN;
}
-
- # Compute the set of directories to remove in distclean-depend.
- my @depdirs = uniq (map { dirname ($_) } @deplist);
- $output_rules .= file_contents ('depend',
- new Automake::Location,
- DEPDIRS => "@depdirs");
}
}
else
{
- define_variable ('depcomp', '', INTERNAL);
- define_variable ('am__depfiles_maybe', '', INTERNAL);
+ define_variable ('depcomp', INTERNAL, '');
}
my %done;
@@ -1254,7 +1184,6 @@ sub handle_languages ()
my $verbose = verbose_flag ($lang->ccer || 'GEN');
my $verbose_nodep = ($AMDEP eq 'FALSE')
? $verbose : verbose_nodep_flag ($lang->ccer || 'GEN');
- my $silent = silent_flag ();
my %transform = ('EXT' => $ext,
'PFX' => $pfx,
@@ -1267,7 +1196,6 @@ sub handle_languages ()
DIST_SOURCE => 1,
VERBOSE => $verbose,
'VERBOSE-NODEP' => $verbose_nodep,
- SILENT => $silent,
);
# Generate the appropriate rules for this extension.
@@ -1278,13 +1206,6 @@ sub handle_languages ()
# This is not used by depend2.am.
my $der_ext = ($lang->output_extensions->($ext))[0];
- # Even when subdir sources are present, an inference rule
- # like '.c.o:' can be used to build corresponding objects
- # in the sane subdirectory too. We should be careful to also
- # place dependency files into the appropriate subdirectory,
- # e.g., 'sub/$(DEPDIR)/'. The value of this directory needs
- # to be computed on-the-fly (that is done by our makefile
- # recipes in 'depend2.am').
$output_rules .=
file_contents ($rule_file,
new Automake::Location,
@@ -1295,10 +1216,8 @@ sub handle_languages ()
BASE => '$*',
SOURCE => '$<',
- XSOURCE => '$<',
SOURCEFLAG => $sourceflags{$ext} || '',
OBJ => '$@',
- OBJOBJ => '$@',
LTOBJ => '$@',
COMPILE => '$(' . $lang->compiler . ')',
@@ -1347,9 +1266,6 @@ sub handle_languages ()
"\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
. "--mode=compile $obj_compile";
- # For non-suffix rules, we must emulate a VPATH search.
- my $xsource = "`test -f '$source' || echo '\$(srcdir)/'`$source";
-
$output_rules .=
file_contents ($rule_file,
new Automake::Location,
@@ -1358,18 +1274,15 @@ sub handle_languages ()
BASE => $obj,
SOURCE => $source,
- XSOURCE => $xsource,
SOURCEFLAG => $sourceflags{$srcext} || '',
# Use $myext and not '.o' here, in case
# we are actually building a new source
# file -- e.g. via yacc.
OBJ => "$obj$myext",
- OBJOBJ => "$obj.obj",
LTOBJ => "$obj.lo",
VERBOSE => $verbose,
'VERBOSE-NODEP' => $verbose_nodep,
- SILENT => $silent,
COMPILE => $obj_compile,
LTCOMPILE => $obj_ltcompile,
%file_transform);
@@ -1415,14 +1328,8 @@ sub handle_languages ()
check_user_variables @dont_override;
}
- # If the project is entirely C++ or entirely Fortran 77 (i.e., 1
- # suffix rule was learned), don't bother with the C stuff. But if
- # anything else creeps in, then use it.
- my @languages_seen = map { $languages{$extension_map{$_}}->name }
- (keys %extension_seen);
- @languages_seen = uniq (@languages_seen);
- $needs_c = 1 if @languages_seen > 1;
- if ($need_link || $needs_c)
+ # Non-pure languages, or languages lacking a linker of their own.
+ if ($needs_c || $need_link)
{
define_compiler_variable ($languages{'c'})
unless defined $done{$languages{'c'}};
@@ -1534,7 +1441,9 @@ sub handle_single_transform
}
# Split file name into base and extension.
- next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/;
+ next if ! /^(?:(.*)\/)?([^\/]*?)(\.[^.]+)$/;
+ prog_error ("source file '$_' missing dotted extension")
+ unless defined $2 and defined $3;
my $full = $_;
my $directory = $1 || '';
my $base = $2;
@@ -1555,7 +1464,6 @@ sub handle_single_transform
# language function.
my $aggregate = 'AM';
- $extension = derive_suffix ($extension, $obj);
my $lang;
if ($extension_map{$extension} &&
($lang = $languages{$extension_map{$extension}}))
@@ -1652,24 +1560,6 @@ sub handle_single_transform
# If both source and object files are in a subdirectory
# then the inference will work.
#
- # The latter case deserves a historical note. When the
- # subdir-objects option was added on 1999-04-11 it was
- # thought that inferences rules would work for
- # subdirectory objects too. Later, on 1999-11-22,
- # automake was changed to output explicit rules even for
- # subdir-objects. Nobody remembers why, but this occurred
- # soon after the merge of the user-dep-gen-branch so it
- # might be related. In late 2003 people complained about
- # the size of the generated Makefile.ins (libgcj, with
- # 2200+ subdir objects was reported to have a 9MB
- # Makefile), so we now rely on inference rules again.
- # Maybe we'll run across the same issue as in the past,
- # but at least this time we can document it. However since
- # dependency tracking has evolved it is possible that
- # our old problem no longer exists.
- # Using inference rules for subdir-objects has been tested
- # with GNU make, Solaris make, Ultrix make, BSD make,
- # HP-UX make, and OSF1 make successfully.
if ($renamed
# We must also use specific rules for a nodist_ source
# if its language requests it.
@@ -1718,24 +1608,20 @@ sub handle_single_transform
[@specifics, %transform]);
}
}
- elsif ($extension eq $obj)
+ else
{
+ # Assume the user has defined a proper explicit or pattern
+ # rule to turn a source file with this extension in an object
+ # file with the same basename and a '.$(OBJEXT)' extension (if
+ # build as part of a program or static library) or a '.lo'
+ # extension (if built as part of a libtool library).
+ $extension = $obj;
# This is probably the result of a direct suffix rule.
# In this case we just accept the rewrite.
$object = "$base$extension";
$object = "$directory/$object" if $directory ne '';
$linker = '';
}
- else
- {
- # No error message here. Used to have one, but it was
- # very unpopular.
- # FIXME: we could potentially do more processing here,
- # perhaps treating the new extension as though it were a
- # new source extension (as above). This would require
- # more restructuring than is appropriate right now.
- next;
- }
# FIXME: this is likely an internal error now that we use
# FIXME: subdir-objects unconditionally ...
@@ -1780,77 +1666,44 @@ sub handle_single_transform
$linkers_used{$linker} = 1;
push (@result, $object);
+ $directory = '.' if $directory eq '';
if (! defined $object_map{$object})
- {
- my @dep_list = ();
+ {
$object_map{$object} = $full;
- # If resulting object is in subdir, we need to make
- # sure the subdir exists at build time.
- if ($object =~ /\//)
- {
- # FIXME: check that $DIRECTORY is somewhere in the
- # project
-
- # For Java, the way we're handling it right now, a
- # '..' component doesn't make sense.
- if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//)
- {
- err_am "'$full' should not contain a '..' component";
- }
-
- # Make sure *all* objects files in the subdirectory are
- # removed by "make mostlyclean". Not only this is more
- # efficient than listing the object files to be removed
- # individually (which would cause an 'rm' invocation for
- # each of them -- very inefficient, see bug#10697), it
- # would also leave stale object files in the subdirectory
- # whenever a source file there is removed or renamed.
- $compile_clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN;
- if ($object =~ /\.lo$/)
- {
- # If we have a libtool object, then we also must remove
- # any '.lo' objects in its same subdirectory.
- $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN;
- # Remember to cleanup .libs/ in this directory.
- $libtool_clean_directories{$directory} = 1;
- }
-
- push (@dep_list, require_build_directory ($directory));
-
- # If we're generating dependencies, we also want
- # to make sure that the appropriate subdir of the
- # .deps directory is created.
- push (@dep_list,
- require_build_directory ($directory . '/$(DEPDIR)'))
- unless option 'no-dependencies';
- }
-
- pretty_print_rule ($object . ':', "\t", @dep_list)
- if scalar @dep_list > 0;
- }
+ # For Java, the way we're handling it right now, a
+ # '..' component doesn't make sense.
+ err_am "'$full' should not contain a '..' component"
+ if $lang && $lang->name eq 'java' && $object =~ m{(/|^)\.\./};
+
+ # Make sure *all* object files in this object's subdirectory
+ # are removed by "make mostlyclean". Not only this is more
+ # efficient than listing the object files to be removed
+ # individually (which would cause an 'rm' invocation for each
+ # of them -- very inefficient, see bug#10697), it would also
+ # leave stale object files in the subdirectory whenever a
+ # source file there is removed or renamed.
+ $clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN;
+ if ($object =~ /\.lo$/)
+ {
+ # If we have a libtool object, then we also must remove
+ # any '.lo' objects in the same subdirectory.
+ $clean_files{"$directory/*.lo"} = MOSTLY_CLEAN;
+ $clean_dirs{"$directory/.libs"} = CLEAN;
+ }
+ }
# Transform .o or $o file into .P file (for automatic
# dependency code).
- # Properly flatten multiple adjacent slashes, as Solaris 10 make
- # might fail over them in an include statement.
- # Leading double slashes may be special, as per Posix, so deal
- # with them carefully.
if ($lang && $lang->autodep ne 'no')
- {
+ {
my $depfile = $object;
$depfile =~ s/\.([^.]*)$/.P$1/;
$depfile =~ s/\$\(OBJEXT\)$/o/;
- my $maybe_extra_leading_slash = '';
- $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],;
- $depfile =~ s,/+,/,g;
- my $basename = basename ($depfile);
- # This might make $dirname empty, but we account for that below.
- (my $dirname = dirname ($depfile)) =~ s/\/*$//;
- $dirname = $maybe_extra_leading_slash . $dirname;
- $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1;
- }
+ $dep_files{dirname ($depfile) . '/$(DEPDIR)/'
+ . basename ($depfile)} = 1;
+ }
}
return @result;
@@ -1963,41 +1816,12 @@ sub handle_source_transform
my @keys = sort keys %used_pfx;
if (scalar @keys == 0)
{
- # The default source for libfoo.la is libfoo.c, but for
- # backward compatibility we first look at libfoo_la.c,
- # if no default source suffix is given.
- my $old_default_source = "$one_file.c";
my $ext_var = var ('AM_DEFAULT_SOURCE_EXT');
my $default_source_ext = $ext_var ? variable_value ($ext_var) : '.c';
msg_var ('unsupported', $ext_var, $ext_var->name . " can assume at most one value")
if $default_source_ext =~ /[\t ]/;
(my $default_source = $unxformed) =~ s,(\.[^./\\]*)?$,$default_source_ext,;
- # TODO: Remove this backward-compatibility hack in Automake 2.0.
- if ($old_default_source ne $default_source
- && !$ext_var
- && (rule $old_default_source
- || rule '$(srcdir)/' . $old_default_source
- || rule '${srcdir}/' . $old_default_source
- || -f $old_default_source))
- {
- my $loc = $where->clone;
- $loc->pop_context;
- msg ('obsolete', $loc,
- "the default source for '$unxformed' has been changed "
- . "to '$default_source'.\n(Using '$old_default_source' for "
- . "backward compatibility.)");
- $default_source = $old_default_source;
- }
- # If a rule exists to build this source with a $(srcdir)
- # prefix, use that prefix in our variables too. This is for
- # the sake of BSD Make.
- if (rule '$(srcdir)/' . $default_source
- || rule '${srcdir}/' . $default_source)
- {
- $default_source = '$(srcdir)/' . $default_source;
- }
-
- define_variable ($one_file . "_SOURCES", $default_source, $where);
+ define_variable ($one_file . "_SOURCES", $where, $default_source);
push (@sources, $default_source);
push (@dist_sources, $default_source);
@@ -2008,12 +1832,12 @@ sub handle_source_transform
$one_file, $obj,
$default_source, %transform);
$linker ||= resolve_linker (%linkers_used);
- define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result);
+ define_variable ($one_file . '_OBJECTS', $where, @result);
}
else
{
@keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys;
- define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys);
+ define_variable ($one_file . '_OBJECTS', $where, @keys);
}
# If we want to use 'LINK' we must make sure it is defined.
@@ -2118,9 +1942,7 @@ sub handle_LIBOBJS_or_ALLOCA
my $dir = '';
# If LIBOBJS files must be built in another directory we have
- # to define LIBOBJDIR and ensure the files get cleaned.
- # Otherwise LIBOBJDIR can be left undefined, and the cleaning
- # is achieved by 'rm -f *.$(OBJEXT)' in compile.am.
+ # to define the 'LIBOBJDIR' make variable.
if ($config_libobj_dir && $relative_dir ne $config_libobj_dir)
{
# In the top-level Makefile we do not use $(top_builddir), because
@@ -2131,13 +1953,13 @@ sub handle_LIBOBJS_or_ALLOCA
if $config_libobj_dir ne '.';
$dir = backname ($relative_dir) . "/$dir"
if $relative_dir ne '.';
- define_variable ('LIBOBJDIR', "$dir", INTERNAL);
- $clean_files{"\$($var)"} = MOSTLY_CLEAN;
- # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
- # be created by libtool as a side-effect of creating LTLIBOBJS).
- $clean_files{"\$($var)"} = MOSTLY_CLEAN if $var =~ s/^LT//;
+ define_variable ('LIBOBJDIR', INTERNAL, $dir);
}
+ $clean_files{'$(LIBOBJDIR)*.$(OBJEXT)'} = MOSTLY_CLEAN;
+ $clean_files{'$(LIBOBJDIR)*.lo'} = MOSTLY_CLEAN
+ if $var =~ /^LT/;
+
return $dir;
}
@@ -2223,55 +2045,10 @@ sub check_canonical_spelling
# Set up the compile suite.
sub handle_compile ()
{
- return if ! $must_handle_compiled_objects;
-
- # Boilerplate.
- my $default_includes = '';
- if (! option 'nostdinc')
- {
- my @incs = ('-I.', subst ('am__isrc'));
-
- my $var = var 'CONFIG_HEADER';
- if ($var)
- {
- foreach my $hdr (split (' ', $var->variable_value))
- {
- push @incs, '-I' . dirname ($hdr);
- }
- }
- # We want '-I. -I$(srcdir)', but the latter -I is redundant
- # and unaesthetic in non-VPATH builds. We use `-I.@am__isrc@`
- # instead. It will be replaced by '-I.' or '-I. -I$(srcdir)'.
- # Items in CONFIG_HEADER are never in $(srcdir) so it is safe
- # to just put @am__isrc@ right after '-I.', without a space.
- ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/;
- }
-
- my (@mostly_rms, @dist_rms);
- foreach my $item (sort keys %compile_clean_files)
- {
- if ($compile_clean_files{$item} == MOSTLY_CLEAN)
- {
- push (@mostly_rms, "\t-rm -f $item");
- }
- elsif ($compile_clean_files{$item} == DIST_CLEAN)
- {
- push (@dist_rms, "\t-rm -f $item");
- }
- else
- {
- prog_error 'invalid entry in %compile_clean_files';
- }
- }
-
- my ($coms, $vars, $rules) =
- file_contents_internal (1, "$libdir/am/compile.am",
- new Automake::Location,
- 'DEFAULT_INCLUDES' => $default_includes,
- 'MOSTLYRMS' => join ("\n", @mostly_rms),
- 'DISTRMS' => join ("\n", @dist_rms));
- $output_vars .= $vars;
- $output_rules .= "$coms$rules";
+ return if ! $must_handle_compiled_objects;
+ $output_rules .= file_contents ('compile',
+ new Automake::Location,
+ 'STDINC' => ! option 'nostdinc');
}
# Handle libtool rules.
@@ -2285,20 +2062,13 @@ sub handle_libtool ()
require_conf_file_with_macro (TRUE, 'LIBTOOL', FOREIGN, @libtool_files)
if $relative_dir eq '.' && ! $libtool_new_api;
- my @libtool_rms;
- foreach my $item (sort keys %libtool_clean_directories)
- {
- my $dir = ($item eq '.') ? '' : "$item/";
- # .libs is for Unix, _libs for DOS.
- push (@libtool_rms, "\t-rm -rf ${dir}.libs");
- }
-
check_user_variables 'LIBTOOLFLAGS';
- # Output the libtool compilation rules.
- $output_rules .= file_contents ('libtool',
- new Automake::Location,
- LTRMS => join ("\n", @libtool_rms));
+ if ($relative_dir eq '.')
+ {
+ $clean_files{"libtool"} = DIST_CLEAN;
+ $clean_files{"config.lt"} = DIST_CLEAN;
+ }
}
@@ -2340,7 +2110,7 @@ sub handle_programs ()
else
{
# User didn't define prog_LDADD override. So do it.
- define_variable ($xname . '_LDADD', '$(LDADD)', $where);
+ define_variable ($xname . '_LDADD', $where, '$(LDADD)');
# This does a bit too much work. But we need it to
# generate _DEPENDENCIES when appropriate.
@@ -2353,28 +2123,21 @@ sub handle_programs ()
reject_var ($xname . '_LIBADD',
"use '${xname}_LDADD', not '${xname}_LIBADD'");
- set_seen ($xname . '_DEPENDENCIES');
- set_seen ('EXTRA_' . $xname . '_DEPENDENCIES');
set_seen ($xname . '_LDFLAGS');
# Determine program to use for link.
my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname);
$vlink = verbose_flag ($vlink || 'GEN');
- # If the resulting program lies in a subdirectory,
- # ensure that the directory exists before we need it.
- my $dirstamp = require_build_directory_maybe ($one_file);
-
- $libtool_clean_directories{dirname ($one_file)} = 1;
+ $clean_dirs{dirname ($one_file) . '/.libs'} = CLEAN;
$output_rules .= file_contents ('program',
- $where,
- PROGRAM => $one_file,
- XPROGRAM => $xname,
- XLINK => $xlink,
- VERBOSE => $vlink,
- DIRSTAMP => $dirstamp,
- EXEEXT => '$(EXEEXT)');
+ $where,
+ PROGRAM => $one_file,
+ XPROGRAM => $xname,
+ XLINK => $xlink,
+ VERBOSE => $vlink,
+ EXEEXT => '$(EXEEXT)');
if ($seen_libobjs || $seen_global_libobjs)
{
@@ -2407,8 +2170,8 @@ sub handle_libraries ()
$var->requires_variables ('library used', 'RANLIB');
}
- define_variable ('AR', 'ar', INTERNAL);
- define_variable ('ARFLAGS', 'cru', INTERNAL);
+ define_variable ('AR', INTERNAL, 'ar');
+ define_variable ('ARFLAGS', INTERNAL, 'cru');
define_verbose_tagvar ('AR');
foreach my $pair (@liblist)
@@ -2442,7 +2205,7 @@ sub handle_libraries ()
if (! var ($xlib . '_AR'))
{
- define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
+ define_variable ($xlib . '_AR', $where, '$(AR) $(ARFLAGS)');
}
# Generate support for conditional object inclusion in
@@ -2456,32 +2219,22 @@ sub handle_libraries ()
}
else
{
- define_variable ($xlib . "_LIBADD", '', $where);
+ define_variable ($xlib . "_LIBADD", $where, '');
}
reject_var ($xlib . '_LDADD',
"use '${xlib}_LIBADD', not '${xlib}_LDADD'");
- # Make sure we at look at this.
- set_seen ($xlib . '_DEPENDENCIES');
- set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
-
handle_source_transform ($xlib, $onelib, $obj, $where,
NONLIBTOOL => 1, LIBTOOL => 0);
- # If the resulting library lies in 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);
+ XLIBRARY => $xlib);
if ($seen_libobjs)
{
@@ -2641,15 +2394,13 @@ sub handle_ltlibraries ()
. "did you mean '$suggestion'?")
}
- ($known_libraries{$onelib} = $bn) =~ s/\.la$//;
+ ($known_ltlibraries{$onelib} = $bn) =~ s/\.la$//;
$where->push_context ("while processing Libtool library '$onelib'");
$where->set (INTERNAL->get);
- # Make sure we look at these.
+ # Make sure we look at this.
set_seen ($xlib . '_LDFLAGS');
- set_seen ($xlib . '_DEPENDENCIES');
- set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
# Generate support for conditional object inclusion in
# libraries.
@@ -2662,7 +2413,7 @@ sub handle_ltlibraries ()
}
else
{
- define_variable ($xlib . "_LIBADD", '', $where);
+ define_variable ($xlib . "_LIBADD", $where, '');
}
reject_var ("${xlib}_LDADD",
@@ -2706,17 +2457,11 @@ sub handle_ltlibraries ()
}
else
{
- define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val);
+ define_cond_variable ($rpathvar, $rcond, INTERNAL, $val);
}
}
- # If the resulting library lies in a subdirectory,
- # make sure this directory will exist.
- my $dirstamp = require_build_directory_maybe ($onelib);
-
- # Remember to cleanup .libs/ in this directory.
- my $dirname = dirname $onelib;
- $libtool_clean_directories{$dirname} = 1;
+ $clean_dirs{dirname ($onelib) . '/.libs'} = CLEAN;
$output_rules .= file_contents ('ltlibrary',
$where,
@@ -2724,8 +2469,7 @@ sub handle_ltlibraries ()
XLTLIBRARY => $xlib,
RPATH => $rpath,
XLINK => $xlink,
- VERBOSE => $vlink,
- DIRSTAMP => $dirstamp);
+ VERBOSE => $vlink);
if ($seen_libobjs)
{
if (var ($xlib . '_LIBADD'))
@@ -2743,32 +2487,6 @@ sub handle_ltlibraries ()
}
}
-# See if any _SOURCES variable were misspelled.
-sub check_typos ()
-{
- # It is ok if the user sets this particular variable.
- set_seen 'AM_LDFLAGS';
-
- foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES')
- {
- foreach my $var (variables $primary)
- {
- my $varname = $var->name;
- # A configure variable is always legitimate.
- next if exists $configure_vars{$varname};
-
- for my $cond ($var->conditions->conds)
- {
- $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
- msg_var ('syntax', $var, "variable '$varname' is defined but no"
- . " program or\nlibrary has '$1' as canonical name"
- . " (possible typo)")
- unless $var->rdef ($cond)->seen;
- }
- }
- }
-}
-
sub handle_scripts ()
{
@@ -2808,12 +2526,7 @@ sub scan_texinfo_file
next if $outfile;
$outfile = $1;
- if (index ($outfile, '.') < 0)
- {
- msg 'obsolete', "$filename:$.",
- "use of suffix-less info files is discouraged"
- }
- elsif ($outfile !~ /\.info$/)
+ if ($outfile !~ /\.info$/)
{
error ("$filename:$.",
"output '$outfile' has unrecognized extension");
@@ -2837,106 +2550,6 @@ sub scan_texinfo_file
return ($outfile, $vfile);
}
-
-# ($DIRSTAMP, @CLEAN_FILES)
-# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES)
-# ------------------------------------------------------------------
-# SOURCE - the source Texinfo file
-# DEST - the destination Info file
-# INSRC - whether DEST should be built in the source tree
-# DEPENDENCIES - known dependencies
-sub output_texinfo_build_rules
-{
- my ($source, $dest, $insrc, @deps) = @_;
-
- # Split 'a.texi' into 'a' and '.texi'.
- my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/);
- my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/);
-
- $ssfx ||= "";
- $dsfx ||= "";
-
- # We can output two kinds of rules: the "generic" rules use Make
- # suffix rules and are appropriate when $source and $dest do not lie
- # in a sub-directory; the "specific" rules are needed in the other
- # case.
- #
- # The former are output only once (this is not really apparent here,
- # but just remember that some logic deeper in Automake will not
- # output the same rule twice); while the later need to be output for
- # each Texinfo source.
- my $generic;
- my $makeinfoflags;
- my $sdir = dirname $source;
- if ($sdir eq '.' && dirname ($dest) eq '.')
- {
- $generic = 1;
- $makeinfoflags = '-I $(srcdir)';
- }
- else
- {
- $generic = 0;
- $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir";
- }
-
- # A directory can contain two kinds of info files: some built in the
- # source tree, and some built in the build tree. The rules are
- # different in each case. However we cannot output two different
- # set of generic rules. Because in-source builds are more usual, we
- # use generic rules in this case and fall back to "specific" rules
- # for build-dir builds. (It should not be a problem to invert this
- # if needed.)
- $generic = 0 unless $insrc;
-
- # We cannot use a suffix rule to build info files with an empty
- # extension. Otherwise we would output a single suffix inference
- # rule, with separate dependencies, as in
- #
- # .texi:
- # $(MAKEINFO) ...
- # foo.info: foo.texi
- #
- # which confuse Solaris make. (See the Autoconf manual for
- # details.) Therefore we use a specific rule in this case. This
- # applies to info files only (dvi and pdf files always have an
- # extension).
- my $generic_info = ($generic && $dsfx) ? 1 : 0;
-
- # If the resulting file lies in a subdirectory,
- # make sure this directory will exist.
- my $dirstamp = require_build_directory_maybe ($dest);
-
- my $dipfx = ($insrc ? '$(srcdir)/' : '') . $dpfx;
-
- $output_rules .= file_contents ('texibuild',
- new Automake::Location,
- AM_V_MAKEINFO => verbose_flag('MAKEINFO'),
- AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'),
- AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'),
- DEPS => "@deps",
- DEST_PREFIX => $dpfx,
- DEST_INFO_PREFIX => $dipfx,
- DEST_SUFFIX => $dsfx,
- DIRSTAMP => $dirstamp,
- GENERIC => $generic,
- GENERIC_INFO => $generic_info,
- INSRC => $insrc,
- MAKEINFOFLAGS => $makeinfoflags,
- SILENT => silent_flag(),
- SOURCE => ($generic
- ? '$<' : $source),
- SOURCE_INFO => ($generic_info
- ? '$<' : $source),
- SOURCE_REAL => $source,
- SOURCE_SUFFIX => $ssfx,
- TEXIQUIET => verbose_flag('texinfo'),
- TEXIDEVNULL => verbose_flag('texidevnull'),
- );
- return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html");
-}
-
-
-# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN)
# handle_texinfo_helper ($info_texinfos)
# --------------------------------------
# Handle all Texinfo source; helper for 'handle_texinfo'.
@@ -2946,7 +2559,6 @@ sub handle_texinfo_helper
my (@infobase, @info_deps_list, @texi_deps);
my %versions;
my $done = 0;
- my (@mostly_cleans, @texi_cleans, @maint_cleans) = ('', '', '');
# Build a regex matching user-cleaned files.
my $d = var 'DISTCLEANFILES';
@@ -2961,18 +2573,9 @@ sub handle_texinfo_helper
($info_texinfos->value_as_list_recursive (inner_expand => 1))
{
my $infobase = $texi;
- if ($infobase =~ s/\.texi$//)
+ # Strip tailing '.texi' suffix, complain if it's not there.
+ if ($infobase !~ s/\.texi$//)
{
- 1; # Nothing more to do.
- }
- elsif ($infobase =~ s/\.(txi|texinfo)$//)
- {
- msg_var 'obsolete', $info_texinfos,
- "suffix '.$1' for Texinfo files is discouraged;" .
- " use '.texi' instead";
- }
- else
- {
# FIXME: report line number.
err_am "texinfo file '$texi' has unrecognized extension";
next;
@@ -2987,8 +2590,8 @@ sub handle_texinfo_helper
or next;
# Directory of auxiliary files and build by-products used by texi2dvi
# and texi2pdf.
- push @mostly_cleans, "$infobase.t2d";
- push @mostly_cleans, "$infobase.t2p";
+ $clean_dirs{"$infobase.t2d"} = MOSTLY_CLEAN;
+ $clean_dirs{"$infobase.t2p"} = MOSTLY_CLEAN;
# If the Texinfo source is in a subdirectory, create the
# resulting info in this subdirectory. If it is in the current
@@ -3142,11 +2745,23 @@ EOF
push_dist_common ('$(' . $canonical . '_TEXINFOS)');
}
- my ($dirstamp, @cfiles) =
- output_texinfo_build_rules ($texi, $out_file, $insrc, @texi_deps);
- push (@texi_cleans, @cfiles);
+ (my $dpfx = $out_file) =~ s/\.info$//;
+ $output_rules .= file_contents ('texi-spec',
+ new Automake::Location,
+ DEPS => "@texi_deps",
+ DEST_PREFIX => $dpfx,
+ INSRC => $insrc,
+ SOURCE_REAL => $texi,
+ );
+
+ $clean_files{"$dpfx.dvi"} = CLEAN;
+ $clean_files{"$dpfx.pdf"} = CLEAN;
+ $clean_files{"$dpfx.ps"} = CLEAN;
+ # Add to %clean_dirs, not $clean_files, because this will be a
+ # directory (unless '--no-split' is used in MAKEINFOFLAGS).
+ $clean_dirs{"$dpfx.html"} = CLEAN;
- push (@info_deps_list, $out_file);
+ push @info_deps_list, $out_file;
# If a vers*.texi file is needed, emit the rule.
if ($vtexi)
@@ -3162,35 +2777,14 @@ EOF
my $vti = ($done ? $done : 'vti');
++$done;
- # This is ugly, but it is our historical practice.
- if ($config_aux_dir_set_in_configure_ac)
- {
- require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN,
- 'mdate-sh');
- }
- else
- {
- require_file_with_macro (TRUE, 'info_TEXINFOS',
- FOREIGN, 'mdate-sh');
- }
-
- my $conf_dir;
- if ($config_aux_dir_set_in_configure_ac)
- {
- $conf_dir = "$am_config_aux_dir/";
- }
- else
- {
- $conf_dir = '$(srcdir)/';
- }
+ require_conf_file_with_macro (TRUE, 'info_TEXINFOS',
+ FOREIGN, 'mdate-sh');
$output_rules .= file_contents ('texi-vers',
new Automake::Location,
TEXI => $texi,
VTI => $vti,
STAMPVTI => "${soutdir}stamp-$vti",
- VTEXI => "$soutdir$vtexi",
- MDDIR => $conf_dir,
- DIRSTAMP => $dirstamp);
+ VTEXI => "${soutdir}${vtexi}");
}
}
@@ -3206,8 +2800,8 @@ EOF
}
elsif ($config_aux_dir_set_in_configure_ac)
{
- $texinfodir = $am_config_aux_dir;
- define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL);
+ $texinfodir = '$(am.conf.aux-dir)';
+ define_variable ('TEXINFO_TEX', INTERNAL, "$texinfodir/texinfo.tex");
$need_texi_file = 2; # so that we require_conf_file later
}
else
@@ -3215,7 +2809,7 @@ EOF
$texinfodir = '$(srcdir)';
$need_texi_file = 1;
}
- define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL);
+ define_variable ('am__TEXINFO_TEX_DIR', INTERNAL, $texinfodir);
push (@dist_targets, 'dist-info');
@@ -3235,7 +2829,7 @@ EOF
# This next isn't strictly needed now -- the places that look here
# could easily be changed to look in info_TEXINFOS. But this is
# probably better, in case noinst_TEXINFOS is ever supported.
- define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL);
+ define_variable ("TEXINFOS", INTERNAL, variable_value ('info_TEXINFOS'));
# Do some error checking. Note that this file is not required
# when in Cygnus mode; instead we defined TEXINFO_TEX explicitly
@@ -3253,10 +2847,6 @@ EOF
'texinfo.tex');
}
}
-
- return (makefile_wrap ("", "\t ", @mostly_cleans),
- makefile_wrap ("", "\t ", @texi_cleans),
- makefile_wrap ("", "\t ", @maint_cleans));
}
@@ -3266,25 +2856,13 @@ sub handle_texinfo ()
# FIXME: I think this is an obsolete future feature name.
reject_var 'html_TEXINFOS', "HTML generation not yet supported";
- my $info_texinfos = var ('info_TEXINFOS');
- my ($mostlyclean, $clean, $maintclean) = ('', '', '');
- if ($info_texinfos)
+ if (my $info_texinfos = var ('info_TEXINFOS'))
{
define_verbose_texinfo;
- ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
- chomp $mostlyclean;
- chomp $clean;
- chomp $maintclean;
+ verbatim ('texibuild');
+ handle_texinfo_helper ($info_texinfos);
}
-
- $output_rules .= file_contents ('texinfos',
- new Automake::Location,
- AM_V_DVIPS => verbose_flag('DVIPS'),
- MOSTLYCLEAN => $mostlyclean,
- TEXICLEAN => $clean,
- MAINTCLEAN => $maintclean,
- 'LOCAL-TEXIS' => !!$info_texinfos,
- TEXIQUIET => verbose_flag('texinfo'));
+ verbatim ('texinfos');
}
@@ -3435,49 +3013,6 @@ sub handle_data ()
'pkgdata', 'lisp', 'noinst', 'check');
}
-
-sub handle_tags ()
-{
- my @config;
- foreach my $spec (@config_headers)
- {
- my ($out, @ins) = split_config_file_spec ($spec);
- foreach my $in (@ins)
- {
- # If the config header source is in this directory,
- # require it.
- push @config, basename ($in)
- if $relative_dir eq dirname ($in);
- }
- }
-
- define_variable ('am__tagged_files',
- '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)'
- . "@config", INTERNAL);
-
- if (rvar('am__tagged_files')->value_as_list_recursive
- || var ('ETAGS_ARGS') || var ('SUBDIRS'))
- {
- $output_rules .= file_contents ('tags', new Automake::Location);
- set_seen 'TAGS_DEPENDENCIES';
- }
- else
- {
- reject_var ('TAGS_DEPENDENCIES',
- "it doesn't make sense to define 'TAGS_DEPENDENCIES'"
- . " without\nsources or 'ETAGS_ARGS'");
- # Every Makefile must define some sort of TAGS rule.
- # Otherwise, it would be possible for a top-level "make TAGS"
- # to fail because some subdirectory failed. Ditto ctags and
- # cscope.
- $output_rules .=
- "tags TAGS:\n\n" .
- "ctags CTAGS:\n\n" .
- "cscope cscopelist:\n\n";
- }
-}
-
-
# user_phony_rule ($NAME)
# -----------------------
# Return false if rule $NAME does not exist. Otherwise,
@@ -3506,9 +3041,6 @@ sub user_phony_rule
# Handle 'dist' target.
sub handle_dist ()
{
- # Substitutions for distdir.am
- my %transform;
-
# Define DIST_SUBDIRS. This must always be done, regardless of the
# no-dist setting: target like 'distclean' or 'maintainer-clean' use it.
my $subdirs = var ('SUBDIRS');
@@ -3530,34 +3062,20 @@ sub handle_dist ()
}
elsif ($subdirs->has_conditional_contents)
{
- define_pretty_variable
- ('DIST_SUBDIRS', TRUE, INTERNAL,
- uniq ($subdirs->value_as_list_recursive));
+ define_variable ('DIST_SUBDIRS', INTERNAL,
+ uniq ($subdirs->value_as_list_recursive));
}
else
{
# We always define this because that is what 'distclean'
# wants.
- define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL,
- '$(SUBDIRS)');
+ define_variable ('DIST_SUBDIRS', INTERNAL, '$(SUBDIRS)');
}
}
# The remaining definitions are only required when a dist target is used.
return if option 'no-dist';
- # At least one of the archive formats must be enabled.
- if ($relative_dir eq '.')
- {
- my $archive_defined = option 'no-dist-gzip' ? 0 : 1;
- $archive_defined ||=
- grep { option "dist-$_" } qw(zip bzip2 lzip xz);
- error (option 'no-dist-gzip',
- "no-dist-gzip specified but no dist-* specified,\n"
- . "at least one archive format must be enabled")
- unless $archive_defined;
- }
-
# Look for common files that should be included in distribution.
# If the aux dir is set, and it does not have a Makefile.am, then
# we check for these files there as well.
@@ -3593,10 +3111,10 @@ sub handle_dist ()
# check that. But if the file is in a subdir without a Makefile,
# we want to distribute it here if we are doing '.'. Ugly!
# Also, in some corner cases, it's possible that the following code
- # will cause the same file to appear in the $(DIST_COMMON) variables
- # of two distinct Makefiles; but this is not a problem, since the
- # 'distdir' target in 'lib/am/distdir.am' can deal with the same
- # file being distributed multiple times.
+ # will cause the same file to appear in the $(am.dist.common-files)
+ # variables of two distinct Makefiles; but this is not a problem,
+ # since the 'distdir' target in 'lib/am/distdir.am' can deal with
+ # the same file being distributed multiple times.
# See also automake bug#9651.
if ($relative_dir eq '.')
{
@@ -3609,35 +3127,29 @@ sub handle_dist ()
@configure_dist_common = ();
}
- # $(am__DIST_COMMON): files to be distributed automatically. Will be
- # appended to $(DIST_COMMON) in the generated Makefile.
- # Use 'sort' so that the expansion of $(DIST_COMMON) in the generated
- # Makefile is deterministic, in face of m4 and/or perl randomizations
- # (see automake bug#17908).
- define_pretty_variable ('am__DIST_COMMON', TRUE, INTERNAL,
- uniq (sort @dist_common));
-
- # Now that we've processed @dist_common, disallow further attempts
- # to modify it.
+ # We don't expected further attempts to modify @dist_common
+ # after this point, so disallow it, for extra safety.
$handle_dist_run = 1;
- $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook';
- $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external;
+ define_variable ('am.dist.handle-distcheck-hook', INTERNAL,
+ rule ('distcheck-hook') ? 'yes' : '');
+ define_variable ('am.dist.handle-gettext', INTERNAL,
+ $seen_gettext && !$seen_gettext_external ? 'yes' : '');
+
+ my $flm = option 'filename-length-max';
+ define_variable ('am.dist.filename-filter', INTERNAL,
+ $flm ? ('.' x $flm->[1]) : '');
# If the target 'dist-hook' exists, make sure it is run. This
# allows users to do random weird things to the distribution
# before it is packaged up.
push (@dist_targets, 'dist-hook')
if user_phony_rule 'dist-hook';
- $transform{'DIST-TARGETS'} = join (' ', @dist_targets);
-
- my $flm = option ('filename-length-max');
- my $filename_filter = $flm ? '.' x $flm->[1] : '';
+ define_variable ('am.dist.extra-targets', INTERNAL, @dist_targets);
+ define_variable ('am.dist.common-files.internal', INTERNAL, @dist_common);
- $output_rules .= file_contents ('distdir',
- new Automake::Location,
- %transform,
- FILENAME_FILTER => $filename_filter);
+ verbatim ('distdir');
+ verbatim ('distcheck') if $relative_dir eq '.';
}
@@ -3653,26 +3165,6 @@ sub check_directory
error $where, "required directory $reldir/$dir does not exist"
unless -d "$reldir/$dir";
- # If an 'obj/' directory exists, BSD make will enter it before
- # reading 'Makefile'. Hence the 'Makefile' in the current directory
- # will not be read.
- #
- # % cat Makefile
- # all:
- # echo Hello
- # % cat obj/Makefile
- # all:
- # echo World
- # % make # GNU make
- # echo Hello
- # Hello
- # % pmake # BSD make
- # echo World
- # World
- msg ('portability', $where,
- "naming a subdirectory 'obj' causes troubles with BSD make")
- if $dir eq 'obj';
-
# 'aux' is probably the most important of the following forbidden name,
# since it's tempting to use it as an AC_CONFIG_AUX_DIR.
msg ('portability', $where,
@@ -3710,25 +3202,23 @@ sub handle_subdirs ()
check_directories_in_var $dsubdirs
if $dsubdirs;
- $output_rules .= file_contents ('subdirs', new Automake::Location);
- rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
+ verbatim ('subdirs');
}
-# ($REGEN, @DEPENDENCIES)
-# scan_aclocal_m4
-# ---------------
-# If aclocal.m4 creation is automated, return the list of its dependencies.
+# $REGEN
+# scan_aclocal_m4()
+# ----------------
+# If aclocal.m4 creation is automated, return "aclocal.m4",
+# otherwise return 0.
sub scan_aclocal_m4 ()
{
my $regen_aclocal = 0;
- set_seen 'CONFIG_STATUS_DEPENDENCIES';
- set_seen 'CONFIGURE_DEPENDENCIES';
-
if (-f 'aclocal.m4')
{
- define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
+ define_variable ("am.remake.aclocal-m4", INTERNAL,
+ '$(top_srcdir)/aclocal.m4');
my $aclocal = new Automake::XFile "< aclocal.m4";
my $line = $aclocal->getline;
@@ -3837,33 +3327,92 @@ sub rewrite_inputs_into_dependencies
return @res;
}
+sub handle_config_headers ()
+{
+ my (@config_h_local, @config_h_nonlocal, @config_hin_local);
+ my $hdr_index = 0;
+ foreach my $spec (@config_headers)
+ {
+ $hdr_index += 1;
+ # $CONFIG_H_PATH: config.h from top level.
+ my ($config_h_path, @ins) = split_config_file_spec ($spec);
+ my $config_h_dir = dirname ($config_h_path);
+ my ($stamp_dir, $cn_sans_dir) = ('', undef);
+ if ($relative_dir eq $config_h_dir)
+ {
+ $cn_sans_dir = basename ($config_h_path);
+ push @config_h_local, $cn_sans_dir;
+ }
+ else
+ {
+ $cn_sans_dir = $config_h_path;
+ $stamp_dir = $config_h_dir . '/' if $config_h_dir ne '.';
+ push @config_h_nonlocal, "\$(top_builddir)/$config_h_path";
+ }
-# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
-# -----------------------------------------------------------------
+ foreach my $in (@ins)
+ {
+ push @config_hin_local, '$(srcdir)/' . basename ($in)
+ if $relative_dir eq dirname ($in);
+ }
+
+ # If the header is in the current directory we want to build
+ # the header here. Otherwise, if we're at the topmost
+ # directory and the header's directory doesn't have a
+ # Makefile, then we also want to build the header.
+ next unless ($relative_dir eq $config_h_dir or
+ $relative_dir eq '.' && ! is_make_dir ($config_h_dir));
+
+ # This will also distribute all inputs.
+ @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins);
+
+ # Cannot define rebuild rules for filenames with shell variables.
+ next if (substitute_ac_subst_variables $config_h_path) =~ /\$/;
+
+ my $stamp = "${stamp_dir}stamp-h${hdr_index}";
+ $output_rules .=
+ file_contents ('remake-hdr',
+ new Automake::Location,
+ 'FIRST-HDR' => ($hdr_index == 1),
+ CONFIG_H => $cn_sans_dir,
+ CONFIG_HIN => $ins[0],
+ CONFIG_H_DEPS => "@ins",
+ CONFIG_H_PATH => $config_h_path,
+ STAMP => $stamp);
+
+ $clean_files{$cn_sans_dir} = DIST_CLEAN;
+ $clean_files{$stamp} = DIST_CLEAN;
+ }
+
+ define_variable ('am.config-hdr.local', INTERNAL, @config_h_local);
+ define_variable ('am.config-hdr.non-local', INTERNAL, @config_h_nonlocal);
+ define_variable ('am.config-hdr.local.in', INTERNAL, @config_hin_local);
+ define_variable ('AM_CONFIG_HEADERS', INTERNAL,
+ qw/$(am.config-hdr.local) $(am.config-hdr.non-local)/);
+}
+
+# handle_configure ($MAKEFILE, @INPUTS)
+# -------------------------------------
# Handle remaking and configure stuff.
# We need the name of the input file, to do proper remaking rules.
sub handle_configure
{
- my ($makefile_am, $makefile_in, $makefile, @inputs) = @_;
+ my ($makefile, @inputs) = @_;
prog_error 'empty @inputs'
unless @inputs;
- my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am,
- $makefile_in);
- my $rel_makefile = basename $makefile;
-
my $colon_infile = ':' . join (':', @inputs);
$colon_infile = '' if $colon_infile eq ":$makefile.in";
my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs);
my $regen_aclocal_m4 = scan_aclocal_m4;
- define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL,
- @configure_deps, "\$(top_srcdir)/$configure_ac");
- my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)');
- push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4';
- define_pretty_variable ('am__configure_deps', TRUE, INTERNAL,
- @configuredeps);
+ define_variable ('am.remake.aclocal-m4-deps', INTERNAL,
+ @configure_deps, "\$(top_srcdir)/$configure_ac");
+ my @configuredeps = ('$(am.remake.aclocal-m4-deps)',
+ '$(CONFIGURE_DEPENDENCIES)');
+ push @configuredeps, '$(am.remake.aclocal-m4)' if -f 'aclocal.m4';
+ define_variable ('am.remake.configure-deps', INTERNAL, @configuredeps);
my $automake_options = '--' . $strictness_name .
(global_option 'no-dependencies' ? ' --ignore-deps' : '');
@@ -3871,150 +3420,15 @@ sub handle_configure
$output_rules .= file_contents
('configure',
new Automake::Location,
- MAKEFILE => $rel_makefile,
'MAKEFILE-DEPS' => "@rewritten",
'CONFIG-MAKEFILE' => ($relative_dir eq '.') ? '$@' : '$(subdir)/$@',
- 'MAKEFILE-IN' => $rel_makefile_in,
'HAVE-MAKEFILE-IN-DEPS' => (@include_stack > 0),
'MAKEFILE-IN-DEPS' => "@include_stack",
- 'MAKEFILE-AM' => $rel_makefile_am,
'AUTOMAKE-OPTIONS' => $automake_options,
'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile",
'REGEN-ACLOCAL-M4' => $regen_aclocal_m4,
VERBOSE => verbose_flag ('GEN'));
- if ($relative_dir eq '.')
- {
- push_dist_common ('acconfig.h')
- if -f 'acconfig.h';
- }
-
- # If we have a configure header, require it.
- my $hdr_index = 0;
- my @distclean_config;
- foreach my $spec (@config_headers)
- {
- $hdr_index += 1;
- # $CONFIG_H_PATH: config.h from top level.
- my ($config_h_path, @ins) = split_config_file_spec ($spec);
- my $config_h_dir = dirname ($config_h_path);
-
- # If the header is in the current directory we want to build
- # the header here. Otherwise, if we're at the topmost
- # directory and the header's directory doesn't have a
- # Makefile, then we also want to build the header.
- if ($relative_dir eq $config_h_dir
- || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir)))
- {
- my ($cn_sans_dir, $stamp_dir);
- if ($relative_dir eq $config_h_dir)
- {
- $cn_sans_dir = basename ($config_h_path);
- $stamp_dir = '';
- }
- else
- {
- $cn_sans_dir = $config_h_path;
- if ($config_h_dir eq '.')
- {
- $stamp_dir = '';
- }
- else
- {
- $stamp_dir = $config_h_dir . '/';
- }
- }
-
- # This will also distribute all inputs.
- @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins);
-
- # Cannot define rebuild rules for filenames with shell variables.
- next if (substitute_ac_subst_variables $config_h_path) =~ /\$/;
-
- # Header defined in this directory.
- my @files;
- if (-f $config_h_path . '.top')
- {
- push (@files, "$cn_sans_dir.top");
- }
- if (-f $config_h_path . '.bot')
- {
- push (@files, "$cn_sans_dir.bot");
- }
-
- push_dist_common (@files);
-
- # For now, acconfig.h can only appear in the top srcdir.
- if (-f 'acconfig.h')
- {
- push (@files, '$(top_srcdir)/acconfig.h');
- }
-
- my $stamp = "${stamp_dir}stamp-h${hdr_index}";
- $output_rules .=
- file_contents ('remake-hdr',
- new Automake::Location,
- FILES => "@files",
- 'FIRST-HDR' => ($hdr_index == 1),
- CONFIG_H => $cn_sans_dir,
- CONFIG_HIN => $ins[0],
- CONFIG_H_DEPS => "@ins",
- CONFIG_H_PATH => $config_h_path,
- STAMP => "$stamp");
-
- push @distclean_config, $cn_sans_dir, $stamp;
- }
- }
-
- $output_rules .= file_contents ('clean-hdr',
- new Automake::Location,
- FILES => "@distclean_config")
- if @distclean_config;
-
- # Distribute and define mkinstalldirs only if it is already present
- # in the package, for backward compatibility (some people may still
- # use $(mkinstalldirs)).
- # TODO: start warning about this in Automake 1.14, and have
- # TODO: Automake 2.0 drop it (and the mkinstalldirs script
- # TODO: as well).
- my $mkidpath = "$config_aux_dir/mkinstalldirs";
- if (-f $mkidpath)
- {
- # Use require_file so that any existing script gets updated
- # by --force-missing.
- require_conf_file ($mkidpath, FOREIGN, 'mkinstalldirs');
- define_variable ('mkinstalldirs',
- "\$(SHELL) $am_config_aux_dir/mkinstalldirs", INTERNAL);
- }
- else
- {
- # Use $(install_sh), not $(MKDIR_P) because the latter requires
- # at least one argument, and $(mkinstalldirs) used to work
- # even without arguments (e.g. $(mkinstalldirs) $(conditional_dir)).
- define_variable ('mkinstalldirs', '$(install_sh) -d', INTERNAL);
- }
-
- reject_var ('CONFIG_HEADER',
- "'CONFIG_HEADER' is an anachronism; now determined "
- . "automatically\nfrom '$configure_ac'");
-
- my @config_h;
- foreach my $spec (@config_headers)
- {
- my ($out, @ins) = split_config_file_spec ($spec);
- # Generate CONFIG_HEADER define.
- if ($relative_dir eq dirname ($out))
- {
- push @config_h, basename ($out);
- }
- else
- {
- push @config_h, "\$(top_builddir)/$out";
- }
- }
- define_variable ("CONFIG_HEADER", "@config_h", INTERNAL)
- if @config_h;
-
# Now look for other files in this directory which must be remade
# by config.status, and generate rules for them.
my @actual_other_files = ();
@@ -4145,10 +3559,10 @@ sub handle_configure
}
# These files get removed by "make distclean".
- define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL,
- @actual_other_files);
- define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL,
- @actual_other_vpath_files);
+ define_variable ('CONFIG_CLEAN_FILES', INTERNAL,
+ @actual_other_files);
+ define_variable ('CONFIG_CLEAN_VPATH_FILES',INTERNAL,
+ @actual_other_vpath_files);
}
sub handle_headers ()
@@ -4222,125 +3636,19 @@ sub handle_gettext ()
# Emit makefile footer.
sub handle_footer ()
{
- reject_rule ('.SUFFIXES',
- "use variable 'SUFFIXES', not target '.SUFFIXES'");
-
- # Note: AIX 4.1 /bin/make will fail if any suffix rule appears
- # before .SUFFIXES. So we make sure that .SUFFIXES appears before
- # anything else, by sticking it right after the default: target.
- $output_header .= ".SUFFIXES:\n";
- my $suffixes = var 'SUFFIXES';
- my @suffixes = Automake::Rule::suffixes;
- if (@suffixes || $suffixes)
- {
- # Make sure SUFFIXES has unique elements. Sort them to ensure
- # the output remains consistent. However, $(SUFFIXES) is
- # always at the start of the list, unsorted. This is done
- # because make will choose rules depending on the ordering of
- # suffixes, and this lets the user have some control. Push
- # actual suffixes, and not $(SUFFIXES). Some versions of make
- # do not like variable substitutions on the .SUFFIXES line.
- my @user_suffixes = ($suffixes
- ? $suffixes->value_as_list_recursive : ());
-
- my %suffixes = map { $_ => 1 } @suffixes;
- delete @suffixes{@user_suffixes};
-
- $output_header .= (".SUFFIXES: "
- . join (' ', @user_suffixes, sort keys %suffixes)
- . "\n");
- }
-
- $output_trailer .= file_contents ('footer', new Automake::Location);
-}
-
-
-# Generate 'make install' rules.
-sub handle_install ()
-{
- $output_rules .= file_contents
- ('install',
- new Automake::Location,
- maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
- ? (" \$(BUILT_SOURCES)\n"
- . "\t\$(MAKE) \$(AM_MAKEFLAGS)")
- : ''),
- 'installdirs-local' => (user_phony_rule ('installdirs-local')
- ? ' installdirs-local' : ''),
- am__installdirs => variable_value ('am__installdirs') || '');
-}
-
-
-# handle_all ($MAKEFILE)
-#-----------------------
-# Deal with 'all' and 'all-am'.
-sub handle_all
-{
- my ($makefile) = @_;
-
- # Output 'all-am'.
-
- # Put this at the beginning for the sake of non-GNU makes. This
- # is still wrong if these makes can run parallel jobs. But it is
- # right enough.
- unshift (@all, basename ($makefile));
-
- foreach my $spec (@config_headers)
- {
- my ($out, @ins) = split_config_file_spec ($spec);
- push (@all, basename ($out))
- if dirname ($out) eq $relative_dir;
- }
-
- # Install 'all' hooks.
- push (@all, "all-local")
- if user_phony_rule "all-local";
-
- pretty_print_rule ("all-am:", "\t\t", @all);
- depend ('.PHONY', 'all-am', 'all');
-
-
- # Output 'all'.
-
- my @local_headers = ();
- push @local_headers, '$(BUILT_SOURCES)'
- if var ('BUILT_SOURCES');
- foreach my $spec (@config_headers)
- {
- my ($out, @ins) = split_config_file_spec ($spec);
- push @local_headers, basename ($out)
- if dirname ($out) eq $relative_dir;
- }
-
- if (@local_headers)
- {
- # We need to make sure config.h is built before we recurse.
- # We also want to make sure that built sources are built
- # before any ordinary 'all' targets are run. We can't do this
- # by changing the order of dependencies to the "all" because
- # that breaks when using parallel makes. Instead we handle
- # things explicitly.
- $output_all .= ("all: @local_headers"
- . "\n\t"
- . '$(MAKE) $(AM_MAKEFLAGS) '
- . (var ('SUBDIRS') ? 'all-recursive' : 'all-am')
- . "\n\n");
- depend ('.MAKE', 'all');
- }
- else
- {
- $output_all .= "all: " . (var ('SUBDIRS')
- ? 'all-recursive' : 'all-am') . "\n\n";
- }
+ # FIXME: maybe display a warning if the obsolescent $(SUFFIXES)
+ # FIXME: variable is used? Currently, we don't do that, to preserve
+ # FIXME: better compatibility with mainline Automake.
+ $output_trailer .= file_contents ('footer', new Automake::Location);
}
-# Generate helper targets for user-defined recursive targets, where needed.
+# Generate helper targets for user recursion, where needed.
sub handle_user_recursion ()
{
return unless @extra_recursive_targets;
- define_pretty_variable ('am__extra_recursive_targets', TRUE, INTERNAL,
- map { "$_-recursive" } @extra_recursive_targets);
+ define_variable ('am.recurs.extra-targets', INTERNAL,
+ map { "$_-recursive" } @extra_recursive_targets);
my $aux = var ('SUBDIRS') ? 'recursive' : 'am';
foreach my $target (@extra_recursive_targets)
{
@@ -4360,91 +3668,29 @@ sub handle_user_recursion ()
}
}
-
-# Handle check merge target specially.
-sub do_check_merge_target ()
+sub handle_clean ()
{
- # Include user-defined local form of target.
- push @check_tests, 'check-local'
- if user_phony_rule 'check-local';
+ my (%f, %d);
- # The check target must depend on the local equivalent of
- # 'all', to ensure all the primary targets are built. Then it
- # must build the local check rules.
- $output_rules .= "check-am: all-am\n";
- if (@check)
- {
- pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check);
- depend ('.MAKE', 'check-am');
- }
-
- if (@check_tests)
- {
- pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
- @check_tests);
- depend ('.MAKE', 'check-am');
- }
-
- depend '.PHONY', 'check', 'check-am';
- # Handle recursion. We have to honor BUILT_SOURCES like for 'all:'.
- $output_rules .= ("check: "
- . (var ('BUILT_SOURCES')
- ? "\$(BUILT_SOURCES)\n\t\$(MAKE) \$(AM_MAKEFLAGS) "
- : '')
- . (var ('SUBDIRS') ? 'check-recursive' : 'check-am')
- . "\n");
- depend ('.MAKE', 'check')
- if var ('BUILT_SOURCES');
-}
-
-# Handle all 'clean' targets.
-sub handle_clean
-{
- my ($makefile) = @_;
+ my @fkeys = keys %clean_files;
+ $f{mostly} = [ grep { $clean_files{$_} == MOSTLY_CLEAN } @fkeys ];
+ $f{normal} = [ grep { $clean_files{$_} == CLEAN } @fkeys ];
+ $f{dist} = [ grep { $clean_files{$_} == DIST_CLEAN } @fkeys ];
+ $f{maint} = [ grep { $clean_files{$_} == MAINTAINER_CLEAN } @fkeys ];
- # Clean the files listed in user variables if they exist.
- $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN
- if var ('MOSTLYCLEANFILES');
- $clean_files{'$(CLEANFILES)'} = CLEAN
- if var ('CLEANFILES');
- $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN
- if var ('DISTCLEANFILES');
- $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN
- if var ('MAINTAINERCLEANFILES');
+ my @dkeys = keys %clean_dirs;
+ $d{mostly} = [ grep { $clean_dirs{$_} == MOSTLY_CLEAN } @dkeys ];
+ $d{normal} = [ grep { $clean_dirs{$_} == CLEAN } @dkeys ];
+ $d{dist} = [ grep { $clean_dirs{$_} == DIST_CLEAN } @dkeys ];
+ $d{maint} = [ grep { $clean_dirs{$_} == MAINTAINER_CLEAN } @dkeys ];
- # Built sources are automatically removed by maintainer-clean.
- $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN
- if var ('BUILT_SOURCES');
-
- # Compute a list of "rm"s to run for each target.
- my %rms = (MOSTLY_CLEAN, [],
- CLEAN, [],
- DIST_CLEAN, [],
- MAINTAINER_CLEAN, []);
-
- foreach my $file (keys %clean_files)
+ foreach my $kind (qw/mostly normal dist maint/)
{
- my $when = $clean_files{$file};
- prog_error 'invalid entry in %clean_files'
- unless exists $rms{$when};
-
- my $rm = "rm -f $file";
- # If file is a variable, make sure when don't call 'rm -f' without args.
- $rm ="test -z \"$file\" || $rm"
- if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/);
-
- push @{$rms{$when}}, "\t-$rm\n";
+ define_variable ("am.clean.$kind.f.auto", INTERNAL, @{$f{$kind}});
+ define_variable ("am.clean.$kind.d.auto", INTERNAL, @{$d{$kind}});
}
- $output_rules .= file_contents
- ('clean',
- new Automake::Location,
- MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}),
- CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}),
- DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}),
- MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}),
- MAKEFILE => basename $makefile,
- );
+ verbatim ('clean');
}
@@ -4506,10 +3752,9 @@ sub handle_factored_dependencies ()
{
if (user_phony_rule "$_-hook")
{
- depend ('.MAKE', "$_-am");
register_action("$_-am",
("\t\@\$(NORMAL_INSTALL)\n"
- . "\t\$(MAKE) \$(AM_MAKEFLAGS) $_-hook"));
+ . "\t\$(MAKE) $_-hook"));
}
}
@@ -4532,9 +3777,9 @@ sub handle_factored_dependencies ()
# to append dependencies. This would not work if Automake
# refrained from defining its own .PHONY target as it does
# with other overridden targets.
- # Likewise for '.MAKE' and '.PRECIOUS'.
+ # Likewise for '.PRECIOUS'.
my @undefined_conds = (TRUE,);
- if ($_ ne '.PHONY' && $_ ne '.MAKE' && $_ ne '.PRECIOUS')
+ if ($_ ne '.PHONY' && $_ ne '.PRECIOUS')
{
@undefined_conds =
Automake::Rule::define ($_, 'internal',
@@ -4551,84 +3796,11 @@ sub handle_factored_dependencies ()
}
}
-
-sub handle_tests_dejagnu ()
-{
- push (@check_tests, 'check-DEJAGNU');
- $output_rules .= file_contents ('dejagnu', new Automake::Location);
-}
-
-# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM])
-#----------------------------------------------------
-sub handle_per_suffix_test
-{
- my ($test_suffix, %transform) = @_;
- my ($pfx, $generic, $am_exeext);
- if ($test_suffix eq '')
- {
- $pfx = '';
- $generic = 0;
- $am_exeext = 'FALSE';
- }
- else
- {
- prog_error ("test suffix '$test_suffix' lacks leading dot")
- unless $test_suffix =~ m/^\.(.*)/;
- $pfx = uc ($1) . '_';
- $generic = 1;
- $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT'
- : 'FALSE';
- }
- # The "test driver" program, deputed to handle tests protocol used by
- # test scripts. By default, it's assumed that no protocol is used, so
- # we fall back to the old behaviour, implemented by the 'test-driver'
- # auxiliary script.
- if (! var "${pfx}LOG_DRIVER")
- {
- require_conf_file ("parallel-tests", FOREIGN, 'test-driver');
- define_variable ("${pfx}LOG_DRIVER",
- "\$(SHELL) $am_config_aux_dir/test-driver",
- INTERNAL);
- }
- my $driver = '$(' . $pfx . 'LOG_DRIVER)';
- my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)'
- . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)';
- my $compile = "${pfx}LOG_COMPILE";
- define_variable ($compile,
- '$(' . $pfx . 'LOG_COMPILER)'
- . ' $(AM_' . $pfx . 'LOG_FLAGS)'
- . ' $(' . $pfx . 'LOG_FLAGS)',
- INTERNAL);
- $output_rules .= file_contents ('check2', new Automake::Location,
- GENERIC => $generic,
- DRIVER => $driver,
- DRIVER_FLAGS => $driver_flags,
- COMPILE => '$(' . $compile . ')',
- EXT => $test_suffix,
- am__EXEEXT => $am_exeext,
- %transform);
-}
-
-# is_valid_test_extension ($EXT)
-# ------------------------------
-# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
-# otherwise.
-sub is_valid_test_extension
-{
- my $ext = shift;
- return 1
- if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/);
- return 1
- if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT'));
- return 0;
-}
-
-
sub handle_tests ()
{
if (option 'dejagnu')
{
- handle_tests_dejagnu;
+ verbatim ('dejagnu');
}
else
{
@@ -4641,118 +3813,15 @@ sub handle_tests ()
if (var ('TESTS'))
{
- push (@check_tests, 'check-TESTS');
- my $check_deps = "@check";
- $output_rules .= file_contents ('check', new Automake::Location,
- SERIAL_TESTS => !! option 'serial-tests',
- CHECK_DEPS => $check_deps);
-
- # 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 'serial-tests')
+ verbatim ('color-tests');
+ if (option 'serial-tests')
{
- define_variable ('TEST_SUITE_LOG', 'test-suite.log', 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;
- }
- if (! var 'TEST_EXTENSIONS')
- {
- define_variable ('TEST_EXTENSIONS', $suff, INTERNAL);
- }
- my $var = var 'TEST_EXTENSIONS';
- # Currently, we are not able to deal with conditional contents
- # in TEST_EXTENSIONS.
- if ($var->has_conditional_contents)
- {
- msg_var 'unsupported', $var,
- "'TEST_EXTENSIONS' cannot have conditional contents";
- }
- my @test_suffixes = $var->value_as_list_recursive;
- if ((my @invalid_test_suffixes =
- grep { !is_valid_test_extension $_ } @test_suffixes) > 0)
- {
- error $var->rdef (TRUE)->location,
- "invalid test extensions: @invalid_test_suffixes";
- }
- @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes;
- 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,
- "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;
- }
- my $base = $obj;
- $obj .= '.log';
- handle_per_suffix_test ('',
- OBJ => $obj,
- BASE => $base,
- SOURCE => $val);
- 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 '')
- {
- handle_per_suffix_test ($test_suffix,
- OBJ => '',
- BASE => '$*',
- SOURCE => '$<');
- }
- }
- $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
- $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN;
- $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
+ verbatim ('serial-tests');
+ }
+ else
+ {
+ require_conf_file ("parallel-tests", FOREIGN, 'test-driver');
+ verbatim ('parallel-tests');
}
}
}
@@ -4764,12 +3833,10 @@ sub handle_emacs_lisp ()
return if ! @elfiles;
- define_pretty_variable ('am__ELFILES', TRUE, INTERNAL,
- map { $_->[1] } @elfiles);
- define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL,
- '$(am__ELFILES:.el=.elc)');
+ define_variable ('am__ELFILES', INTERNAL, map { $_->[1] } @elfiles);
+ define_variable ('am__ELCFILES', INTERNAL, '$(am__ELFILES:.el=.elc)');
# This one can be overridden by users.
- define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)');
+ define_variable ('ELCFILES', INTERNAL, '$(LISP:.el=.elc)');
push @all, '$(ELCFILES)';
@@ -4785,7 +3852,7 @@ sub handle_python ()
require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON');
require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile');
- define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
+ define_variable ('py_compile', INTERNAL, '$(am.conf.aux-dir)/py-compile');
}
sub handle_java ()
@@ -4818,8 +3885,7 @@ sub handle_java ()
$dir = $curs;
}
- define_pretty_variable ('am__java_sources', TRUE, INTERNAL,
- "@java_sources");
+ define_variable ('am__java_sources', INTERNAL, @java_sources);
if ($dir eq 'check')
{
@@ -4965,7 +4031,6 @@ sub scan_autoconf_traces
AM_GNU_GETTEXT => 0,
AM_GNU_GETTEXT_INTL_SUBDIR => 0,
AM_INIT_AUTOMAKE => 0,
- AM_MAINTAINER_MODE => 0,
AM_PROG_AR => 0,
_AM_SUBST_NOTMAKE => 1,
_AM_COND_IF => 1,
@@ -5152,10 +4217,6 @@ EOF
exit $exit_code unless process_global_option_list (@opts);
}
}
- elsif ($macro eq 'AM_MAINTAINER_MODE')
- {
- $seen_maint_mode = $where;
- }
elsif ($macro eq 'AM_PROG_AR')
{
$seen_ar = $where;
@@ -5376,7 +4437,7 @@ sub lang_vala_ignore
}
# Rewrite a single Vala source file.
-sub lang_vala_rewrite
+sub lang_vala_rewrite ($$$)
{
my ($directory, $base, $ext) = @_;
$ext =~ s/vala$/c/;
@@ -5428,7 +4489,7 @@ sub lang_vala_finish_target
$output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n"
. "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n"
. "\t\@if test -f \$@; then :; else \\\n"
- . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n"
+ . "\t \$(MAKE) \$(srcdir)/${derived}_vala.stamp; \\\n"
. "\tfi\n";
$clean_files{$c_file} = MAINTAINER_CLEAN;
}
@@ -5448,7 +4509,7 @@ sub lang_vala_finish_target
$output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n"
. "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n"
. "\t\@if test -f \$@; then :; else \\\n"
- . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n"
+ . "\t \$(MAKE) \$(srcdir)/${derived}_vala.stamp; \\\n"
. "\tfi\n";
# valac is not used when building from dist tarballs
@@ -5490,7 +4551,7 @@ sub lang_vala_finish_target
# Thus we need to create the stamp file *before* invoking valac, and to
# move it to its final location only after valac has been invoked.
"\t${silent}rm -f \$\@ && echo stamp > \$\@-t\n".
- "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n".
+ "\t${verbose}cd \$(srcdir) && $compile @vala_sources\n".
"\t${silent}mv -f \$\@-t \$\@\n";
push_dist_common ($stampfile);
@@ -5504,13 +4565,14 @@ sub lang_vala_finish_target
sub lang_vala_finish ()
{
my ($self) = @_;
+ my @names =
+ (
+ keys %known_programs,
+ keys %known_libraries,
+ keys %known_ltlibraries,
+ );
- foreach my $prog (keys %known_programs)
- {
- lang_vala_finish_target ($self, $prog);
- }
-
- while (my ($name) = each %known_libraries)
+ foreach my $name (@names)
{
lang_vala_finish_target ($self, $name);
}
@@ -5584,7 +4646,7 @@ sub lang_yacc_target_hook
"$condstr${header}: $output\n"
# Recover from removal of $header
. "$condstr\t\@if test ! -f \$@; then rm -f $output; else :; fi\n"
- . "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; fi\n";
+ . "$condstr\t\@if test ! -f \$@; then \$(MAKE) $output; else :; fi\n";
}
# Distribute the generated file, unless its .y source was
# listed in a nodist_ variable. (handle_source_transform()
@@ -5614,37 +4676,16 @@ sub lang_lex_target_hook
$clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
}
-# This is a helper for both lex and yacc.
-sub yacc_lex_finish_helper ()
+sub lang_yacc_lex_finish ()
{
return if defined $language_scratch{'lex-yacc-done'};
$language_scratch{'lex-yacc-done'} = 1;
# FIXME: for now, no line number.
require_conf_file ($configure_ac, FOREIGN, 'ylwrap');
- define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
+ define_variable ('YLWRAP', INTERNAL, '$(am.conf.aux-dir)/ylwrap');
}
-sub lang_yacc_finish ()
-{
- return if defined $language_scratch{'yacc-done'};
- $language_scratch{'yacc-done'} = 1;
-
- reject_var 'YACCFLAGS', "'YACCFLAGS' obsolete; use 'YFLAGS' instead";
-
- yacc_lex_finish_helper;
-}
-
-
-sub lang_lex_finish ()
-{
- return if defined $language_scratch{'lex-done'};
- $language_scratch{'lex-done'} = 1;
-
- yacc_lex_finish_helper;
-}
-
-
# Given a hash table of linker names, pick the name that has the most
# precedence. This is lame, but something has to have global
# knowledge in order to eliminate the conflict. Add more linkers as
@@ -5706,36 +4747,6 @@ sub register_language
$link_languages{$link} = $lang;
}
}
-
- # Update the pattern of known extensions.
- accept_extensions (@{$lang->extensions});
-
- # Update the suffix rules map.
- foreach my $suffix (@{$lang->extensions})
- {
- foreach my $dest ($lang->output_extensions->($suffix))
- {
- register_suffix_rule (INTERNAL, $suffix, $dest);
- }
- }
-}
-
-# derive_suffix ($EXT, $OBJ)
-# --------------------------
-# This function is used to find a path from a user-specified suffix $EXT
-# to $OBJ or to some other suffix we recognize internally, e.g. 'cc'.
-sub derive_suffix
-{
- my ($source_ext, $obj) = @_;
-
- while (!$extension_map{$source_ext} && $source_ext ne $obj)
- {
- my $new_source_ext = next_in_suffix_chain ($source_ext, $obj);
- last if not defined $new_source_ext;
- $source_ext = $new_source_ext;
- }
-
- return $source_ext;
}
@@ -5880,35 +4891,34 @@ sub cond_stack_endif
## ------------------------ ##
-# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
+# define_cond_variable ($VAR, $COND, $WHERE, @VALUE)
# ----------------------------------------------------
# Like define_variable, but the value is a list, and the variable may
# be defined conditionally. The second argument is the condition
# under which the value should be defined; this should be the empty
# string to define the variable unconditionally. The third argument
-# is a list holding the values to use for the variable. The value is
-# pretty printed in the output file.
-sub define_pretty_variable
+# is a list holding the values to use for the variable.
+sub define_cond_variable
{
my ($var, $cond, $where, @value) = @_;
if (! vardef ($var, $cond))
{
Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value",
- '', $where, VAR_PRETTY);
+ '', $where);
rvar ($var)->rdef ($cond)->set_seen;
}
}
-# define_variable ($VAR, $VALUE, $WHERE)
+# define_variable ($VAR, $WHERE, @VALUE)
# --------------------------------------
# Define a new Automake Makefile variable VAR to VALUE, but only if
# not already defined.
sub define_variable
{
- my ($var, $value, $where) = @_;
- define_pretty_variable ($var, TRUE, $where, $value);
+ my ($var, $where, @value) = @_;
+ define_cond_variable ($var, TRUE, $where, @value);
}
@@ -5919,9 +4929,8 @@ sub define_variable
sub define_files_variable ($\@$$)
{
my ($var, $basename, $extension, $where) = @_;
- define_variable ($var,
- join (' ', map { "$_.$extension" } @$basename),
- $where);
+ define_variable ($var, $where,
+ join (' ', map { "$_.$extension" } @$basename));
}
@@ -5933,9 +4942,9 @@ sub define_configure_variable
# Some variables we do not want to output. For instance it
# would be a bad idea to output `U = @U@` when `@U@` can be
# substituted as `\`.
- my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
+ return if exists $ignored_configure_vars{$var};
Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var),
- '', $configure_vars{$var}, $pretty);
+ '', $configure_vars{$var});
}
@@ -5951,14 +4960,13 @@ sub define_compiler_variable
my $libtool_tag = '';
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
- define_variable ($var, $value, INTERNAL);
+ define_variable ($var, INTERNAL, $value);
if (var ('LIBTOOL'))
{
my $verbose = define_verbose_libtool ();
- define_variable ("LT$var",
- "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)"
- . " \$(LIBTOOLFLAGS) --mode=compile $value",
- INTERNAL);
+ define_variable ("LT$var", INTERNAL,
+ "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
+ . "\$(LIBTOOLFLAGS) --mode=compile $value");
}
define_verbose_tagvar ($lang->ccer || 'GEN');
}
@@ -5972,7 +4980,7 @@ sub define_linker_variable
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
# CCLD = $(CC).
- define_variable ($lang->lder, $lang->ld, INTERNAL);
+ define_variable ($lang->lder, INTERNAL, $lang->ld);
# CCLINK = $(CCLD) blah blah...
my $link = '';
if (var ('LIBTOOL'))
@@ -5981,8 +4989,8 @@ sub define_linker_variable
$link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
. "\$(LIBTOOLFLAGS) --mode=link ";
}
- define_variable ($lang->linker, $link . $lang->link, INTERNAL);
- define_variable ($lang->compiler, $lang, INTERNAL);
+ define_variable ($lang->linker, INTERNAL, $link . $lang->link);
+ define_variable ($lang->compiler, INTERNAL, $lang);
define_verbose_tagvar ($lang->lder || 'GEN');
}
@@ -6030,7 +5038,7 @@ sub define_per_target_linker_variable
return ($lang->linker, $lang->lder)
if $link_command eq $orig_command;
- define_variable ("${target}_LINK", $link_command, INTERNAL);
+ define_variable ("${target}_LINK", INTERNAL, $link_command);
return ("${target}_LINK", $lang->lder);
}
@@ -6078,7 +5086,6 @@ sub read_am_file
my $comment = '';
my $blank = 0;
my $saw_bk = 0;
- my $var_look = VAR_ASIS;
use constant IN_VAR_DEF => 0;
use constant IN_RULE_DEF => 1;
@@ -6094,8 +5101,6 @@ sub read_am_file
}
elsif (/$WHITE_PATTERN/o)
{
- error $where, "blank line following trailing backslash"
- if $saw_bk;
# Stick a single white line before the incoming macro or rule.
$spacing = "\n";
$blank = 1;
@@ -6134,19 +5139,14 @@ sub read_am_file
my $last_var_value = '';
my $last_where;
# FIXME: shouldn't use $_ in this loop; it is too big.
- while ($_)
- {
+ for (; defined $_; $_ = $am_file->getline)
+ {
$where->set ("$amfile:$.");
# Make sure the line is \n-terminated.
chomp;
$_ .= "\n";
- # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be
- # used by users. @MAINT@ is an anachronism now.
- $_ =~ s/\@MAINT\@//g
- unless $seen_maint_mode;
-
my $new_saw_bk = check_trailing_slash ($where, $_);
if ($reldir eq '.')
@@ -6171,18 +5171,6 @@ sub read_am_file
{
# Stick a single white line before the incoming macro or rule.
$spacing = "\n";
- error $where, "blank line following trailing backslash"
- if $saw_bk;
- }
- elsif (/$COMMENT_PATTERN/o)
- {
- error $where, "comment following trailing backslash"
- if $saw_bk && $prev_state != IN_COMMENT;
-
- # Stick comments before the incoming macro or rule.
- $comment .= $spacing . $_;
- $spacing = '';
- $prev_state = IN_COMMENT;
}
elsif ($saw_bk)
{
@@ -6194,14 +5182,6 @@ sub read_am_file
}
elsif ($prev_state == IN_COMMENT)
{
- # If the line doesn't start with a '#', add it.
- # We do this because a continued comment like
- # # A = foo \
- # bar \
- # baz
- # is not portable. BSD make doesn't honor
- # escaped newlines in comments.
- s/^#?/#/;
$comment .= $spacing . $_;
}
else # $prev_state == IN_VAR_DEF
@@ -6215,13 +5195,20 @@ sub read_am_file
Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
$last_var_type, $cond,
$last_var_value, $comment,
- $last_where, VAR_ASIS)
+ $last_where)
if $cond != FALSE;
$comment = $spacing = '';
}
}
}
+ elsif (/$COMMENT_PATTERN/o)
+ {
+ # Stick comments before the incoming macro or rule.
+ $comment .= $spacing . $_;
+ $spacing = '';
+ $prev_state = IN_COMMENT;
+ }
elsif (/$IF_PATTERN/o)
{
$cond = cond_stack_if ($1, $2, $where);
@@ -6239,13 +5226,15 @@ sub read_am_file
{
# Found a rule.
$prev_state = IN_RULE_DEF;
+ my $targ = $1;
+ (my $deps = $2) =~ s/^\s*//;
# For now we have to output all definitions of user rules
# and can't diagnose duplicates (see the comment in
- # Automake::Rule::define). So we go on and ignore the return value.
- Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where);
-
- check_variable_expansions ($_, $where);
+ # Automake::Rule::define). So we go on and ignore the return
+ # value.
+ Automake::Rule::define ($targ, $amfile, RULE_USER, $cond,
+ $where, $deps);
$output_trailer .= $comment . $spacing;
my $cond = new Automake::Condition @cond_stack;
@@ -6268,29 +5257,15 @@ sub read_am_file
# 'sed's.
$last_var_value = $3 . "\n";
}
- # Normally we try to output variable definitions in the
- # same format they were input. However, POSIX compliant
- # systems are not required to support lines longer than
- # 2048 bytes (most notably, some sed implementation are
- # limited to 4000 bytes, and sed is used by config.status
- # to rewrite Makefile.in into Makefile). Moreover nobody
- # would really write such long lines by hand since it is
- # hardly maintainable. So if a line is longer that 1000
- # bytes (an arbitrary limit), assume it has been
- # automatically generated by some tools, and flatten the
- # variable definition. Otherwise, keep the variable as it
- # as been input.
- $var_look = VAR_PRETTY if length ($last_var_value) >= 1000;
if (!/\\$/)
{
Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
$last_var_type, $cond,
$last_var_value, $comment,
- $last_where, $var_look)
+ $last_where)
if $cond != FALSE;
$comment = $spacing = '';
- $var_look = VAR_ASIS;
}
}
elsif (/$INCLUDE_PATTERN/o)
@@ -6301,23 +5276,12 @@ sub read_am_file
{
push (@include_stack, "\$\(top_srcdir\)/$path");
# Distribute any included file.
-
- # Always use the $(top_srcdir) prefix in DIST_COMMON,
- # otherwise OSF make will implicitly copy the included
- # file in the build tree during "make distdir" to satisfy
- # the dependency.
- # (subdir-am-cond.sh and subdir-ac-cond.sh will fail)
push_dist_common ("\$\(top_srcdir\)/$path");
}
else
{
$path =~ s/\$\(srcdir\)\///;
push (@include_stack, "\$\(srcdir\)/$path");
- # Always use the $(srcdir) prefix in DIST_COMMON,
- # otherwise OSF make will implicitly copy the included
- # file in the build tree during "make distdir" to satisfy
- # the dependency.
- # (subdir-am-cond.sh and subdir-ac-cond.sh will fail)
push_dist_common ("\$\(srcdir\)/$path");
$path = $relative_dir . "/" . $path if $relative_dir ne '.';
}
@@ -6332,25 +5296,18 @@ sub read_am_file
# This isn't an error; it is probably a continued rule.
# In fact, this is what we assume.
$prev_state = IN_RULE_DEF;
- check_variable_expansions ($_, $where);
$output_trailer .= $comment . $spacing;
my $cond = new Automake::Condition @cond_stack;
$output_trailer .= $cond->subst_string;
$output_trailer .= $_;
$comment = $spacing = '';
- error $where, "'#' comment at start of rule is unportable"
- if $_ =~ /^\t\s*\#/;
}
$saw_bk = $new_saw_bk;
- $_ = $am_file->getline;
}
$output_trailer .= $comment;
- error ($where, "trailing backslash on last line")
- if $saw_bk;
-
error ($where, (@cond_stack ? "unterminated conditionals: @cond_stack"
: "too many conditionals closed in include file"))
if "@saved_cond_stack" ne "@cond_stack";
@@ -6361,17 +5318,11 @@ sub read_am_file
# and variables from header-vars.am.
sub define_standard_variables ()
{
- my $saved_output_vars = $output_vars;
- my ($comments, undef, $rules) =
- file_contents_internal (1, "$libdir/am/header-vars.am",
- new Automake::Location);
-
foreach my $var (sort keys %configure_vars)
{
define_configure_variable ($var);
}
-
- $output_vars .= $comments . $rules;
+ $output_vars .= verbatim ('header-vars');
}
@@ -6469,42 +5420,17 @@ sub transform ($\%)
}
# $TEXT
-# preprocess_file ($MAKEFILE, [%TRANSFORM])
-# -----------------------------------------
-# Load a $MAKEFILE, apply the %TRANSFORM, and return the result.
-# No extra parsing or post-processing is done (i.e., recognition of
-# rules declaration or of make variables definitions).
-sub preprocess_file
-{
- my ($file, %transform) = @_;
-
- # Complete %transform with global options.
- # Note that %transform goes last, so it overrides global options.
- %transform = ( 'MAINTAINER-MODE'
- => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '',
-
- 'XZ' => !! option 'dist-xz',
- 'LZIP' => !! option 'dist-lzip',
- 'BZIP2' => !! option 'dist-bzip2',
- 'GZIP' => ! option 'no-dist-gzip',
- 'ZIP' => !! option 'dist-zip',
-
- 'INSTALL-INFO' => ! option 'no-installinfo',
- 'INSTALL-MAN' => ! option 'no-installman',
- 'CK-NEWS' => !! option 'check-news',
-
- 'SUBDIRS' => !! var ('SUBDIRS'),
- 'TOPDIR_P' => $relative_dir eq '.',
-
- 'BUILD' => ($seen_canonical >= AC_CANONICAL_BUILD),
- 'HOST' => ($seen_canonical >= AC_CANONICAL_HOST),
- 'TARGET' => ($seen_canonical >= AC_CANONICAL_TARGET),
-
- 'LIBTOOL' => !! var ('LIBTOOL'),
- 'NONLIBTOOL' => 1,
- %transform);
-
- if (! defined ($_ = $am_file_cache{$file}))
+# slurp_makefile_fragment ($MAKEFILE)
+# -----------------------------------
+# Load a $MAKEFILE, strip '##'-style comments, and return the result.
+# No extra parsing or post-processing is done (e.g., '%TRANSFORM%'
+# substitutions, recognition of rules declaration or of make variables
+# definitions).
+sub slurp_makefile_fragment
+{
+ my $file = shift;
+ local $_;
+ if (not defined ($_ = $am_file_cache{$file}))
{
verb "reading $file";
# Swallow the whole file.
@@ -6515,12 +5441,37 @@ sub preprocess_file
$/ = $saved_dollar_slash;
$fc_file->close;
# Remove ##-comments.
- # Besides we don't need more than two consecutive new-lines.
- s/(?:$IGNORE_PATTERN|(?<=\n\n)\n+)//gom;
+ s/$IGNORE_PATTERN//gom;
# Remember the contents of the just-read file.
$am_file_cache{$file} = $_;
}
+ return $_;
+}
+
+# $TEXT
+# preprocess_file ($MAKEFILE, [%TRANSFORM])
+# -----------------------------------------
+# Load a $MAKEFILE, apply the %TRANSFORM, and return the result.
+# No extra parsing or post-processing is done (i.e., recognition of
+# rules declaration or of make variables definitions).
+sub preprocess_file
+{
+ my ($file, %transform) = @_;
+ # Complete %transform with global options.
+ # Note that %transform goes last, so it overrides global options.
+ %transform = ('INSTALL-MAN' => ! option 'no-installman',
+ 'SUBDIRS' => !! var ('SUBDIRS'),
+ 'TOPDIR_P' => $relative_dir eq '.',
+ 'LIBTOOL' => !! var ('LIBTOOL'),
+ 'NONLIBTOOL' => 1,
+ 'SILENT' => silent_flag (),
+ %transform);
+
+ local $_ = slurp_makefile_fragment ($file);
+
+ # We don't need more than two consecutive new-lines.
+ s/(?<=\n\n)\n+//gm;
# Substitute Automake template tokens.
s/(?: % \?? [\w\-]+ %
| \? !? [\w\-]+ \?
@@ -6533,6 +5484,37 @@ sub preprocess_file
return $_;
}
+# verbatim ($NAME)
+# ----------------
+# Load a "$libdir/am/$NAME.mk", stripping any '##'-style comment. No
+# extra parsing or post-processing is done (i.e., recognition of rules
+# declaration or of make variables definitions).
+# If used in scalar or list context, return the read makefile fragment.
+# While if used in void context, append it to the '$output_verbatim'
+# variable.
+sub verbatim
+{
+ my $name = shift;
+ my $dir = "$config_aux_dir/am-ng";
+ my $file = "$dir/$name.mk";
+ my $text = slurp_makefile_fragment ("$libdir/am/$name.mk");
+ mkdir ($dir, 0755) if ! -d $dir;
+ my $fh = new Automake::XFile "> $file";
+ verb "creating $file";
+ print $fh $text;
+ my $out = "include \@top_srcdir\@/$file\n";
+ if (defined wantarray)
+ {
+ # Scalar or list context.
+ return $out;
+ }
+ else
+ {
+ # Void context
+ $output_verbatim .= $out;
+ return;
+ }
+}
# @PARAGRAPHS
# make_paragraphs ($MAKEFILE, [%TRANSFORM])
@@ -6545,9 +5527,27 @@ sub make_paragraphs
$transform{FIRST} = !$transformed_files{$file};
$transformed_files{$file} = 1;
- my @lines = split /(?<!\\)\n/, preprocess_file ($file, %transform);
- my @res;
+ my @lines = split /\n/, preprocess_file ($file, %transform);
+
+ # A line starting with '!' must be passed verbatim to the output
+ # Makefile, placed after the variables' definitions and before the
+ # Makefile targets. This is an hack to allow us to use tricky GNU
+ # make constructs (on which the dumb Automake parser would choke).
+ # It is not perfect, but seems good enough for the moment.
+ my @verbatim_lines = grep /^!/, @lines;
+ foreach (@verbatim_lines)
+ {
+ s/^!//;
+ $output_verbatim .= "$_\n";
+ }
+ @lines = grep !/^!/, @lines;
+ # Handle line continuations.
+ # FIXME: this could probably be done more efficiently, but I'd rather
+ # FIXME: not change working (and trickish) code for the moment.
+ @lines = split /(?<!\\)\n/, join ("\n", @lines);
+
+ my @res;
while (defined ($_ = shift @lines))
{
my $paragraph = $_;
@@ -6613,24 +5613,18 @@ sub file_contents_internal
# FIXME: no line number available.
$where->set ($file);
- # Sanity checks.
- error $where, "blank line following trailing backslash:\n$_"
- if /\\$/;
- error $where, "comment following trailing backslash:\n$_"
- if /\\#/;
-
if (/^$/)
- {
+ {
$is_rule = 0;
# Stick empty line before the incoming macro or rule.
$spacing = "\n";
- }
+ }
elsif (/$COMMENT_PATTERN/mso)
- {
+ {
$is_rule = 0;
# Stick comments before the incoming macro or rule.
$comment = "$_\n";
- }
+ }
# Handle inclusion of other files.
elsif (/$INCLUDE_PATTERN/o)
@@ -6714,7 +5708,7 @@ sub file_contents_internal
my @undefined_conds =
Automake::Rule::define ($targets, $file,
$is_am ? RULE_AUTOMAKE : RULE_USER,
- $cond, $where);
+ $cond, $where, "@deps");
for my $undefined_cond (@undefined_conds)
{
my $condparagraph = $paragraph;
@@ -6744,8 +5738,7 @@ sub file_contents_internal
Automake::Variable::define ($var,
$is_am ? VAR_AUTOMAKE : VAR_MAKEFILE,
- $type, $cond, $val, $comment, $where,
- VAR_ASIS)
+ $type, $cond, $val, $comment, $where)
if $cond != FALSE;
$comment = $spacing = '';
@@ -7052,7 +6045,7 @@ sub am_install_var
if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON')
{
# Define it.
- define_pretty_variable ($primary, TRUE, INTERNAL, @used);
+ define_variable ($primary, INTERNAL, @used);
$output_vars .= "\n";
}
@@ -7142,7 +6135,6 @@ sub locate_aux_dir ()
# push_required_file ($DIR, $FILE, $FULLFILE)
# -------------------------------------------
-# Push the given file onto DIST_COMMON.
sub push_required_file
{
my ($dir, $file, $fullfile) = @_;
@@ -7161,7 +6153,7 @@ sub push_required_file
# of $am_config_aux_dir here is deliberate and necessary.
elsif ($dir eq $config_aux_dir)
{
- push_dist_common ("$am_config_aux_dir/$file");
+ push_dist_common ('$(am.conf.aux-dir)/' . $file);
}
# FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support.
# We probably need some refactoring of this function and its callers,
@@ -7217,7 +6209,8 @@ sub push_required_file
else
{
prog_error "a Makefile in relative directory $relative_dir " .
- "can't add files in directory $dir to DIST_COMMON";
+ "can't add files in directory $dir to the list " .
+ "of distributed files";
}
}
@@ -7335,15 +6328,13 @@ sub required_file_check_or_copy
}
-# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
-# ---------------------------------------------------------------------
+# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES)
+# -------------------------------------------------------------
# Verify that the file must exist in $DIRECTORY, or install it.
# $MYSTRICT is the strictness level at which this file becomes required.
-# Worker threads may queue up the action to be serialized by the master,
-# if $QUEUE is true
sub require_file_internal
{
- my ($where, $mystrict, $dir, $queue, @files) = @_;
+ my ($where, $mystrict, $dir, @files) = @_;
return
unless $strictness >= $mystrict;
@@ -7351,16 +6342,7 @@ sub require_file_internal
foreach my $file (@files)
{
push_required_file ($dir, $file, "$dir/$file");
- if ($queue)
- {
- queue_required_file_check_or_copy ($required_conf_file_queue,
- QUEUE_CONF_FILE, $relative_dir,
- $where, $mystrict, @files);
- }
- else
- {
- required_file_check_or_copy ($where, $dir, $file);
- }
+ required_file_check_or_copy ($where, $dir, $file);
}
}
@@ -7369,7 +6351,7 @@ sub require_file_internal
sub require_file
{
my ($where, $mystrict, @files) = @_;
- require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
+ require_file_internal ($where, $mystrict, $relative_dir, @files);
}
# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
@@ -7392,7 +6374,7 @@ sub require_libsource_with_macro
if ($config_libobj_dir)
{
require_file_internal ($macro->rdef ($cond)->location, $mystrict,
- $config_libobj_dir, 0, @files);
+ $config_libobj_dir, @files);
}
else
{
@@ -7400,66 +6382,13 @@ sub require_libsource_with_macro
}
}
-# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
-# $MYSTRICT, @FILES)
-# --------------------------------------------------------------
-sub queue_required_file_check_or_copy
-{
- my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
- my @serial_loc;
- if (ref $where)
- {
- @serial_loc = (QUEUE_LOCATION, $where->serialize ());
- }
- else
- {
- @serial_loc = (QUEUE_STRING, $where);
- }
- $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
-}
-
-# require_queued_file_check_or_copy ($QUEUE)
-# ------------------------------------------
-sub require_queued_file_check_or_copy
-{
- my ($queue) = @_;
- my $where;
- my $dir = $queue->dequeue ();
- my $loc_key = $queue->dequeue ();
- if ($loc_key eq QUEUE_LOCATION)
- {
- $where = Automake::Location::deserialize ($queue);
- }
- elsif ($loc_key eq QUEUE_STRING)
- {
- $where = $queue->dequeue ();
- }
- else
- {
- prog_error "unexpected key $loc_key";
- }
- my $mystrict = $queue->dequeue ();
- my $nfiles = $queue->dequeue ();
- my @files;
- push @files, $queue->dequeue ()
- foreach (1 .. $nfiles);
- return
- unless $strictness >= $mystrict;
- foreach my $file (@files)
- {
- required_file_check_or_copy ($where, $config_aux_dir, $file);
- }
-}
-
# require_conf_file ($WHERE, $MYSTRICT, @FILES)
# ---------------------------------------------
# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
sub require_conf_file
{
my ($where, $mystrict, @files) = @_;
- my $queue = defined $required_conf_file_queue ? 1 : 0;
- require_file_internal ($where, $mystrict, $config_aux_dir,
- $queue, @files);
+ require_file_internal ($where, $mystrict, $config_aux_dir, @files);
}
@@ -7476,66 +6405,6 @@ sub require_conf_file_with_macro
# require_build_directory ($DIRECTORY)
# ------------------------------------
-# Emit rules to create $DIRECTORY if needed, and return
-# the file that any target requiring this directory should be made
-# dependent upon.
-# We don't want to emit the rule twice, and want to reuse it
-# for directories with equivalent names (e.g., 'foo/bar' and './foo//bar').
-sub require_build_directory
-{
- my $directory = shift;
-
- return $directory_map{$directory} if exists $directory_map{$directory};
-
- my $cdir = File::Spec->canonpath ($directory);
-
- if (exists $directory_map{$cdir})
- {
- my $stamp = $directory_map{$cdir};
- $directory_map{$directory} = $stamp;
- return $stamp;
- }
-
- my $dirstamp = "$cdir/\$(am__dirstamp)";
-
- $directory_map{$directory} = $dirstamp;
- $directory_map{$cdir} = $dirstamp;
-
- # Set a variable for the dirstamp basename.
- define_pretty_variable ('am__dirstamp', TRUE, INTERNAL, '.dirstamp');
-
- # Directory must be removed by 'make distclean'.
- $clean_files{$dirstamp} = DIST_CLEAN;
-
- $output_rules .= ("$dirstamp:\n"
- . "\t\@\$(MKDIR_P) $directory\n"
- . "\t\@: > $dirstamp\n");
-
- return $dirstamp;
-}
-
-# require_build_directory_maybe ($FILE)
-# -------------------------------------
-# If $FILE lies in a subdirectory, emit a rule to create this
-# directory and return the file that $FILE should be made
-# dependent upon. Otherwise, just return the empty string.
-sub require_build_directory_maybe
-{
- my $file = shift;
- my $directory = dirname ($file);
-
- if ($directory ne '.')
- {
- return require_build_directory ($directory);
- }
- else
- {
- return '';
- }
-}
-
-################################################################
-
# Push a list of files onto '@dist_common'.
sub push_dist_common
{
@@ -7544,7 +6413,6 @@ sub push_dist_common
push @dist_common, @_;
}
-
################################################################
# generate_makefile ($MAKEFILE_AM, $MAKEFILE_IN)
@@ -7611,19 +6479,42 @@ sub generate_makefile
. " (or '*_CPPFLAGS') instead"
}
- # Must do this after reading .am file.
- define_variable ('subdir', $relative_dir, INTERNAL);
+ # Some of these must do this after reading .am file.
+
+ define_variable ('subdir', INTERNAL, $relative_dir);
+ define_variable ('am.conf.is-topdir', INTERNAL,
+ $relative_dir eq '.' ? "yes" : "");
+ define_variable ('am.conf.check-news', INTERNAL,
+ option 'check-news' ? "yes" : "");
+ define_variable ('am.conf.no-installinfo', INTERNAL,
+ option 'no-installinfo' ? "yes" : "");
+ define_variable ('am.conf.aux-dir', INTERNAL, $am_config_aux_dir);
+ define_variable ('am.relpath.makefile', INTERNAL, basename ($makefile));
+ define_variable ('am.relpath.makefile.am', INTERNAL,
+ prepend_srcdir ($makefile_am));
+ define_variable ('am.relpath.makefile.in', INTERNAL,
+ prepend_srcdir ($makefile_in));
+
+ define_variable 'am.conf.build-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_BUILD ? '$(build)' : '';
+ define_variable 'am.conf.host-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_HOST ? '$(host)' : '';
+ define_variable 'am.conf.target-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_TARGET ? '$(target)' : '';
# If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that
# recursive rules are enabled.
- define_pretty_variable ('SUBDIRS', TRUE, INTERNAL, '')
+ define_variable ('SUBDIRS', INTERNAL, '')
if var 'DIST_SUBDIRS' && ! var 'SUBDIRS';
# Check first, because we might modify some state.
check_gnu_standards;
check_gnits_standards;
- handle_configure ($makefile_am, $makefile_in, $makefile, @inputs);
+ verbatim ('am-dir');
+
+ handle_config_headers;
+ handle_configure ($makefile, @inputs);
handle_gettext;
handle_libraries;
handle_ltlibraries;
@@ -7640,11 +6531,9 @@ sub generate_makefile
handle_libtool;
# Variables used by distdir.am and tags.am.
- define_pretty_variable ('SOURCES', TRUE, INTERNAL, @sources);
- if (! option 'no-dist')
- {
- define_pretty_variable ('DIST_SOURCES', TRUE, INTERNAL, @dist_sources);
- }
+ define_variable ('SOURCES', INTERNAL, @sources);
+ define_variable ('am.dist.sources', INTERNAL, @dist_sources)
+ unless option 'no-dist';
handle_texinfo;
handle_emacs_lisp;
@@ -7653,39 +6542,50 @@ sub generate_makefile
handle_man_pages;
handle_data;
handle_headers;
- handle_subdirs;
+ verbatim ('tags');
handle_user_recursion;
- handle_tags;
handle_minor_options;
- # Must come after handle_programs so that %known_programs is up-to-date.
+
+ # Must come after invocation of handle_programs, handle_libraries and
+ # handle_ltlibraries, so that %known_programs and %known_libraries are
+ # up-to-date.
+ define_variable 'am.all-progs', INTERNAL, sort keys %known_programs;
+ define_variable 'am.all-libs', INTERNAL, sort keys %known_libraries;
+ define_variable 'am.all-ltlibs', INTERNAL, sort keys %known_ltlibraries;
+ # Must come after invocation of several of the 'handle_*' functions
+ # above, which can declare additional dependencies for the 'check'
+ # and 'all' target.
+ define_variable ('am.all.targets', INTERNAL, @all);
+ define_variable ('am.test-suite.deps', INTERNAL, @check);
handle_tests;
# This must come after most other rules.
handle_dist;
handle_footer;
- do_check_merge_target;
- handle_all ($makefile);
+ # Special targets 'all', 'check' and 'install', handling of
+ # $(BUILT_SOURCES), and related stuff.
+ verbatim ('common-targets');
- # FIXME: Gross!
- if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS'))
- {
- $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";
- }
- if (var ('nobase_lib_LTLIBRARIES') && var ('bin_PROGRAMS'))
- {
- $output_rules .= "install-binPROGRAMS: install-nobase_libLTLIBRARIES\n\n";
- }
+ handle_clean ();
+ # This must really come late.
+ handle_subdirs;
- handle_install;
- handle_clean ($makefile);
handle_factored_dependencies;
# Comes last, because all the above procedures may have
# defined or overridden variables.
$output_vars .= output_variables;
- check_typos;
+ my $output_checks = '';
+ # See if any _SOURCES (or _LIBADD, or ...) variable were misspelled.
+ $output_checks .= verbatim ('check-typos');
+ # Bail out if we have encountered errors at make runtime. The
+ # relevant diagnostic should have already been reported by any
+ # call to the function '$(am.error)', so we just print a generic
+ # "errors seen, stopping" message.
+ $output_checks .= '$(if $(am.error.seen),$(call am.fatal))' .
+ "\n";
if ($exit_code != 0)
{
@@ -7697,8 +6597,11 @@ sub generate_makefile
mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir;
# We make sure that 'all:' is the first target.
- my $output =
- "$output_vars$output_all$output_header$output_rules$output_trailer";
+ my $output = $output_vars .
+ $output_verbatim .
+ $output_checks .
+ $output_rules .
+ $output_trailer;
# Decide whether we must update the output file or not.
# We have to update in the following situations.
@@ -7938,114 +6841,6 @@ sub handle_makefile
}
}
-# Deal with all makefiles, without threads.
-sub handle_makefiles_serial ()
-{
- foreach my $file (@input_files)
- {
- handle_makefile ($file);
- }
-}
-
-# Logic for deciding how many worker threads to use.
-sub get_number_of_threads ()
-{
- my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0;
-
- $nthreads = 0
- unless $nthreads =~ /^[0-9]+$/;
-
- # It doesn't make sense to use more threads than makefiles,
- my $max_threads = @input_files;
-
- if ($nthreads > $max_threads)
- {
- $nthreads = $max_threads;
- }
- return $nthreads;
-}
-
-# handle_makefiles_threaded ($NTHREADS)
-# -------------------------------------
-# Deal with all makefiles, using threads. The general strategy is to
-# spawn NTHREADS worker threads, dispatch makefiles to them, and let the
-# worker threads push back everything that needs serialization:
-# * warning and (normal) error messages, for stable stderr output
-# order and content (avoiding duplicates, for example),
-# * races when installing aux files (and respective messages),
-# * races when collecting aux files for distribution.
-#
-# The latter requires that the makefile that deals with the aux dir
-# files be handled last, done by the master thread.
-sub handle_makefiles_threaded
-{
- my ($nthreads) = @_;
-
- # The file queue distributes all makefiles, the message queues
- # collect all serializations needed for respective files.
- my $file_queue = Thread::Queue->new;
- my %msg_queues;
- foreach my $file (@input_files)
- {
- $msg_queues{$file} = Thread::Queue->new;
- }
-
- verb "spawning $nthreads worker threads";
- my @threads = (1 .. $nthreads);
- foreach my $t (@threads)
- {
- $t = threads->new (sub
- {
- while (my $file = $file_queue->dequeue)
- {
- verb "handling $file";
- my $queue = $msg_queues{$file};
- setup_channel_queue ($queue, QUEUE_MESSAGE);
- $required_conf_file_queue = $queue;
- handle_makefile ($file);
- $queue->enqueue (undef);
- setup_channel_queue (undef, undef);
- $required_conf_file_queue = undef;
- }
- return $exit_code;
- });
- }
-
- # Queue all makefiles.
- verb "queuing " . @input_files . " input files";
- $file_queue->enqueue (@input_files, (undef) x @threads);
-
- # Collect and process serializations.
- foreach my $file (@input_files)
- {
- verb "dequeuing messages for " . $file;
- reset_local_duplicates ();
- my $queue = $msg_queues{$file};
- while (my $key = $queue->dequeue)
- {
- if ($key eq QUEUE_MESSAGE)
- {
- pop_channel_queue ($queue);
- }
- elsif ($key eq QUEUE_CONF_FILE)
- {
- require_queued_file_check_or_copy ($queue);
- }
- else
- {
- prog_error "unexpected key $key";
- }
- }
- }
-
- foreach my $t (@threads)
- {
- my @exit_thread = $t->join;
- $exit_code = $exit_thread[0]
- if ($exit_thread[0] > $exit_code);
- }
-}
-
################################################################
# Parse the WARNINGS environment variable.
@@ -8067,15 +6862,9 @@ if (! @input_files)
fatal ("no 'Makefile.am' found for any configure output$msg");
}
-my $nthreads = get_number_of_threads ();
-
-if ($perl_threads && $nthreads >= 1)
- {
- handle_makefiles_threaded ($nthreads);
- }
-else
+foreach my $file (@input_files)
{
- handle_makefiles_serial ();
+ handle_makefile ($file);
}
exit $exit_code;