maint: run "make update-copyright"
[platform/upstream/automake.git] / tests / maintclean.test
1 #! /bin/sh
2 # Copyright (C) 2001-2012 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 cat >> configure.in << 'END'
24 AC_CONFIG_FILES([bar sub/Makefile])
25 AC_OUTPUT
26 END
27
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
35
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
43
44 : > bar.in
45 : > sub/zap.sh
46
47 $ACLOCAL
48 $AUTOCONF
49 $AUTOMAKE
50
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=:
56 fi
57
58 ./configure
59 test -f bar
60
61 $MAKE
62 test -f foo.c
63 test -f sub/zap
64 $test_cache
65
66 $MAKE distclean
67 test ! -f bar
68 test ! -f Makefile
69 test ! -f sub/Makefile
70 test ! -f config.status
71 test -f foo.c
72 test -f sub/zap
73 test -f sub/zap.sh
74 $test_cache
75
76 ./configure
77 test -f bar
78
79 $MAKE foo.c
80 test -f foo.c
81 cd sub
82 $MAKE zap
83 test -f zap
84 cd ..
85
86 $MAKE maintainer-clean
87 test -f sub/zap.sh
88 test ! -f bar
89 test ! -f foo.c
90 test ! -f sub/zap
91 test ! -f Makefile
92 test ! -f sub/Makefile
93 test ! -f config.status
94 test ! -d autom4te.cache
95
96 :