* NEWS: Update wording to say merely "should" for AS_DIRNAME
[autoconf.git] / tests / Makefile.am
blobab9f7097aaf918ca15e91ef35dc80f62e201ec5a
1 ## Process this file with automake to create Makefile.in. -*-Makefile-*-
3 ## Makefile for Autoconf testsuite.
4 ## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
5 ## Free Software Foundation, Inc.
7 ## This program is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2, or (at your option)
10 ## any later version.
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ## GNU General Public License for more details.
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program; if not, write to the Free Software
19 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 ## 02110-1301, USA.
22 # We don't actually distribute the testsuite, since one only
23 # needs m4 to build it, m4 being required anyway to install Autoconf.
24 EXTRA_DIST = $(TESTSUITE_AT) local.at mktests.sh \
25              atlocal.in package.m4 wrapper.as
27 # Running the uninstalled scripts.
28 check_SCRIPTS = $(wrappers)
29 DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
30 MAINTAINERCLEANFILES = Makefile.in
32 # Import the dependencies on Autotest and M4sh.
33 include ../lib/freeze.mk
36 ## ------------ ##
37 ## package.m4.  ##
38 ## ------------ ##
40 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
41         {                                       \
42           echo '# Signature of the current package.'; \
43           echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
44           echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
45           echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
46           echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
47           echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
48         } >$(srcdir)/package.m4
52 ## ---------- ##
53 ## Wrappers.  ##
54 ## ---------- ##
56 wrappers = autoconf autoheader autom4te autoreconf autoscan autoupdate ifnames
57 CLEANFILES = wrapper.in $(wrappers)
59 wrapper.in: $(srcdir)/wrapper.as $(m4sh_m4f_dependencies)
60         $(MY_AUTOM4TE) --language=M4sh $(srcdir)/wrapper.as -o $@
62 edit = sed \
63         -e 's|@wrap_program[@]|$@|g' \
64         -e 's|@abs_top_srcdir[@]|@abs_top_srcdir@|g' \
65         -e 's|@abs_top_builddir[@]|@abs_top_builddir@|g' \
66         -e "s|@configure_input[@]|Generated from $$input.|g"
68 $(wrappers): wrapper.in
69         rm -f $@ $@.tmp
70         input=wrapper.in; \
71         $(edit) wrapper.in >$@.tmp
72         chmod +x $@.tmp
73         chmod a-w $@.tmp
74         mv -f $@.tmp $@
78 ## ------------ ##
79 ## Test suite.  ##
80 ## ------------ ##
82 TESTSUITE_GENERATED_AT = \
83         $(srcdir)/aclang.at \
84         $(srcdir)/acc.at \
85         $(srcdir)/acfortran.at \
86         $(srcdir)/acgeneral.at \
87         $(srcdir)/acstatus.at \
88         $(srcdir)/acautoheader.at \
89         $(srcdir)/acautoupdate.at \
90         $(srcdir)/acspecific.at \
91         $(srcdir)/acfunctions.at \
92         $(srcdir)/acheaders.at \
93         $(srcdir)/actypes.at \
94         $(srcdir)/aclibs.at \
95         $(srcdir)/acprograms.at
97 TESTSUITE_HAND_AT = \
98         suite.at \
99         m4sugar.at m4sh.at autotest.at \
100         base.at tools.at torture.at \
101         compile.at c.at fortran.at \
102         semantics.at \
103         autoscan.at \
104         foreign.at
106 TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
107 TESTSUITE = ./testsuite
109 # Run the non installed autom4te.
110 # Don't use AUTOM4TE since `make alpha' makes it unavailable although
111 # we are allowed to use it (since we ship it).
112 AUTOTEST = ./autom4te --language=autotest
113 $(TESTSUITE): $(srcdir)/package.m4 \
114               local.at \
115               $(TESTSUITE_AT) \
116               $(autotest_m4f_dependencies)
117         cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f
118         $(AUTOTEST) -I $(srcdir) suite.at -o $@.tmp
119         mv $@.tmp $@
121 atconfig: $(top_builddir)/config.status
122         cd $(top_builddir) && ./config.status tests/$@
124 clean-local:
125         test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
126         rm -f *.tmp
127         rm -f -r autom4te.cache
129 check-local: atconfig atlocal $(TESTSUITE)
130         $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS)
132 # Run the test suite on the *installed* tree.
133 installcheck-local: atconfig atlocal $(TESTSUITE)
134         $(SHELL) $(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
138 ## ------------------ ##
139 ## Maintainer rules.  ##
140 ## ------------------ ##
142 MAINTAINERCLEANFILES += $(TESTSUITE_GENERATED_AT)
144 ## Producing the test files.
146 # The files which contain macros we check for syntax.  Use $(top_srcdir)
147 # for the benefit of non-GNU make.  Fix the names in the rule below
148 # where we `cd' to $srcdir.
149 autoconfdir = $(top_srcdir)/lib/autoconf
150 AUTOCONF_FILES = $(autoconfdir)/general.m4 \
151                  $(autoconfdir)/status.m4 \
152                  $(autoconfdir)/autoheader.m4 \
153                  $(autoconfdir)/autoupdate.m4 \
154                  $(autoconfdir)/specific.m4 \
155                  $(autoconfdir)/functions.m4 \
156                  $(autoconfdir)/lang.m4 \
157                  $(autoconfdir)/c.m4 \
158                  $(autoconfdir)/fortran.m4 \
159                  $(autoconfdir)/headers.m4 \
160                  $(autoconfdir)/libs.m4 \
161                  $(autoconfdir)/types.m4 \
162                  $(autoconfdir)/programs.m4
164 $(TESTSUITE_GENERATED_AT): mktests.sh $(AUTOCONF_FILES)
165         cd $(srcdir) && ./mktests.sh \
166           `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
169 ## maintainer-check ##
171 maintainer-check: maintainer-check-posix maintainer-check-c++
173 # The hairy heredoc is more robust than using echo.
174 CLEANFILES += expr
175 expr:
176         echo '#! $(SHELL)'            >expr
177         echo 'result=`@EXPR@ "$$@"`' >>expr
178         echo 'estatus=$$?'           >>expr
179         echo 'cat <<EOF'             >>expr
180         echo '$${result:-0}'         >>expr
181         echo 'EOF'                   >>expr
182         echo 'exit $$estatus'        >>expr
183         chmod +x expr
185 # Try the test suite with more severe environments.
186 maintainer-check-posix: expr
187         POSIXLY_CORRECT=yes make check
188         rm expr
190 # Try using G++ as a C compiler.
191 maintainer-check-c++:
192         CC=g++ make check