(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 elisp-comp install-sh libversion.in mdate-sh
+ config.sub depcomp install-sh libversion.in mdate-sh
missing mkinstalldirs py-compile texinfo.tex ylwrap),
@libtool_files, @libtool_sometimes);
# Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen.
my $seen_gettext_intl = 0;
+# The arguments of the AM_EXTRA_RECURSIVE_TARGETS call (if any).
+my @extra_recursive_targets = ();
+
# Lists of tags supported by Libtool.
my %libtool_tags = ();
# 1 if Libtool uses LT_SUPPORTED_TAG. If it does, then it also
# Most important AC_CANONICAL_* macro seen so far.
my $seen_canonical = 0;
-# Location of that macro.
-my $canonical_location;
# Where AM_MAINTAINER_MODE appears.
my $seen_maint_mode;
'install-ps-am' => 1,
'install-info-am' => 1,
'installcheck-am' => 1,
- 'uninstall-am' => 1,
-
- 'install-man' => 1,
+ 'uninstall-am' => 1,
+ 'tags-am' => 1,
+ 'ctags-am' => 1,
+ 'cscopelist-am' => 1,
+ 'install-man' => 1,
);
# Queue to push require_conf_file requirements to.
## Variables reset by &initialize_per_input. ##
## ------------------------------------------ ##
-# Basename and relative dir of the input file.
-my $am_file_name;
-my $am_relative_dir;
-
-# Same but wrt Makefile.in.
-my $in_file_name;
+# Relative dir of the output makefile.
my $relative_dir;
-# Relative path to the top directory.
-my $topsrcdir;
-
# Greatest timestamp of the output's dependencies (excluding
# configure's dependencies).
my $output_deps_greatest_timestamp;
{
reset_local_duplicates ();
- $am_file_name = undef;
- $am_relative_dir = undef;
-
- $in_file_name = undef;
$relative_dir = undef;
- $topsrcdir = undef;
$output_deps_greatest_timestamp = 0;
return 'am__v_' . $name;
}
-# define_verbose_var (NAME, VAL)
-# ------------------------------
-# For silent rules, setup VAR and dispatcher, to expand to VAL if silent.
-sub define_verbose_var ($$)
+# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE])
+# ----------------------------------------------------------
+# For silent rules, setup VAR and dispatcher, to expand to
+# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to
+# empty) if not.
+sub define_verbose_var ($$;$)
{
- my ($name, $val) = @_;
+ 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.
define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)',
INTERNAL);
- Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val,
- '', INTERNAL, VAR_ASIS)
+ 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));
}
# Above should not be needed in the general automake code.
{
my ($name) = @_;
define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;');
- define_verbose_var ('at', '@');
}
# define_verbose_texinfo
return verbose_flag ('lt');
}
+sub handle_silent ()
+{
+ # Define "$(AM_V_P)", expanding to a shell conditional that can be
+ # used in make recipes to determine whether we are being run in
+ # silent mode or not. The choice of the name derives from the LISP
+ # convention of appending the letter 'P' to denote a predicate (see
+ # also "the '-P' convention" in the Jargon File); we do so for lack
+ # of a better convention.
+ define_verbose_var ('P', 'false', ':');
+ # *Always* provide the user with '$(AM_V_GEN)', unconditionally.
+ define_verbose_tagvar ('GEN');
+ define_verbose_var ('at', '@');
+}
+
################################################################
unless defined $done{$languages{'c'}};
define_linker_variable ($languages{'c'});
}
-
- # Always provide the user with 'AM_V_GEN' for silent rules.
- define_verbose_tagvar ('GEN');
}
# we are already there, and since the targets are built without
# a $(top_builddir), it helps BSD Make to match them with
# dependencies.
- $dir = "$config_libobj_dir/" if $config_libobj_dir ne '.';
- $dir = "$topsrcdir/$dir" if $relative_dir ne '.';
+ $dir = "$config_libobj_dir/"
+ 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
## Handling Texinfo files. ##
## ------------------------ ##
-# ($OUTFILE, $VFILE, @CLEAN_FILES)
+# ($OUTFILE, $VFILE)
# &scan_texinfo_file ($FILENAME)
# ------------------------------
# $OUTFILE - name of the info file produced by $FILENAME.
# $VFILE - name of the version.texi file used (undef if none).
-# @CLEAN_FILES - list of byproducts (indexes etc.)
sub scan_texinfo_file ($)
{
my ($filename) = @_;
- # Some of the following extensions are always created, no matter
- # whether indexes are used or not. Other (like cps, fns, ... pgs)
- # are only created when they are used. We used to scan $FILENAME
- # for their use, but that is not enough: they could be used in
- # included files. We can't scan included files because we don't
- # know the include path. Therefore we always erase these files, no
- # matter whether they are used or not.
- #
- # (tmp is only created if an @macro is used and a certain e-TeX
- # feature is not available.)
- my %clean_suffixes =
- map { $_ => 1 } (qw(aux log toc tmp
- cp cps
- fn fns
- ky kys
- vr vrs
- tp tps
- pg pgs)); # grep 'new.*index' texinfo.tex
-
my $texi = new Automake::XFile "< $filename";
verb "reading $filename";
{
$vfile = $1;
}
-
- # Try to find new or unused indexes.
-
- # Creating a new category of index.
- elsif (/^\@def(code)?index (\w+)/)
- {
- $clean_suffixes{$2} = 1;
- $clean_suffixes{"$2s"} = 1;
- }
-
- # Merging an index into an another.
- elsif (/^\@syn(code)?index (\w+) (\w+)/)
- {
- delete $clean_suffixes{"$2s"};
- $clean_suffixes{"$3s"} = 1;
- }
-
}
if (! $outfile)
my $infobase = basename ($filename);
$infobase =~ s/\.te?xi(nfo)?$//;
- return ($outfile, $vfile,
- map { "$infobase.$_" } (sort keys %clean_suffixes));
+ return ($outfile, $vfile);
}
# If 'version.texi' is referenced by input file, then include
# automatic versioning capability.
- my ($out_file, $vtexi, @clean_files) =
+ my ($out_file, $vtexi) =
scan_texinfo_file ("$relative_dir/$texi")
or next;
- push (@mostly_cleans, @clean_files);
+ # Directory of auxiliary files and build by-products used by texi2dvi
+ # and texi2pdf.
+ push @mostly_cleans, "$infobase.t2d";
+ push @mostly_cleans, "$infobase.t2p";
# If the Texinfo source is in a subdirectory, create the
# resulting info in this subdirectory. If it is in the current
'$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)'
. "@config", INTERNAL);
- my @tag_deps = ();
- my @ctag_deps = ();
- my @cscope_deps = ();
- if (var ('SUBDIRS'))
- {
- $output_rules .= ("tags-recursive:\n"
- . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n"
- # Never fail here if a subdir fails; it
- # isn't important.
- . "\t test \"\$\$subdir\" = . || (\$(am__cd) \$\$subdir"
- . " && \$(MAKE) \$(AM_MAKEFLAGS) tags); \\\n"
- . "\tdone\n");
- push (@tag_deps, 'tags-recursive');
- &depend ('.PHONY', 'tags-recursive');
- &depend ('.MAKE', 'tags-recursive');
-
- $output_rules .= ("ctags-recursive:\n"
- . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n"
- # Never fail here if a subdir fails; it
- # isn't important.
- . "\t test \"\$\$subdir\" = . || (\$(am__cd) \$\$subdir"
- . " && \$(MAKE) \$(AM_MAKEFLAGS) ctags); \\\n"
- . "\tdone\n");
- push (@ctag_deps, 'ctags-recursive');
- &depend ('.PHONY', 'ctags-recursive');
- &depend ('.MAKE', 'ctags-recursive');
-
- $output_rules .= ("cscopelist-recursive:\n"
- . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n"
- # Never fail here if a subdir fails; it
- # isn't important.
- . "\t test \"\$\$subdir\" = . || (\$(am__cd) \$\$subdir"
- . " && \$(MAKE) \$(AM_MAKEFLAGS) cscopelist); \\\n"
- . "\tdone\n");
- push (@cscope_deps, 'cscopelist-recursive');
- &depend ('.PHONY', 'cscopelist-recursive');
- &depend ('.MAKE', 'cscopelist-recursive');
- }
-
if (rvar('am__tagged_files')->value_as_list_recursive
- || var ('ETAGS_ARGS') || @tag_deps)
- {
- $output_rules .= &file_contents ('tags',
- new Automake::Location,
- TAGSDIRS => "@tag_deps",
- CTAGSDIRS => "@ctag_deps",
- CSCOPEDIRS => "@cscope_deps");
-
+ || var ('ETAGS_ARGS') || var ('SUBDIRS'))
+ {
+ $output_rules .= &file_contents ('tags', new Automake::Location);
set_seen 'TAGS_DEPENDENCIES';
- }
- elsif (reject_var ('TAGS_DEPENDENCIES',
- "it doesn't make sense to define 'TAGS_DEPENDENCIES'"
- . " without\nsources or 'ETAGS_ARGS'"))
- {
- }
+ }
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.
- $output_rules .= "tags: TAGS\nTAGS:\n\n";
- # Ditto ctags and cscope.
- $output_rules .= "ctags: CTAGS\nCTAGS:\n\n";
- $output_rules .= "cscope cscopelist:\n\n";
- }
+ # to fail because some subdirectory failed. Ditto ctags and
+ # cscope.
+ $output_rules .=
+ "tags TAGS:\n\n" .
+ "ctags CTAGS:\n\n" .
+ "cscope cscopelist:\n\n";
+ }
}
# to set it.
$handle_dist_run = 1;
- # Scan EXTRA_DIST to see if we need to distribute anything from a
- # subdir. If so, add it to the list. I didn't want to do this
- # originally, but there were so many requests that I finally
- # relented.
- my $extra_dist = var ('EXTRA_DIST');
-
$transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook';
$transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external;
}
}
+# 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);
+ my $aux = var ('SUBDIRS') ? 'recursive' : 'am';
+ foreach my $target (@extra_recursive_targets)
+ {
+ # This allows the default target's rules to be overridden in
+ # Makefile.am.
+ user_phony_rule ($target);
+ depend ("$target", "$target-$aux");
+ depend ("$target-am", "$target-local");
+ # Every user-defined recursive target 'foo' *must* have a valid
+ # associated 'foo-local' rule; we define it as an empty rule by
+ # default, so that the user can transparently extend it in his
+ # own Makefile.am.
+ pretty_print_rule ("$target-local:");
+ # $target-recursive might as well be undefined, so do not add
+ # it here; it's taken care of in subdirs.am anyway.
+ depend (".PHONY", "$target-am", "$target-local");
+ }
+}
+
# &do_check_merge_target ()
# -------------------------
push (@check_tests, 'check-TESTS');
my $check_deps = "@check";
$output_rules .= &file_contents ('check', new Automake::Location,
- COLOR => !! option 'color-tests',
SERIAL_TESTS => !! option 'serial-tests',
CHECK_DEPS => $check_deps);
require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE,
'EMACS', 'lispdir');
- require_conf_file ($elfiles[0][0], FOREIGN, 'elisp-comp');
- &define_variable ('elisp_comp', "$am_config_aux_dir/elisp-comp", INTERNAL);
}
# Handle Python
AC_SUBST_TRACE => 1,
AM_AUTOMAKE_VERSION => 1,
AM_CONDITIONAL => 2,
+ _AM_EXTRA_RECURSIVE_TARGETS => 1,
AM_GNU_GETTEXT => 0,
AM_GNU_GETTEXT_INTL_SUBDIR => 0,
AM_INIT_AUTOMAKE => 0,
if ($seen_canonical <= AC_CANONICAL_BUILD)
{
$seen_canonical = AC_CANONICAL_BUILD;
- $canonical_location = $where;
}
}
elsif ($macro eq 'AC_CANONICAL_HOST')
if ($seen_canonical <= AC_CANONICAL_HOST)
{
$seen_canonical = AC_CANONICAL_HOST;
- $canonical_location = $where;
}
}
elsif ($macro eq 'AC_CANONICAL_TARGET')
{
$seen_canonical = AC_CANONICAL_TARGET;
- $canonical_location = $where;
}
elsif ($macro eq 'AC_CONFIG_AUX_DIR')
{
{
$configure_cond{$args[1]} = $where;
}
+ elsif ($macro eq '_AM_EXTRA_RECURSIVE_TARGETS')
+ {
+ push @extra_recursive_targets, split (' ', $args[1]);
+ }
elsif ($macro eq 'AM_GNU_GETTEXT')
{
$seen_gettext = $where;
}
# Read main am file.
-sub read_main_am_file
+sub read_main_am_file ($$)
{
- my ($amfile) = @_;
+ my ($amfile, $infile) = @_;
# This supports the strange variable tricks we are about to play.
prog_error ("variable defined before read_main_am_file\n" . variables_dump ())
# Generate copyright header for generated Makefile.in.
# We do discard the output of predefined variables, handled below.
- $output_vars = ("# $in_file_name generated by automake "
- . $VERSION . " from $am_file_name.\n");
+ $output_vars = ("# " . basename ($infile) . " generated by automake "
+ . $VERSION . " from " . basename ($amfile) . ".\n");
$output_vars .= '# ' . subst ('configure_input') . "\n";
$output_vars .= $gen_copyright;
# preprocess_file ($MAKEFILE, [%TRANSFORM])
# -----------------------------------------
# Load a $MAKEFILE, apply the %TRANSFORM, and return the result.
-# No extra parsing of post-processing is done (i.e., recognition of
+# No extra parsing or post-processing is done (i.e., recognition of
# rules declaration or of make variables definitions).
sub preprocess_file ($%)
{
# we have processed AUTOMAKE_OPTIONS.
buffer_messages ('warning');
- # Name of input file ("Makefile.am") and output file
- # ("Makefile.in"). These have no directory components.
- $am_file_name = basename ($makefile_am);
- $in_file_name = basename ($makefile_in);
-
# $OUTPUT is encoded. If it contains a ":" then the first element
# is the real output file, and all remaining elements are input
# files. We don't scan or otherwise deal with these input files,
my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in});
$relative_dir = dirname ($makefile);
- $am_relative_dir = dirname ($makefile_am);
- $topsrcdir = backname ($relative_dir);
- read_main_am_file ($makefile_am);
+ read_main_am_file ($makefile_am, $makefile_in);
if (handle_options)
{
# Process buffered warnings.
handle_programs;
handle_scripts;
+ handle_silent;
+
# These must be run after all the sources are scanned. They
# use variables defined by &handle_libraries, &handle_ltlibraries,
# or &handle_programs.
handle_data;
handle_headers;
handle_subdirs;
+ handle_user_recursion;
handle_tags;
handle_minor_options;
# Must come after handle_programs so that %known_programs is up-to-date.
return;
}
+ my $am_relative_dir = dirname ($makefile_am);
mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir;
# We make sure that 'all:' is the first target.