]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
automake: install-exec did not depend on $(BUILT_SOURCES).
authorKarl Berry <karl@freefriends.org>
Wed, 7 Oct 2020 01:16:14 +0000 (18:16 -0700)
committerKarl Berry <karl@freefriends.org>
Wed, 7 Oct 2020 01:16:14 +0000 (18:16 -0700)
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.

NEWS
doc/automake.texi
lib/am/install.am
t/built-sources-check.sh
t/built-sources-install-exec.sh [new file with mode: 0755]
t/built-sources-install.sh
t/list-of-tests.mk

diff --git a/NEWS b/NEWS
index f36011c87da97b6e55ab327c367c85fade46aed1..eb17e483bfd0b8871ae5c2e2c9697bd3161a8d19 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
index 738eb84cb7146c7b207c339f39c7fd84fd0c38d9..91e1d679aa53a2d6ef81ef0b453bd5d0ca23b91b 100644 (file)
@@ -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.
index 3f9831f9d31b753cc00d282295f4039f9cba69b9..8066def14b9515636440067cd29d44527d93391e 100644 (file)
@@ -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
index 2b73e39ed122386fcc68ddfde4b3943f9f2dfe9f..54adf0c0e5d5913b673c12df135bedaa161f0d2b 100644 (file)
@@ -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 (executable)
index 0000000..47c7f1a
--- /dev/null
@@ -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
+
+:
index f4bd57f6154d9c5f9bec93933e46e6b236b82172..f5109a4dac0bc6b42efa8bb59d194d129cad5fa4 100644 (file)
@@ -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
index 3bd1211105c269672ffe008878b63284a1c9f03d..f44eed0e5c6fc3e5de72ffeffad6a76a4d2ee299 100644 (file)
@@ -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 \