Merge branch 'minor'
[automake.git] / t / subdir-distclean.sh
blob3dd11e56c1d5c50e528d438e5518a0b997f3a93c
1 #! /bin/sh
2 # Copyright (C) 2012-2017 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Check that "./configure && make && make distclean" is actually a
18 # no-op, even when conditional SUBDIRS are involved.
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_CONFIG_FILES([sub1/Makefile sub2/Makefile sub1/subsub/Makefile])
24 AM_CONDITIONAL([COND], [false])
25 AC_SUBST([extra_subdirs], [''])
26 AC_OUTPUT
27 END
29 mkdir sub1 sub2 sub1/subsub
31 cat > Makefile.am << 'END'
32 SUBDIRS = sub1
33 if COND
34 SUBDIRS += sub2
35 endif
36 END
38 cat > sub1/Makefile.am << 'END'
39 all-local:
40 : > run
41 CLEANFILES = run
42 SUBDIRS = @extra_subdirs@
43 DIST_SUBDIRS = subsub
44 END
46 cat > sub2/Makefile.am << 'END'
47 all-local:
48 @echo "Should not run in `pwd`!"
49 exit 1
50 DISTCLEANFILES = oops
51 END
52 cp sub2/Makefile.am sub1/subsub/Makefile.am
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE -c --add-missing
58 ./configure
60 test -f sub1/Makefile
61 test -f sub2/Makefile
62 test -f sub1/subsub/Makefile
64 $MAKE
65 test -f sub1/run
66 touch sub2/oops sub1/subsub/oops
68 $MAKE distclean
69 test ! -e sub1/run
70 test ! -e sub2/oops
71 test ! -e sub1/subsub/oops
72 test ! -e sub1/Makefile
73 test ! -e sub2/Makefile
74 test ! -e sub1/subsub/Makefile
76 mkdir build
77 cd build
79 ../configure
81 $MAKE
83 test -f sub1/Makefile
84 test -f sub2/Makefile
85 test -f sub1/subsub/Makefile
87 test -f sub1/run
88 touch sub2/oops sub1/subsub/oops
90 $MAKE maintainer-clean
91 test ! -e sub1/run
92 test ! -e sub2/oops
93 test ! -e sub1/subsub/oops
94 test ! -e sub1/Makefile
95 test ! -e sub2/Makefile
96 test ! -e sub1/subsub/Makefile
98 cd ..
100 ./configure
101 $MAKE distclean