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.
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
@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
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.
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
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 $@
--- /dev/null
+#! /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
+
+:
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
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 \