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)
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
115 @: > stamp-mostlyclean-sub
116 maintainer-clean-local:
117 @: > stamp-maintainer-clean-sub
119 cat >sub
2/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 $MAKE -n $target >stdout ||
{ cat stdout
; exit 1; }
148 install-
* | installdirs | tags
) ;;
150 if $have_dotmake; then
151 grep "stamp-$target$" stdout ||
exit 1
153 test ! -e "stamp-$target" ||
exit 1
157 install-
* | installdirs
) ;;
159 if $have_dotmake; then
160 grep "stamp-$target-sub" stdout ||
exit 1
162 test ! -e "sub/stamp-$target-sub" ||
exit 1
166 distclean | maintainer-clean
) ;;
168 if $have_dotmake; then
169 grep "should-not-be-executed" stdout ||
exit 1
171 test ! -e "sub2/sub2-$target-should-not-be-executed" ||
exit 1
177 $AUTOMAKE -a -Wno-override
179 check_targets ||
exit 1
181 # Now, introduce BUILT_SOURCES into the toplevel Makefile
182 # TODO: add BUILT_SOURCES to sub2, fix fallout.
183 sed 's/##//' < Makefile.am
> t
185 $AUTOMAKE -Wno-override --force Makefile
187 check_targets ||
exit 1