doc: update Vala documentation
[automake.git] / t / maken3.sh
blobe7b78bdfd66583dad2eb3e70da2859a9075fdd9e
1 #! /bin/sh
2 # Copyright (C) 2009-2024 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)
7 # any later version.
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 <https://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.
27 # For gen-testsuite-part: ==> try-with-serial-tests <==
28 . test-init.sh
30 # Does $MAKE support the '.MAKE' special target?
31 have_dotmake=false
32 if using_gmake; then
33 have_dotmake=: # GNU make must support it.
34 else
35 unindent > mk.tmp << 'END'
36 targ.tmp:
37 : > $@
38 .MAKE: targ.tmp
39 END
40 if $MAKE -n -f mk.tmp targ.tmp && test -f targ.tmp; then
41 have_dotmake=:
45 mkdir sub sub2
47 cat >> configure.ac << 'END'
48 AC_CONFIG_FILES([sub/Makefile sub2/Makefile])
49 AC_OUTPUT
50 END
52 cat > Makefile.am <<'END'
53 TESTS = foo.test
54 SUBDIRS = sub sub2
55 ##BUILT_SOURCES = foo
56 foo:
57 foo.test:
58 all-local:
59 @: > stamp-all
60 install-data-local:
61 @: > stamp-install
62 uninstall-local:
63 @: > stamp-uninstall
64 clean-local:
65 @: > stamp-clean
66 distclean-local:
67 @: > stamp-distclean
68 info-local:
69 @: > stamp-info
70 html-local:
71 @: > stamp-html
72 dvi-local:
73 @: > stamp-dvi
74 ps-local:
75 @: > stamp-ps
76 pdf-local:
77 @: > stamp-pdf
78 check-local:
79 @: > stamp-check
80 installcheck-local:
81 @: > stamp-installcheck
82 mostlyclean-local:
83 @: > stamp-mostlyclean
84 maintainer-clean-local:
85 @: > stamp-maintainer-clean
86 END
87 cat >sub/Makefile.am <<'END'
88 all-local:
89 @: > stamp-all-sub
90 install-data-local:
91 @: > stamp-install-sub
92 uninstall-local:
93 @: > stamp-uninstall-sub
94 clean-local:
95 @: > stamp-clean-sub
96 distclean-local:
97 @: > stamp-distclean-sub
98 info-local:
99 @: > stamp-info-sub
100 html-local:
101 @: > stamp-html-sub
102 dvi-local:
103 @: > stamp-dvi-sub
104 ps-local:
105 @: > stamp-ps-sub
106 pdf-local:
107 @: > stamp-pdf-sub
108 check-local:
109 @: > stamp-check-sub
110 installcheck-local:
111 @: > stamp-installcheck-sub
112 tags:
113 @: > stamp-tags-sub
114 mostlyclean-local:
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
122 info dvi pdf ps:
123 @: > sub2-$@-should-not-be-executed
124 html:
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
134 $ACLOCAL
135 $AUTOCONF
137 check_targets ()
139 for target in \
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
146 case $target in
147 install-* | installdirs | tags ) ;;
149 if $have_dotmake; then
150 grep "stamp-$target$" stdout || exit 1
152 test ! -e "stamp-$target" || exit 1
154 esac
155 case $target in
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
163 esac
164 case $target in
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
172 esac
173 done
176 $AUTOMAKE -a -Wno-override
177 ./configure
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
183 mv -f t Makefile.am
184 $AUTOMAKE -Wno-override Makefile
185 ./configure
186 check_targets || exit 1
188 exit 0