Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / maintclean.test
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2003, 2011 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 <http://www.gnu.org/licenses/>.
16
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.
20
21 . ./defs || Exit 1
22
23 set -e
24
25 cat >> configure.in << 'END'
26 AC_CONFIG_FILES([bar sub/Makefile])
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am <<'END'
31 SUBDIRS = sub
32 noinst_DATA = foo.c
33 foo.c:
34         touch foo.c
35 MAINTAINERCLEANFILES = foo.c
36 END
37
38 mkdir sub
39 cat > sub/Makefile.am <<'END'
40 noinst_SCRIPTS = zap
41 zap: zap.sh
42         cp $(srcdir)/zap.sh $@ && chmod a+x $@
43 MAINTAINERCLEANFILES = zap
44 END
45
46 : > bar.in
47 : > sub/zap.sh
48
49 $ACLOCAL
50 $AUTOCONF
51 $AUTOMAKE
52
53 # Users can disable autom4te.cache.
54 if test -d autom4te.cache; then
55   test_cache='test -d autom4te.cache'
56 else
57   test_cache=:
58 fi
59
60 ./configure
61 test -f bar
62
63 $MAKE
64 test -f foo.c
65 test -f sub/zap
66 $test_cache
67
68 $MAKE distclean
69 test ! -f bar
70 test ! -f Makefile
71 test ! -f sub/Makefile
72 test ! -f config.status
73 test -f foo.c
74 test -f sub/zap
75 test -f sub/zap.sh
76 $test_cache
77
78 ./configure
79 test -f bar
80
81 $MAKE foo.c
82 test -f foo.c
83 cd sub
84 $MAKE zap
85 test -f zap
86 cd ..
87
88 $MAKE maintainer-clean
89 test -f sub/zap.sh
90 test ! -f bar
91 test ! -f foo.c
92 test ! -f sub/zap
93 test ! -f Makefile
94 test ! -f sub/Makefile
95 test ! -f config.status
96 test ! -d autom4te.cache
97
98 :