news: fixup: bug#8847 is fixed in 1.12.6, not in 1.12.5
[automake.git] / t / maken3.sh
blob6d580eca8914b528da8d89a86335862504ab624d
1 #! /bin/sh
2 # Copyright (C) 2009-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 # Test 'make -n' for various targets, to ensure that:
19 # 1. no files or directories are created or removed, and
21 # 2. if using GNU make or a make implementation supporting the .MAKE
22 # special target, the output from make is sufficiently complete.
24 # This test exercises the GCS-mandated targets (except for dist)
25 # as well as tags, TAGS.
27 # For gen-testsuite-part: ==> try-with-serial-tests <==
28 . ./defs || exit 1
30 # Does $MAKE support the '.MAKE' special target?
31 have_dotmake=false
32 if using_gmake; then
33 have_dotmake=: # GNU make must support it.
34 else
35 unindent > mk.tmp << 'END'
36 targ.tmp:
37 : > $@
38 .MAKE: targ.tmp
39 END
40 if $MAKE -n -f mk.tmp targ.tmp && test -f targ.tmp; then
41 have_dotmake=:
45 mkdir sub sub2
47 cat >> configure.ac << 'END'
48 AC_CONFIG_FILES([sub/Makefile sub2/Makefile])
49 AC_OUTPUT
50 END
52 cat > Makefile.am <<'END'
53 TESTS = foo.test
54 SUBDIRS = sub sub2
55 ##BUILT_SOURCES = foo
56 foo:
57 foo.test:
58 all-local:
59 @: > stamp-all
60 install-data-local:
61 @: > stamp-install
62 uninstall-local:
63 @: > stamp-uninstall
64 clean-local:
65 @: > stamp-clean
66 distclean-local:
67 @: > stamp-distclean
68 info-local:
69 @: > stamp-info
70 html-local:
71 @: > stamp-html
72 dvi-local:
73 @: > stamp-dvi
74 ps-local:
75 @: > stamp-ps
76 pdf-local:
77 @: > stamp-pdf
78 check-local:
79 @: > stamp-check
80 installcheck-local:
81 @: > stamp-installcheck
82 mostlyclean-local:
83 @: > stamp-mostlyclean
84 maintainer-clean-local:
85 @: > stamp-maintainer-clean
86 END
87 cat >sub/Makefile.am <<'END'
88 all-local:
89 @: > stamp-all-sub
90 install-data-local:
91 @: > stamp-install-sub
92 uninstall-local:
93 @: > stamp-uninstall-sub
94 clean-local:
95 @: > stamp-clean-sub
96 distclean-local:
97 @: > stamp-distclean-sub
98 info-local:
99 @: > stamp-info-sub
100 html-local:
101 @: > stamp-html-sub
102 dvi-local:
103 @: > stamp-dvi-sub
104 ps-local:
105 @: > stamp-ps-sub
106 pdf-local:
107 @: > stamp-pdf-sub
108 check-local:
109 @: > stamp-check-sub
110 installcheck-local:
111 @: > stamp-installcheck-sub
112 tags:
113 @: > stamp-tags-sub
114 TAGS:
115 @: > stamp-TAGS-sub
116 mostlyclean-local:
117 @: > stamp-mostlyclean-sub
118 maintainer-clean-local:
119 @: > stamp-maintainer-clean-sub
121 cat >sub2/Makefile.am <<'END'
122 all install uninstall clean check:
123 @: > sub2-$@-should-not-be-executed
124 info dvi pdf ps:
125 @: > sub2-$@-should-not-be-executed
126 html:
127 @: > sub2-$@-should-not-be-executed
128 install-info install-html install-dvi install-pdf install-ps:
129 @: > sub2-$@-should-not-be-executed
130 installcheck installdirs tags TAGS mostlyclean:
131 @: > sub2-$@-should-not-be-executed
132 ## These targets cannot be overridden like this:
133 ## install-strip distclean maintainer-clean
136 $ACLOCAL
137 $AUTOCONF
139 check_targets ()
141 for target in \
142 all install install-strip uninstall clean distclean check \
143 info html dvi pdf ps \
144 install-info install-html install-dvi install-pdf install-ps \
145 installcheck installdirs tags TAGS mostlyclean maintainer-clean
147 $MAKE -n $target >stdout || { cat stdout; exit 1; }
148 cat stdout
149 case $target in
150 install-* | installdirs | tags | TAGS ) ;;
152 if $have_dotmake; then
153 grep "stamp-$target$" stdout || exit 1
155 test ! -e "stamp-$target" || exit 1
157 esac
158 case $target in
159 install-* | installdirs ) ;;
161 if $have_dotmake; then
162 grep "stamp-$target-sub" stdout || exit 1
164 test ! -e "sub/stamp-$target-sub" || exit 1
166 esac
167 case $target in
168 distclean | maintainer-clean ) ;;
170 if $have_dotmake; then
171 grep "should-not-be-executed" stdout || exit 1
173 test ! -e "sub2/sub2-$target-should-not-be-executed" || exit 1
175 esac
176 done
179 $AUTOMAKE -a -Wno-override
180 ./configure
181 check_targets || exit 1
183 # Now, introduce BUILT_SOURCES into the toplevel Makefile
184 # TODO: add BUILT_SOURCES to sub2, fix fallout.
185 sed 's/##//' < Makefile.am > t
186 mv -f t Makefile.am
187 $AUTOMAKE -Wno-override --force Makefile
188 ./configure
189 check_targets || exit 1
191 exit 0