doc: 'configure && make', not 'configure; make' (Bug#15066)
[autoconf.git] / tests / local.mk
blob0f26f51a1cca5e74567f08afc1862eb01107a184
1 ## Make Autoconf tests.
3 # Copyright (C) 2000-2013 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # We don't actually distribute the built testsuite or package.m4, since one
19 # only needs m4 to build them, and m4 is required to install Autoconf.
20 # But if you are borrowing from this file for setting up autotest in your
21 # project, remember to distribute both testsuite and package.m4.
22 EXTRA_DIST += \
23 $(TESTSUITE_AT) \
24 tests/local.at \
25 tests/mktests.sh \
26 tests/atlocal.in \
27 tests/wrapper.as \
28 tests/statesave.m4
30 # Running the uninstalled scripts. Build them upon 'all', for the manpages.
31 noinst_SCRIPTS = $(wrappers)
32 DISTCLEANFILES += tests/atconfig tests/atlocal $(TESTSUITE)
34 # The ':;' works around a redirected compound command bash exit status bug.
35 tests/package.m4: Makefile
36 :;{ \
37 echo '# Signature of the current package.' && \
38 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
39 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
40 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
41 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
42 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
43 echo 'm4_define([AT_PACKAGE_URL], [$(PACKAGE_URL)])'; \
44 } > $@-t
45 mv $@-t $@
49 ## ---------- ##
50 ## Wrappers. ##
51 ## ---------- ##
53 wrappers = \
54 tests/autoconf \
55 tests/autoheader \
56 tests/autom4te \
57 tests/autoreconf \
58 tests/autoscan \
59 tests/autoupdate \
60 tests/ifnames
62 CLEANFILES += \
63 tests/package.m4 \
64 tests/wrapper.in \
65 $(wrappers)
67 tests/wrapper.in: $(srcdir)/tests/wrapper.as $(m4sh_m4f_dependencies)
68 $(MY_AUTOM4TE) --language=M4sh $(srcdir)/tests/wrapper.as -o $@
70 edit_wrapper = sed \
71 -e 's|@wrap_program[@]|$(@F)|g' \
72 -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
73 -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
74 -e "s|@configure_input[@]|Generated from $$input.|g"
76 $(wrappers): tests/wrapper.in
77 rm -f $@ $@.tmp
78 input=tests/wrapper.in \
79 && $(edit_wrapper) tests/wrapper.in >$@.tmp
80 chmod +x $@.tmp
81 chmod a-w $@.tmp
82 mv -f $@.tmp $@
86 ## ------------ ##
87 ## Test suite. ##
88 ## ------------ ##
90 TESTSUITE_GENERATED_AT = \
91 $(srcdir)/tests/aclang.at \
92 $(srcdir)/tests/acc.at \
93 $(srcdir)/tests/acfortran.at \
94 $(srcdir)/tests/acgo.at \
95 $(srcdir)/tests/acgeneral.at \
96 $(srcdir)/tests/acstatus.at \
97 $(srcdir)/tests/acautoheader.at \
98 $(srcdir)/tests/acautoupdate.at \
99 $(srcdir)/tests/acspecific.at \
100 $(srcdir)/tests/acfunctions.at \
101 $(srcdir)/tests/acheaders.at \
102 $(srcdir)/tests/actypes.at \
103 $(srcdir)/tests/aclibs.at \
104 $(srcdir)/tests/acprograms.at
106 TESTSUITE_HAND_AT = \
107 tests/suite.at \
108 tests/m4sugar.at \
109 tests/m4sh.at \
110 tests/autotest.at \
111 tests/base.at \
112 tests/tools.at \
113 tests/torture.at \
114 tests/compile.at \
115 tests/c.at \
116 tests/erlang.at \
117 tests/fortran.at \
118 tests/go.at \
119 tests/semantics.at \
120 tests/autoscan.at \
121 tests/foreign.at
123 TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
124 TESTSUITE = tests/testsuite
126 # Run the non installed autom4te.
127 # Don't use AUTOM4TE since 'make alpha' makes it unavailable although
128 # we are allowed to use it (since we ship it).
129 AUTOTESTFLAGS = -I tests -I $(srcdir)/tests
130 AUTOTEST = $(MY_AUTOM4TE) --language=autotest
131 $(TESTSUITE): tests/package.m4 \
132 tests/local.at \
133 $(TESTSUITE_AT) \
134 lib/autotest/autotest.m4f
135 $(AUTOTEST) $(AUTOTESTFLAGS) suite.at -o $@.tmp
136 mv $@.tmp $@
138 # Factor out invocation of the testsuite script.
139 run_testsuite = $(SHELL) $(TESTSUITE) -C tests
141 # Avoid a race condition that would make parallel "distclean" fail.
142 # The rule in clean-local tests for existence of $(TESTSUITE), and
143 # if found, attempts to run it. But the distclean-generic rule may
144 # be running in parallel, and it removes $(DISTCLEANFILES) which
145 # includes $(TESTSUITE). This is the Automake rule, plus our
146 # dependency, and we silence the warning from 'automake -Wall' by
147 # hiding the dependency behind a variable.
148 # TODO - fix this if newer automake accommodates the dependency.
149 distclean_generic = distclean-generic
150 $(distclean_generic): clean-local
152 clean-local:
153 test ! -f $(TESTSUITE) || $(run_testsuite) --clean
154 rm -f *.tmp
155 rm -f -r autom4te.cache
157 check-local: tests/atconfig tests/atlocal $(TESTSUITE)
158 $(run_testsuite) $(TESTSUITEFLAGS)
160 # Run the test suite on the *installed* tree.
161 installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE)
162 $(run_testsuite) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
166 ## ------------------ ##
167 ## Maintainer rules. ##
168 ## ------------------ ##
170 MAINTAINERCLEANFILES += $(TESTSUITE_GENERATED_AT)
172 ## Producing the test files.
174 # The files which contain macros we check for syntax. Use $(srcdir)
175 # for the benefit of non-GNU make. Fix the names in the rule below
176 # where we 'cd' to $srcdir.
177 autoconfdir = $(srcdir)/lib/autoconf
178 AUTOCONF_FILES = $(autoconfdir)/general.m4 \
179 $(autoconfdir)/status.m4 \
180 $(autoconfdir)/autoheader.m4 \
181 $(autoconfdir)/autoupdate.m4 \
182 $(autoconfdir)/specific.m4 \
183 $(autoconfdir)/functions.m4 \
184 $(autoconfdir)/lang.m4 \
185 $(autoconfdir)/c.m4 \
186 $(autoconfdir)/erlang.m4 \
187 $(autoconfdir)/fortran.m4 \
188 $(autoconfdir)/go.m4 \
189 $(autoconfdir)/headers.m4 \
190 $(autoconfdir)/libs.m4 \
191 $(autoconfdir)/types.m4 \
192 $(autoconfdir)/programs.m4
194 $(TESTSUITE_GENERATED_AT): tests/mktests.stamp
195 ## Recover from the removal of $@
196 @if test -f $@; then :; else \
197 rm -f tests/mktests.stamp; \
198 $(MAKE) $(AM_MAKEFLAGS) tests/mktests.stamp; \
201 tests/mktests.stamp : tests/mktests.sh $(AUTOCONF_FILES)
202 @rm -f tests/mktests.tmp
203 @touch tests/mktests.tmp
204 cd $(srcdir) && $(SHELL) tests/mktests.sh \
205 `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, lib/autoconf/,g'`
206 @mv -f tests/mktests.tmp $@
208 ## Distribute the stamp file, since we distribute the generated files.
209 EXTRA_DIST += tests/mktests.stamp
210 CLEANFILES += tests/mktests.tmp
211 MAINTAINERCLEANFILES += tests/mktests.stamp
213 ## maintainer-check ##
215 # These cannot be run in parallel.
216 maintainer-check:
217 $(MAKE) $(AM_MAKEFLAGS) maintainer-check-posix
218 $(MAKE) $(AM_MAKEFLAGS) maintainer-check-c++
220 # The hairy heredoc is more robust than using echo.
221 CLEANFILES += expr
222 expr:
223 :;{ \
224 echo '#! $(SHELL)'; \
225 echo 'result=`$(EXPR) "$$@"`'; \
226 echo 'estatus=$$?'; \
227 echo 'cat <<EOF'; \
228 echo '$${result:-0}'; \
229 echo 'EOF'; \
230 echo 'exit $$estatus'; \
231 } > $@-t
232 chmod +x $@-t
233 mv $@-t $@
235 # Try the test suite with more severe environments.
236 maintainer-check-posix: expr
237 POSIXLY_CORRECT=yes $(MAKE) $(AM_MAKEFLAGS) check
238 rm expr
240 # Try using G++ as a C compiler.
241 maintainer-check-c++:
242 CC=g++ $(MAKE) $(AM_MAKEFLAGS) check