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)
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 <==
30 # Does $MAKE support the '.MAKE' special target?
33 have_dotmake
=: # GNU make must support it.
35 unindent
> mk.tmp
<< 'END'
40 if $MAKE -n -f mk.tmp targ.tmp
&& test -f targ.tmp
; then
47 cat >> configure.ac
<< 'END'
48 AC_CONFIG_FILES
([sub
/Makefile sub
2/Makefile
])
52 cat > Makefile.am
<<'END'
81 @: > stamp-installcheck
83 @: > stamp-mostlyclean
84 maintainer-clean-local:
85 @: > stamp-maintainer-clean
87 cat >sub
/Makefile.am
<<'END'
91 @: > stamp-install-sub
93 @: > stamp-uninstall-sub
97 @: > stamp-distclean-sub
111 @: > stamp-installcheck-sub
117 @: > stamp-mostlyclean-sub
118 maintainer-clean-local:
119 @: > stamp-maintainer-clean-sub
121 cat >sub
2/Makefile.am
<<'END'
122 all install uninstall clean check:
123 @: > sub2-$@-should-not-be-executed
125 @: > sub2-$@-should-not-be-executed
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
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; }
150 install-
* | installdirs | tags | TAGS
) ;;
152 if $have_dotmake; then
153 grep "stamp-$target$" stdout ||
exit 1
155 test ! -e "stamp-$target" ||
exit 1
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
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
179 $AUTOMAKE -a -Wno-override
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
187 $AUTOMAKE -Wno-override --force Makefile
189 check_targets ||
exit 1