]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
"make dist" did not depend on $(BUILT_SOURCES)
authorJim Meyering <meyering@fb.com>
Thu, 20 Mar 2014 19:31:32 +0000 (12:31 -0700)
committerJim Meyering <meyering@fb.com>
Wed, 29 Nov 2017 03:05:59 +0000 (19:05 -0800)
* lib/am/distdir.am (distdir-am): New intermediate target.
Interpose this target between $(distdir) and its dependency
on $(DISTFILES), so that we can ensure $(BUILT_SOURCES) are
all created before we begin creating $(DISTFILES).
* t/dist-vs-built-sources.sh: Test for this.
* t/list-of-tests.mk (handwritten_TESTS): Add it.
* NEWS (Bugs fixed): Mention it.
Assaf Gordon reported that "make dist" (after ./configure
from a pristine clone of GNU hello) would fail due to the
absence of configmake.h while compiling lib/localcharset.c.
https://lists.gnu.org/r/bug-hello/2014-03/msg00016.html

NEWS
lib/am/distdir.am
t/dist-vs-built-sources.sh [new file with mode: 0644]
t/list-of-tests.mk

diff --git a/NEWS b/NEWS
index 04a2855652a1504e6eaf2bfcd41fbab1bd031fc5..6d8b9d248a7c464596fb0a32517ef6b8ef094df5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -113,6 +113,9 @@ New in ?.?.?:
   - Installed 'aclocal' m4 macros can now accept installation directories
     containing '@' characters (automake bug#20903)
 
+  - "./configure && make dist" no longer fails when a distributed file depends
+    on one from BUILT_SOURCES.
+
   - When combining AC_LIBOBJ or AC_FUNC_ALLOCA with the
     "--disable-dependency-tracking" configure option in an out of source
     build, the build sub-directory defined by AC_CONFIG_LIBOBJ_DIR is now
index 653966f0eea7a5edd0173f3f305e9729d21304f4..4b65435911c5d018fb07c7765b6461f7cf48c6ce 100644 (file)
@@ -72,10 +72,13 @@ endif %?SUBDIRS%
 
 .PHONY: distdir
 if %?SUBDIRS%
-AM_RECURSIVE_TARGETS += distdir
+AM_RECURSIVE_TARGETS += distdir distdir-am
 endif %?SUBDIRS%
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 ##
 ## For Gnits users, this is pretty handy.  Look at 15 lines
 ## in case some explanatory text is desirable.
diff --git a/t/dist-vs-built-sources.sh b/t/dist-vs-built-sources.sh
new file mode 100644 (file)
index 0000000..94f8b60
--- /dev/null
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Copyright (C) 2017 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/>.
+
+# Ensure that "make dist" no longer fails when a distributed file
+# depends on a file from the list of BUILT_SOURCES.
+
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+BUILT_SOURCES = h.h
+h.h:
+       rm -f $@ $@-t
+       printf '%s\n' '#define F "F"' > $@-t
+       mv -f $@-t $@
+CLEANFILES = h.h
+
+EXTRA_DIST = gen
+gen: foo
+       ./foo > $@-t && mv $@-t $@
+
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c
+END
+
+cat > foo.c << 'END'
+#include "h.h"
+int main (void) { printf ("%s\n", F); return 0; }
+END
+chmod a-w foo.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE dist
+
+:
index b49a3ad0f488f0bf87ae8500b016769c90984f66..61ad5b4e84c0f560f136bb77f3ce5327bdd3a85d 100644 (file)
@@ -409,6 +409,7 @@ t/dist-missing-m4.sh \
 t/dist-readonly.sh \
 t/dist-repeated.sh \
 t/dist-pr109765.sh \
+t/dist-vs-built-sources.sh \
 t/distcleancheck.sh \
 t/distcom2.sh \
 t/distcom3.sh \