[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-ng] [PATCH 2/2] built sources, config.h: rely on order-only pr
From: |
Stefano Lattarini |
Subject: |
[Automake-ng] [PATCH 2/2] built sources, config.h: rely on order-only prerequisites |
Date: |
Sun, 6 May 2012 23:29:02 +0200 |
This approach avoids some extra make recursions, and makes the code a
little clearer. It cannot be used in mainline automake because order-only
prerequisites are supported only by GNU make.
* lib/am/install.am (install): Use order-only prerequisites (rather than
the hacky automake-time substitution '%maybe_BUILT_SOURCES%') to enforce
$(BUILT_SOURCES) being built before the targets 'install-recursive' and
'install-am'.
* automake.in (handle_install): Don't do the '%maybe_BUILT_SOURCES%'
substitution anymore.
(do_check_merge_target, handle_all): Use order-only prerequisites to
enforce $(BUILT_SOURCES) being built before the targets 'check-am',
'all-am', 'check-recursive' and 'all-recursive' targets.
(generate_makefile): Use 'set_seen' to mark the $(BUILT_SOURCES) variable
as "already analyzed", to let Automake know it shouldn't expect to have
to deal with a program named 'BUILT' when a definition of that variable is
seen.
* t/built-sources-check.sh: Remove obsolete grepping check.
Signed-off-by: Stefano Lattarini <address@hidden>
---
automake.in | 50 +++++++++++++++-------------------------------
lib/am/install.am | 8 ++++++--
t/built-sources-check.sh | 5 -----
3 files changed, 22 insertions(+), 41 deletions(-)
diff --git a/automake.in b/automake.in
index 7af3fec..158dc9e 100644
--- a/automake.in
+++ b/automake.in
@@ -4419,10 +4419,6 @@ sub handle_install ()
$output_rules .= &file_contents
('install',
new Automake::Location,
- maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
- ? (" \$(BUILT_SOURCES)\n"
- . "\t\$(MAKE)")
- : ''),
'installdirs-local' => (user_phony_rule 'installdirs-local'
? ' installdirs-local' : ''),
am__installdirs => variable_value ('am__installdirs') || '');
@@ -4455,37 +4451,21 @@ sub handle_all ($)
&pretty_print_rule ("all-am:", "\t\t", @all);
&depend ('.PHONY', 'all-am', 'all');
-
- # Output '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) "
- . (var ('SUBDIRS') ? 'all-recursive' : 'all-am')
- . "\n\n");
- }
- else
- {
- $output_all .= "all: " . (var ('SUBDIRS')
- ? 'all-recursive' : 'all-am') . "\n\n";
- }
+ # 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.
+ my $deps = var ('SUBDIRS') ? 'all-recursive' : 'all-am';
+ $output_all .= "all: $deps\n" .
+ "$deps: | \$(BUILT_SOURCES) @local_headers\n" .
+ "\n";
}
@@ -4514,12 +4494,9 @@ sub do_check_merge_target ()
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) "
- : '')
- . (var ('SUBDIRS') ? 'check-recursive' : 'check-am')
- . "\n");
+ my $deps = var ('SUBDIRS') ? 'check-recursive' : 'check-am';
+ $output_rules .= "check: $deps\n" .
+ "$deps: | \$(BUILT_SOURCES)\n";
}
# handle_clean ($MAKEFILE)
@@ -7913,6 +7890,11 @@ sub generate_makefile ($$)
check_gnu_standards;
check_gnits_standards;
+ # Let Automake know it shouldn't expect to have to deal with a
+ # program named 'BUILT' when the $(BUILT_SOURCES) variable is
+ # seen, by marking that variable as "already analyzed".
+ set_seen 'BUILT_SOURCES';
+
handle_configure ($makefile_am, $makefile_in, $makefile, @inputs);
handle_gettext;
handle_libraries;
diff --git a/lib/am/install.am b/lib/am/install.am
index ec7aa52..fbbe181 100644
--- a/lib/am/install.am
+++ b/lib/am/install.am
@@ -51,12 +51,16 @@ endif !%?SUBDIRS%
if %?SUBDIRS%
RECURSIVE_TARGETS += install-data-recursive install-exec-recursive \
install-recursive uninstall-recursive
-install:%maybe_BUILT_SOURCES% install-recursive
+install: install-recursive
+install-recursive: | $(BUILT_SOURCES)
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
else !%?SUBDIRS%
-install:%maybe_BUILT_SOURCES% install-am
+install: install-am
+# FIXME: Hack so that Automake won't lose the 'install-am' recipe below.
+# FIXME: We definitely need to make the automake parser smarter ...
+install$(am__empty)-am: | $(BUILT_SOURCES)
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
diff --git a/t/built-sources-check.sh b/t/built-sources-check.sh
index 90c841f..27b1fbc 100755
--- a/t/built-sources-check.sh
+++ b/t/built-sources-check.sh
@@ -62,11 +62,6 @@ cat stdout
grep '^PASS: subrun\.sh *$' stdout
grep 'PASS.*echo\.sh' stdout && Exit 1
-# check should depend directly on $(BUILT_SOURCES) (similar tests
-# are in check.test and check2.test).
-$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' Makefile.in
-$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' dir/Makefile.in
-
$MAKE distcheck
:
--
1.7.9.5