(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;
# 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
'$(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_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.