tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / maintclean.sh
bloba2c0e6b755b7178f9eef4fc160bcae7050db6195
1 #! /bin/sh
2 # Copyright (C) 2001-2012 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 <http://www.gnu.org/licenses/>.
17 # Make sure distclean and maintainer-clean erase the right files.
18 # This test is for in-tree builds; see sister test 'maintclean-vpath.test'
19 # for VPATH builds.
21 . ./defs || exit 1
23 cat >> configure.ac << 'END'
24 AC_CONFIG_FILES([bar sub/Makefile])
25 AC_OUTPUT
26 END
28 cat > Makefile.am <<'END'
29 SUBDIRS = sub
30 noinst_DATA = foo.c
31 foo.c:
32 touch foo.c
33 MAINTAINERCLEANFILES = foo.c
34 END
36 mkdir sub
37 cat > sub/Makefile.am <<'END'
38 noinst_SCRIPTS = zap
39 zap: zap.sh
40 cp $(srcdir)/zap.sh $@ && chmod a+x $@
41 MAINTAINERCLEANFILES = zap
42 END
44 : > bar.in
45 : > sub/zap.sh
47 $ACLOCAL
48 $AUTOCONF
49 $AUTOMAKE
51 # Users can disable autom4te.cache.
52 if test -d autom4te.cache; then
53 test_cache='test -d autom4te.cache'
54 else
55 test_cache=:
58 ./configure
59 test -f bar
61 $MAKE
62 test -f foo.c
63 test -f sub/zap
64 $test_cache
66 $MAKE distclean
67 test ! -e bar
68 test ! -e Makefile
69 test ! -e sub/Makefile
70 test ! -e config.status
71 test -f foo.c
72 test -f sub/zap
73 test -f sub/zap.sh
74 $test_cache
76 ./configure
77 test -f bar
79 $MAKE foo.c
80 test -f foo.c
81 cd sub
82 $MAKE zap
83 test -f zap
84 cd ..
86 $MAKE maintainer-clean
87 test -f sub/zap.sh
88 test ! -e bar
89 test ! -e foo.c
90 test ! -e sub/zap
91 test ! -e Makefile
92 test ! -e sub/Makefile
93 test ! -e config.status
94 test ! -e autom4te.cache