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.
29 # Does $MAKE support the '.MAKE' special target?
32 have_dotmake=: # GNU make must support it.
34 unindent > mk.tmp << 'END'
39 if $MAKE -n -f mk.tmp targ.tmp && test -f targ.tmp; then
46 cat >> configure.ac << 'END'
47 AC_CONFIG_FILES([sub/Makefile sub2/Makefile])
51 cat > Makefile.am <<'END'
80 @: > stamp-installcheck
82 @: > stamp-mostlyclean
83 maintainer-clean-local:
84 @: > stamp-maintainer-clean
86 cat >sub/Makefile.am <<'END'
90 @: > stamp-install-sub
92 @: > stamp-uninstall-sub
96 @: > stamp-distclean-sub
110 @: > stamp-installcheck-sub
116 @: > stamp-mostlyclean-sub
117 maintainer-clean-local:
118 @: > stamp-maintainer-clean-sub
120 cat >sub2/Makefile.am <<'END'
121 all install uninstall clean check:
122 @: > sub2-$@-should-not-be-executed
124 @: > sub2-$@-should-not-be-executed
126 @: > sub2-$@-should-not-be-executed
127 install-info install-html install-dvi install-pdf install-ps:
128 @: > sub2-$@-should-not-be-executed
129 installcheck installdirs tags TAGS mostlyclean:
130 @: > sub2-$@-should-not-be-executed
131 ## These targets cannot be overridden like this:
132 ## install-strip distclean maintainer-clean
141 all install install-strip uninstall clean distclean check \
142 info html dvi pdf ps \
143 install-info install-html install-dvi install-pdf install-ps \
144 installcheck installdirs tags TAGS mostlyclean maintainer-clean
146 $MAKE -n $target >stdout || { cat stdout; Exit 1; }
149 install-* | installdirs | tags | TAGS ) ;;
151 if $have_dotmake; then
152 grep "stamp-$target$" stdout || Exit 1
154 test ! -f "stamp-$target$" || Exit 1
158 install-* | installdirs ) ;;
160 if $have_dotmake; then
161 grep "stamp-$target-sub" stdout || Exit 1
163 test ! -f "sub/stamp-$target-sub" || Exit 1
167 distclean | maintainer-clean ) ;;
169 if $have_dotmake; then
170 grep "should-not-be-executed" stdout || Exit 1
172 test ! -f "sub2/sub2-$target-should-not-be-executed" || Exit 1
178 $AUTOMAKE -a -Wno-override
180 check_targets || Exit 1
182 # Now, introduce BUILT_SOURCES into the toplevel Makefile
183 # TODO: add BUILT_SOURCES to sub2, fix fallout.
184 sed 's/##//' < Makefile.am > t
186 $AUTOMAKE -Wno-override --force Makefile
188 check_targets || Exit 1