2 # Copyright (C) 2009-2013 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)
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 sub2/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
115 @: > stamp-mostlyclean-sub
116 maintainer-clean-local:
117 @: > stamp-maintainer-clean-sub
119 cat >sub2/Makefile.am <<'END'
120 all install uninstall clean check:
121 @: > sub2-$@-should-not-be-executed
123 @: > sub2-$@-should-not-be-executed
125 @: > sub2-$@-should-not-be-executed
126 install-info install-html install-dvi install-pdf install-ps:
127 @: > sub2-$@-should-not-be-executed
128 installcheck installdirs tags mostlyclean:
129 @: > sub2-$@-should-not-be-executed
130 ## These targets cannot be overridden like this:
131 ## install-strip distclean maintainer-clean
140 all install install-strip uninstall clean distclean check \
141 info html dvi pdf ps \
142 install-info install-html install-dvi install-pdf install-ps \
143 installcheck installdirs tags mostlyclean maintainer-clean
145 run_make -O -- -n $target
147 install-* | installdirs | tags ) ;;
149 if $have_dotmake; then
150 grep "stamp-$target$" stdout || exit 1
152 test ! -e "stamp-$target" || exit 1
156 install-* | installdirs ) ;;
158 if $have_dotmake; then
159 grep "stamp-$target-sub" stdout || exit 1
161 test ! -e "sub/stamp-$target-sub" || exit 1
165 distclean | maintainer-clean ) ;;
167 if $have_dotmake; then
168 grep "should-not-be-executed" stdout || exit 1
170 test ! -e "sub2/sub2-$target-should-not-be-executed" || exit 1
176 $AUTOMAKE -a -Wno-override
178 check_targets || exit 1
180 # Now, introduce BUILT_SOURCES into the toplevel Makefile
181 # TODO: add BUILT_SOURCES to sub2, fix fallout.
182 sed 's/##//' < Makefile.am > t
184 $AUTOMAKE -Wno-override --force Makefile
186 check_targets || exit 1