Testsuite: do not use `chmod -R' when cleaning up.
[automake.git] / tests / maken4.test
blobae5ce27e2f30d540b4af71eabc5c11ca4b3720c3
1 #! /bin/sh
2 # Copyright (C) 2009 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 # Test `make -n' for various targets, to ensure that stdout output is
18 # sufficiently complete. This currently only works for GNU make and
19 # BSD make implementations that support the `.MAKE' special target.
21 # This test exercises the GCS-mandated targets (except for dist)
22 # as well as tags, TAGS.
24 # Please keep this test in sync with sister test maken3.test.
26 required=GNUmake
27 . ./defs || Exit 1
29 set -e
31 mkdir sub sub2
33 cat >> configure.in << 'END'
34 AC_CONFIG_FILES([sub/Makefile sub2/Makefile])
35 AC_OUTPUT
36 END
38 cat > Makefile.am <<'END'
39 TESTS = foo.test
40 SUBDIRS = sub sub2
41 ##BUILT_SOURCES = foo
42 foo:
43 foo.test:
44 all-local:
45 @: > stamp-all
46 install-data-local:
47 @: > stamp-install
48 uninstall-local:
49 @: > stamp-uninstall
50 clean-local:
51 @: > stamp-clean
52 distclean-local:
53 @: > stamp-distclean
54 info-local:
55 @: > stamp-info
56 html-local:
57 @: > stamp-html
58 dvi-local:
59 @: > stamp-dvi
60 ps-local:
61 @: > stamp-ps
62 pdf-local:
63 @: > stamp-pdf
64 check-local:
65 @: > stamp-check
66 installcheck-local:
67 @: > stamp-installcheck
68 mostlyclean-local:
69 @: > stamp-mostlyclean
70 maintainer-clean-local:
71 @: > stamp-maintainer-clean
72 END
73 cat >sub/Makefile.am <<'END'
74 all-local:
75 @: > stamp-all-sub
76 install-data-local:
77 @: > stamp-install-sub
78 uninstall-local:
79 @: > stamp-uninstall-sub
80 clean-local:
81 @: > stamp-clean-sub
82 distclean-local:
83 @: > stamp-distclean-sub
84 info-local:
85 @: > stamp-info-sub
86 html-local:
87 @: > stamp-html-sub
88 dvi-local:
89 @: > stamp-dvi-sub
90 ps-local:
91 @: > stamp-ps-sub
92 pdf-local:
93 @: > stamp-pdf-sub
94 check-local:
95 @: > stamp-check-sub
96 installcheck-local:
97 @: > stamp-installcheck-sub
98 tags:
99 @: > stamp-tags-sub
100 TAGS:
101 @: > stamp-TAGS-sub
102 mostlyclean-local:
103 @: > stamp-mostlyclean-sub
104 maintainer-clean-local:
105 @: > stamp-maintainer-clean-sub
107 cat >sub2/Makefile.am <<'END'
108 all install uninstall clean check:
109 @: > sub2-$@-should-not-be-executed
110 info dvi pdf ps:
111 @: > sub2-$@-should-not-be-executed
112 html:
113 @: > sub2-$@-should-not-be-executed
114 install-info install-html install-dvi install-pdf install-ps:
115 @: > sub2-$@-should-not-be-executed
116 installcheck installdirs tags TAGS mostlyclean:
117 @: > sub2-$@-should-not-be-executed
118 ## These targets cannot be overridden like this:
119 ## install-strip distclean maintainer-clean
122 $ACLOCAL
123 $AUTOCONF
125 check_targets ()
127 set -e
128 for target in \
129 all install install-strip uninstall clean distclean check \
130 info html dvi pdf ps \
131 install-info install-html install-dvi install-pdf install-ps \
132 installcheck installdirs tags TAGS mostlyclean maintainer-clean
134 $MAKE -n $target >stdout || { cat stdout; Exit 1; }
135 cat stdout
136 case $target in
137 install-* | installdirs | tags | TAGS ) ;;
139 grep "stamp-$target$" stdout || Exit 1
140 test ! -f "stamp-$target$" || Exit 1
142 esac
143 case $target in
144 install-* | installdirs ) ;;
146 grep "stamp-$target-sub" stdout || Exit 1
147 test ! -f "sub/stamp-$target-sub" || Exit 1
149 esac
150 case $target in
151 distclean | maintainer-clean ) ;;
153 grep "should-not-be-executed" stdout || Exit 1
154 test ! -f "sub2/sub2-$target-should-not-be-executed" || Exit 1
156 esac
157 done
160 $AUTOMAKE -Wno-override
161 ./configure
162 check_targets || Exit 1
164 # Now, introduce BUILT_SOURCES into the toplevel Makefile
165 # TODO: add BUILT_SOURCES to sub2, fix fallout.
166 sed 's/##//' < Makefile.am > t
167 mv -f t Makefile.am
168 $AUTOMAKE -Wno-override --force Makefile
169 ./configure
170 check_targets || Exit 1
172 Exit 0