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, stdout output is sufficiently complete.
23 # FIXME: The checks in (2) should also work with BSD make implementations
24 # FIXME: that support the `.MAKE' special target, but currently we don't
25 # FIXME: explicitly test that this is truly the case.
27 # This test exercises the GCS-mandated targets (except for dist)
28 # as well as tags, TAGS.
36 cat >> configure.in << 'END'
37 AC_CONFIG_FILES([sub/Makefile sub2/Makefile])
41 cat > Makefile.am <<'END'
70 @: > stamp-installcheck
72 @: > stamp-mostlyclean
73 maintainer-clean-local:
74 @: > stamp-maintainer-clean
76 cat >sub/Makefile.am <<'END'
80 @: > stamp-install-sub
82 @: > stamp-uninstall-sub
86 @: > stamp-distclean-sub
100 @: > stamp-installcheck-sub
106 @: > stamp-mostlyclean-sub
107 maintainer-clean-local:
108 @: > stamp-maintainer-clean-sub
110 cat >sub2/Makefile.am <<'END'
111 all install uninstall clean check:
112 @: > sub2-$@-should-not-be-executed
114 @: > sub2-$@-should-not-be-executed
116 @: > sub2-$@-should-not-be-executed
117 install-info install-html install-dvi install-pdf install-ps:
118 @: > sub2-$@-should-not-be-executed
119 installcheck installdirs tags TAGS mostlyclean:
120 @: > sub2-$@-should-not-be-executed
121 ## These targets cannot be overridden like this:
122 ## install-strip distclean maintainer-clean
132 all install install-strip uninstall clean distclean check \
133 info html dvi pdf ps \
134 install-info install-html install-dvi install-pdf install-ps \
135 installcheck installdirs tags TAGS mostlyclean maintainer-clean
137 $MAKE -n $target >stdout || { cat stdout; Exit 1; }
140 install-* | installdirs | tags | TAGS ) ;;
143 grep "stamp-$target$" stdout || Exit 1
145 test ! -f "stamp-$target$" || Exit 1
149 install-* | installdirs ) ;;
152 grep "stamp-$target-sub" stdout || Exit 1
154 test ! -f "sub/stamp-$target-sub" || Exit 1
158 distclean | maintainer-clean ) ;;
161 grep "should-not-be-executed" stdout || Exit 1
163 test ! -f "sub2/sub2-$target-should-not-be-executed" || Exit 1
169 $AUTOMAKE -Wno-override
171 check_targets || Exit 1
173 # Now, introduce BUILT_SOURCES into the toplevel Makefile
174 # TODO: add BUILT_SOURCES to sub2, fix fallout.
175 sed 's/##//' < Makefile.am > t
177 $AUTOMAKE -Wno-override --force Makefile
179 check_targets || Exit 1