diff options
author | Karl Berry <karl@freefriends.org> | 2020-10-06 18:16:14 -0700 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-10-06 18:16:14 -0700 |
commit | dbc1c9e775b0ce78c3cbb912d5e9934f8a99965a (patch) | |
tree | a0f28b286e49b91df8d42b0e8830e7e20bdf296d | |
parent | e0d69cc7749622d10de223baca048467de7b37c1 (diff) | |
download | automake-dbc1c9e775b0ce78c3cbb912d5e9934f8a99965a.tar.gz |
automake: install-exec did not depend on $(BUILT_SOURCES).
This change fixes https://bugs.gnu.org/43683.
* lib/am/install.am (install-exec): %maybe_BUILT_SOURCES% dependency,
twice. Basic patch from madmurphy (tiny change), message#8.
(.MAKE) [maybe_BUILT_SOURCES]: depend on install-exec.
* NEWS: mention it.
* doc/automake.texi (Sources): mention this (also that make dist
depends on $(BUILT_SOURCES)).
* t/built-sources-install-exec.sh: new test.
* t/list-of-tests.mk (handwritten_TESTS): add it.
* t/built-sources-install.sh: typo.
* t/built-sources-check.sh: typo.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | doc/automake.texi | 22 | ||||
-rw-r--r-- | lib/am/install.am | 5 | ||||
-rw-r--r-- | t/built-sources-check.sh | 2 | ||||
-rwxr-xr-x | t/built-sources-install-exec.sh | 41 | ||||
-rw-r--r-- | t/built-sources-install.sh | 2 | ||||
-rw-r--r-- | t/list-of-tests.mk | 1 |
7 files changed, 60 insertions, 15 deletions
@@ -75,6 +75,8 @@ New in ?.?.?: contrib/checklinkx (a small modification of W3C checklink) added, with accompany target checklinkx to recheck urls. + - install-exec target depends on $(BUILT_SOURCES). + - valac argument matching more precise, to avoid garbage in DIST_COMMON. * Distribution diff --git a/doc/automake.texi b/doc/automake.texi index 738eb84cb..91e1d679a 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -7361,11 +7361,11 @@ rule to build @file{foo.h} first by lack of dependency information. @cindex @code{BUILT_SOURCES}, defined The @code{BUILT_SOURCES} variable is a workaround for this problem. A -source file listed in @code{BUILT_SOURCES} is made on @samp{make all} -or @samp{make check} (or even @samp{make install}) before other -targets are processed. However, such a source file is not -@emph{compiled} unless explicitly requested by mentioning it in some -other @code{_SOURCES} variable. +source file listed in @code{BUILT_SOURCES} is made when @samp{make +all}, @samp{make check}, @samp{make install}, @samp{make install-exec} +(or @code{make dist}) is run, before other targets are processed. +However, such a source file is not @emph{compiled} unless explicitly +requested by mentioning it in some other @code{_SOURCES} variable. So, to conclude our introductory example, we could use @samp{BUILT_SOURCES = foo.h} to ensure @file{foo.h} gets built before @@ -7380,12 +7380,12 @@ doesn't need to appear in @code{BUILT_SOURCES} (unless it is included by another source), because it's a known dependency of the associated object. -It might be important to emphasize that @code{BUILT_SOURCES} is -honored only by @samp{make all}, @samp{make check} and @samp{make -install}. This means you cannot build a specific target (e.g., -@samp{make foo}) in a clean tree if it depends on a built source. -However it will succeed if you have run @samp{make all} earlier, -because accurate dependencies are already available. +To emphasize, @code{BUILT_SOURCES} is honored only by @samp{make all}, +@samp{make check}, @samp{make install}, and @code{make install-exec} +(and @samp{make dist}). This means you cannot build an arbitrary +target (e.g., @samp{make foo}) in a clean tree if it depends on a +built source. However it will succeed if you have run @samp{make all} +earlier, because accurate dependencies are already available. The next section illustrates and discusses the handling of built sources on a toy example. diff --git a/lib/am/install.am b/lib/am/install.am index 3f9831f9d..8066def14 100644 --- a/lib/am/install.am +++ b/lib/am/install.am @@ -52,18 +52,19 @@ if %?SUBDIRS% RECURSIVE_TARGETS += install-data-recursive install-exec-recursive \ install-recursive uninstall-recursive install:%maybe_BUILT_SOURCES% install-recursive -install-exec: install-exec-recursive +install-exec:%maybe_BUILT_SOURCES% install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive else !%?SUBDIRS% install:%maybe_BUILT_SOURCES% install-am -install-exec: install-exec-am +install-exec:%maybe_BUILT_SOURCES% install-exec-am install-data: install-data-am uninstall: uninstall-am endif !%?SUBDIRS% if %?maybe_BUILT_SOURCES% .MAKE: install +.MAKE: install-exec endif %?maybe_BUILT_SOURCES% .MAKE .PHONY: install-am diff --git a/t/built-sources-check.sh b/t/built-sources-check.sh index 2b73e39ed..54adf0c0e 100644 --- a/t/built-sources-check.sh +++ b/t/built-sources-check.sh @@ -44,7 +44,7 @@ BUILT_SOURCES = command2.inc check_SCRIPTS = echo.sh echo.sh: ## The next line ensures that command1.inc has been built before -## recurring into the subdir. +## recursing into the subdir. test -f ../command1.inc (echo '#! /bin/sh'; cat command2.inc) > $@ chmod +x $@ diff --git a/t/built-sources-install-exec.sh b/t/built-sources-install-exec.sh new file mode 100755 index 000000000..47c7f1ae9 --- /dev/null +++ b/t/built-sources-install-exec.sh @@ -0,0 +1,41 @@ +#! /bin/sh +# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# Test that 'install-exec:' honors $(BUILT_SOURCES); +# https://bugs.gnu.org/43683. + +. test-init.sh + +cat >> configure.ac << 'END' +AC_OUTPUT +END + +cat > Makefile.am << 'END' +BUILT_SOURCES = built1 +built1: + echo ok > $@ +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure --prefix "$(pwd)/inst" + +# Make sure this file is rebuilt by make install-exec. +$MAKE install-exec +test -f built1 + +: diff --git a/t/built-sources-install.sh b/t/built-sources-install.sh index f4bd57f61..f5109a4da 100644 --- a/t/built-sources-install.sh +++ b/t/built-sources-install.sh @@ -49,7 +49,7 @@ cat > dir/Makefile.am << 'END' BUILT_SOURCES = built2 built2: ## The next line ensures that command1.inc has been built before -## recurring into the subdir. +## recursing into the subdir. cp ../built1 $@ CLEANFILES = built2 END diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 3bd121110..f44eed0e5 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -203,6 +203,7 @@ t/built-sources-check.sh \ t/built-sources-cond.sh \ t/built-sources-fork-bomb.sh \ t/built-sources-install.sh \ +t/built-sources-install-exec.sh \ t/built-sources-subdir.sh \ t/built-sources.sh \ t/candist.sh \ |