1 ## Make Autoconf tests.
3 # Copyright (C) 2000-2011 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 = $(TESTSUITE_AT) local.at mktests.sh \
23 atlocal.in wrapper.as statesave.m4
25 # Running the uninstalled scripts. Build them upon `all', for the manpages.
26 noinst_SCRIPTS = $(wrappers)
27 DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
28 MAINTAINERCLEANFILES = Makefile.in
30 # Import the dependencies on Autotest and M4sh.
31 include ../lib/freeze.mk
38 # The `:;' works around a redirected compound command bash exit status bug.
41 echo '# Signature of the current package.' && \
42 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
43 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
44 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
45 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
46 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
47 echo 'm4_define([AT_PACKAGE_URL], [$(PACKAGE_URL)])'; \
57 wrappers = autoconf autoheader autom4te autoreconf autoscan autoupdate ifnames
58 CLEANFILES = wrapper.in $(wrappers) package.m4
60 wrapper.in: $(srcdir)/wrapper.as $(m4sh_m4f_dependencies)
61 $(MY_AUTOM4TE) --language=M4sh $(srcdir)/wrapper.as -o $@
64 -e 's|@wrap_program[@]|$@|g' \
65 -e 's|@abs_top_srcdir[@]|@abs_top_srcdir@|g' \
66 -e 's|@abs_top_builddir[@]|@abs_top_builddir@|g' \
67 -e "s|@configure_input[@]|Generated from $$input.|g"
69 $(wrappers): wrapper.in
72 $(edit) wrapper.in >$@.tmp
83 TESTSUITE_GENERATED_AT = \
86 $(srcdir)/acfortran.at \
87 $(srcdir)/acgeneral.at \
88 $(srcdir)/acstatus.at \
89 $(srcdir)/acautoheader.at \
90 $(srcdir)/acautoupdate.at \
91 $(srcdir)/acspecific.at \
92 $(srcdir)/acfunctions.at \
93 $(srcdir)/acheaders.at \
94 $(srcdir)/actypes.at \
96 $(srcdir)/acprograms.at
100 m4sugar.at m4sh.at autotest.at \
101 base.at tools.at torture.at \
102 compile.at c.at erlang.at fortran.at \
107 TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
108 TESTSUITE = ./testsuite
110 # Run the non installed autom4te.
111 # Don't use AUTOM4TE since `make alpha' makes it unavailable although
112 # we are allowed to use it (since we ship it).
113 AUTOTEST = $(MY_AUTOM4TE) --language=autotest
114 $(TESTSUITE): package.m4 \
117 $(autotest_m4f_dependencies)
118 cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f
119 $(AUTOTEST) -I . -I $(srcdir) suite.at -o $@.tmp
122 atconfig: $(top_builddir)/config.status
123 cd $(top_builddir) && ./config.status tests/$@
125 # Avoid a race condition that would make parallel "distclean" fail.
126 # The rule in clean-local tests for existence of $(TESTSUITE), and
127 # if found, attempts to run it. But the distclean-generic rule may
128 # be running in parallel, and it removes $(DISTCLEANFILES) which
129 # includes $(TESTSUITE). This is the Automake rule, plus our
130 # dependency, and we silence the warning from 'automake -Wall' by
131 # hiding the dependency behind a variable.
132 # TODO - fix this if newer automake accomodates the dependency.
133 distclean_generic = distclean-generic
134 $(distclean_generic): clean-local
137 test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
139 rm -f -r autom4te.cache
141 check-local: atconfig atlocal $(TESTSUITE)
142 $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS)
144 # Run the test suite on the *installed* tree.
145 installcheck-local: atconfig atlocal $(TESTSUITE)
146 $(SHELL) $(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
150 ## ------------------ ##
151 ## Maintainer rules. ##
152 ## ------------------ ##
154 MAINTAINERCLEANFILES += $(TESTSUITE_GENERATED_AT)
156 ## Producing the test files.
158 # The files which contain macros we check for syntax. Use $(top_srcdir)
159 # for the benefit of non-GNU make. Fix the names in the rule below
160 # where we `cd' to $srcdir.
161 autoconfdir = $(top_srcdir)/lib/autoconf
162 AUTOCONF_FILES = $(autoconfdir)/general.m4 \
163 $(autoconfdir)/status.m4 \
164 $(autoconfdir)/autoheader.m4 \
165 $(autoconfdir)/autoupdate.m4 \
166 $(autoconfdir)/specific.m4 \
167 $(autoconfdir)/functions.m4 \
168 $(autoconfdir)/lang.m4 \
169 $(autoconfdir)/c.m4 \
170 $(autoconfdir)/erlang.m4 \
171 $(autoconfdir)/fortran.m4 \
172 $(autoconfdir)/headers.m4 \
173 $(autoconfdir)/libs.m4 \
174 $(autoconfdir)/types.m4 \
175 $(autoconfdir)/programs.m4
177 $(TESTSUITE_GENERATED_AT): mktests.stamp
178 ## Recover from the removal of $@
179 @if test -f $@; then :; else \
180 rm -f mktests.stamp; \
181 $(MAKE) $(AM_MAKEFLAGS) mktests.stamp; \
184 mktests.stamp : mktests.sh $(AUTOCONF_FILES)
187 cd $(srcdir) && ./mktests.sh \
188 `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
189 @mv -f mktests.tmp $@
191 ## Distribute the stamp file, since we distribute the generated files.
192 EXTRA_DIST += mktests.stamp
193 CLEANFILES += mktests.tmp
194 MAINTAINERCLEANFILES += mktests.stamp
196 ## maintainer-check ##
198 # These cannot be run in parallel.
200 $(MAKE) $(AM_MAKEFLAGS) maintainer-check-posix
201 $(MAKE) $(AM_MAKEFLAGS) maintainer-check-c++
203 # The hairy heredoc is more robust than using echo.
207 echo '#! $(SHELL)'; \
208 echo 'result=`$(EXPR) "$$@"`'; \
209 echo 'estatus=$$?'; \
211 echo '$${result:-0}'; \
213 echo 'exit $$estatus'; \
218 # Try the test suite with more severe environments.
219 maintainer-check-posix: expr
220 POSIXLY_CORRECT=yes $(MAKE) $(AM_MAKEFLAGS) check
223 # Try using G++ as a C compiler.
224 maintainer-check-c++:
225 CC=g++ $(MAKE) $(AM_MAKEFLAGS) check