1#! /bin/sh
2# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2, or (at your option)
7# any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program.  If not, see <https://www.gnu.org/licenses/>.
16
17# Test of subdir make dist rules.
18# From Robert Collins.
19
20required=cc
21. test-init.sh
22
23cat >> configure.ac << 'END'
24AC_CONFIG_FILES([generic/Makefile])
25AC_PROG_CC
26AC_OUTPUT
27END
28
29cat > Makefile.am << 'END'
30AUTOMAKE_OPTIONS = subdir-objects
31bin_PROGRAMS = wish
32wish_SOURCES = generic/a.c
33
34.PHONY: test-distdir test-build
35test-distdir: distdir
36	ls -l $(distdir) $(distdir)/* ;: For debugging.
37	test ! -r $(distdir)/a.c
38	test -f $(distdir)/generic/a.c
39test-build: all
40	ls -l . generic ;: For debugging.
41	test -f generic/a.$(OBJEXT)
42	test -f wish$(EXEEXT)
43	test ! -r a.$(OBJEXT)
44	test ! -r a$(EXEEXT)
45	test ! -r generic/wish$(EXEEXT)
46	test ! -r generic/a$(EXEEXT)
47END
48
49mkdir generic
50: > generic/Makefile.am
51
52cat > generic/a.c << 'END'
53int main (void)
54{
55  return 0;
56}
57END
58
59$ACLOCAL
60$AUTOCONF
61$AUTOMAKE --include-deps --copy --add-missing
62
63./configure
64
65$MAKE test-distdir
66$MAKE dist
67$MAKE test-build
68
69:
70