summaryrefslogtreecommitdiff
path: root/t/dist-vs-built-sources.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2014-03-20 12:31:32 -0700
committerJim Meyering <meyering@fb.com>2017-11-28 19:05:59 -0800
commitac47c22e3c0c8b055cdd47ccd18621c56f807b37 (patch)
treef7b973a340bbf9f30095a5c2645ae0dbabaecb23 /t/dist-vs-built-sources.sh
parent2e6c978a944eb57d49336b01a03dd6f9e573cd81 (diff)
downloadautomake-ac47c22e3c0c8b055cdd47ccd18621c56f807b37.tar.gz
"make dist" did not depend on $(BUILT_SOURCES)
* 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
Diffstat (limited to 't/dist-vs-built-sources.sh')
-rw-r--r--t/dist-vs-built-sources.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/t/dist-vs-built-sources.sh b/t/dist-vs-built-sources.sh
new file mode 100644
index 000000000..94f8b600f
--- /dev/null
+++ b/t/dist-vs-built-sources.sh
@@ -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
+
+: