]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/Makefile.in
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / testsuite / Makefile.in
CommitLineData
c906108c 1# Makefile for regression testing the GNU debugger.
618f726f 2# Copyright 1992-2016 Free Software Foundation, Inc.
c906108c
SS
3
4# This file is part of GDB.
5
d53a7b30 6# This program is free software; you can redistribute it and/or modify
c906108c 7# it under the terms of the GNU General Public License as published by
d53a7b30
JB
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
c906108c
SS
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
d53a7b30 15#
c906108c 16# You should have received a copy of the GNU General Public License
d53a7b30 17# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c
SS
18
19VPATH = @srcdir@
20srcdir = @srcdir@
21prefix = @prefix@
22exec_prefix = @exec_prefix@
b8b4e42b 23abs_builddir = @abs_builddir@
437277d4 24abs_srcdir = @abs_srcdir@
c906108c 25
be2a5f71 26target_alias = @target_noncanonical@
c906108c
SS
27program_transform_name = @program_transform_name@
28build_canonical = @build@
29host_canonical = @host@
30target_canonical = @target@
c906108c
SS
31
32SHELL = @SHELL@
93076499 33EXEEXT = @EXEEXT@
c906108c
SS
34SUBDIRS = @subdirs@
35RPATH_ENVVAR = @RPATH_ENVVAR@
36
2a31c623
PA
37EXTRA_RULES = @EXTRA_RULES@
38
39CC=@CC@
40
41EXPECT = `if [ "$${READ1}" != "" ] ; then \
42 echo $${rootme}/expect-read1; \
43 elif [ -f $${rootme}/../../expect/expect ] ; then \
44 echo $${rootme}/../../expect/expect ; \
45 else \
46 echo expect ; \
47 fi`
c906108c
SS
48
49RUNTEST = $(RUNTEST_FOR_TARGET)
50
51RUNTESTFLAGS =
52
6bc80edc
TT
53FORCE_PARALLEL =
54
c906108c
SS
55RUNTEST_FOR_TARGET = `\
56 if [ -f $${srcdir}/../../dejagnu/runtest ]; then \
57 echo $${srcdir}/../../dejagnu/runtest; \
58 else \
59 if [ "$(host_canonical)" = "$(target_canonical)" ]; then \
60 echo runtest; \
61 else \
dcfff61f 62 t='$(program_transform_name)'; echo runtest | sed -e $$t; \
c906108c
SS
63 fi; \
64 fi`
65
66#### host, target, and site specific Makefile frags come in here.
67
68# The use of $$(x_FOR_TARGET) reduces the command line length by not
69# duplicating the lengthy definition.
70
71TARGET_FLAGS_TO_PASS = \
72 "prefix=$(prefix)" \
73 "exec_prefix=$(exec_prefix)" \
74 "against=$(against)" \
75 'CC=$$(CC_FOR_TARGET)' \
76 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
77 "CFLAGS=$(TESTSUITE_CFLAGS)" \
c906108c
SS
78 'CXX=$$(CXX_FOR_TARGET)' \
79 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
80 "CXXFLAGS=$(CXXFLAGS)" \
81 "MAKEINFO=$(MAKEINFO)" \
82 "INSTALL=$(INSTALL)" \
83 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
84 "INSTALL_DATA=$(INSTALL_DATA)" \
85 "LDFLAGS=$(LDFLAGS)" \
86 "LIBS=$(LIBS)" \
87 "RUNTEST=$(RUNTEST)" \
88 "RUNTESTFLAGS=$(RUNTESTFLAGS)"
89
2a31c623 90all: $(EXTRA_RULES)
c906108c
SS
91 @echo "Nothing to be done for all..."
92
93.NOEXPORT:
94INFODIRS=doc
95info:
96install-info:
97dvi:
9453113a
DJ
98pdf:
99install-pdf:
085dd6e6
JM
100html:
101install-html:
c906108c
SS
102
103install:
104
105uninstall: force
106
b8b4e42b
JK
107# Use absolute `site.exp' path everywhere to suppress VPATH lookups for it.
108# Bare `site.exp' is used as a target here if user requests it explicitly.
109# $(RUNTEST) is looking up `site.exp' only in the current directory.
110
111$(abs_builddir)/site.exp site.exp: ./config.status Makefile
c906108c
SS
112 @echo "Making a new config file..."
113 -@rm -f ./tmp?
114 @touch site.exp
115 -@mv site.exp site.bak
116 @echo "## these variables are automatically generated by make ##" > ./tmp0
117 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
118 @echo "# add them to the last section" >> ./tmp0
c906108c
SS
119 @echo "set host_triplet ${host_canonical}" >> ./tmp0
120 @echo "set target_alias $(target_alias)" >> ./tmp0
121 @echo "set target_triplet ${target_canonical}" >> ./tmp0
122 @echo "set build_triplet ${build_canonical}" >> ./tmp0
437277d4 123 @echo "set srcdir ${abs_srcdir}" >> ./tmp0
c906108c 124 @echo "set tool gdb" >> ./tmp0
f3525b70 125 @echo 'source $${srcdir}/lib/append_gdb_boards_dir.exp' >> ./tmp0
c906108c
SS
126 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
127 @cat ./tmp0 > site.exp
128 @cat site.bak | sed \
129 -e '1,/^## All variables above are.*##/ d' >> site.exp
130 -@rm -f ./tmp?
131
132installcheck:
133
81208388
TT
134# See whether -j was given to make. Either it was given with no
135# arguments, and appears as "j" in the first word, or it was given an
136# argument and appears as "-j" in a separate word.
137@GMAKE_TRUE@saw_dash_j = $(or $(findstring j,$(firstword $(MAKEFLAGS))),$(filter -j,$(MAKEFLAGS)))
138
139# For GNU make, try to run the tests in parallel if any -j option is
140# given. If RUNTESTFLAGS is not empty, then by default the tests will
141# be serialized. This can be overridden by setting FORCE_PARALLEL to
142# any non-empty value. For a non-GNU make, do not parallelize.
143@GMAKE_TRUE@CHECK_TARGET = $(if $(FORCE_PARALLEL),check-parallel,$(if $(RUNTESTFLAGS),check-single,$(if $(saw_dash_j),check-parallel,check-single)))
6bc80edc
TT
144@GMAKE_FALSE@CHECK_TARGET = check-single
145
81208388
TT
146# Note that we must resort to a recursive make invocation here,
147# because GNU make 3.82 has a bug preventing MAKEFLAGS from being used
148# in conditions.
149check: all $(abs_builddir)/site.exp
150 $(MAKE) $(CHECK_TARGET)
6bc80edc 151
2a31c623
PA
152check-read1:
153 $(MAKE) READ1="1" check
154
6bc80edc
TT
155# All the hair to invoke dejagnu. A given invocation can just append
156# $(RUNTESTFLAGS)
157DO_RUNTEST = \
c906108c
SS
158 rootme=`pwd`; export rootme; \
159 srcdir=${srcdir} ; export srcdir ; \
160 EXPECT=${EXPECT} ; export EXPECT ; \
93076499 161 EXEEXT=${EXEEXT} ; export EXEEXT ; \
c906108c
SS
162 $(RPATH_ENVVAR)=$$rootme/../../expect:$$rootme/../../libstdc++:$$rootme/../../tk/unix:$$rootme/../../tcl/unix:$$rootme/../../bfd:$$rootme/../../opcodes:$$$(RPATH_ENVVAR); \
163 export $(RPATH_ENVVAR); \
164 if [ -f $${rootme}/../../expect/expect ] ; then \
165 TCL_LIBRARY=$${srcdir}/../../tcl/library ; \
166 export TCL_LIBRARY ; fi ; \
41d1845e 167 $(RUNTEST) --status
6bc80edc 168
c17ef0d5
DE
169# TESTS exists for the user to pass on the command line to easily
170# say "Only run these tests." With check-single it's not necessary, but
171# with check-parallel there's no other way to (easily) specify a subset
172# of tests. For consistency we support it for check-single as well.
173# To specify all tests in a subdirectory, use TESTS=gdb.subdir/*.exp.
174# E.g., make check TESTS="gdb.server/*.exp gdb.threads/*.exp".
175@GMAKE_TRUE@TESTS :=
176@GMAKE_FALSE@TESTS =
177
178@GMAKE_TRUE@ifeq ($(strip $(TESTS)),)
179@GMAKE_TRUE@expanded_tests_or_none :=
180@GMAKE_TRUE@else
181@GMAKE_TRUE@expanded_tests := $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/,$(TESTS))))
182@GMAKE_TRUE@expanded_tests_or_none := $(or $(expanded_tests),no-matching-tests-found)
183@GMAKE_TRUE@endif
184@GMAKE_FALSE@expanded_tests_or_none = $(TESTS)
185
4992aa20
JM
186# Shorthand for running all the tests in a single directory.
187@GMAKE_TRUE@check-gdb.%:
188@GMAKE_TRUE@ $(MAKE) check TESTS="gdb.$*/*.exp"
189
81208388 190check-single:
41d1845e 191 $(DO_RUNTEST) $(RUNTESTFLAGS) $(expanded_tests_or_none)
6bc80edc 192
6bc80edc 193check-parallel:
5dd3176f 194 -rm -rf cache outputs temp
81208388 195 $(MAKE) -k do-check-parallel; \
bef95aac 196 result=$$?; \
6bc80edc 197 $(SHELL) $(srcdir)/dg-extract-results.sh \
81208388 198 `find outputs -name gdb.sum -print` > gdb.sum; \
6bc80edc 199 $(SHELL) $(srcdir)/dg-extract-results.sh -L \
bef95aac
SM
200 `find outputs -name gdb.log -print` > gdb.log; \
201 sed -n '/=== gdb Summary ===/,$$ p' gdb.sum; \
202 exit $$result
81208388
TT
203
204# Turn a list of .exp files into "check/" targets. Only examine .exp
205# files appearing in a gdb.* directory -- we don't want to pick up
206# lib/ by mistake. For example, gdb.linespec/linespec.exp becomes
207# check/gdb.linespec/linespec.exp. The list is generally sorted
208# alphabetically, but we take a few tests known to be slow and push
209# them to the front of the list to try to lessen the overall time
210# taken by the test suite -- if one of these tests happens to be run
211# late, it will cause the overall time to increase.
c17ef0d5 212@GMAKE_TRUE@ifeq ($(strip $(TESTS)),)
81208388
TT
213slow_tests = gdb.base/break-interp.exp gdb.base/interp.exp \
214 gdb.base/multi-forks.exp
215@GMAKE_TRUE@all_tests := $(shell cd $(srcdir) && find gdb.* -name '*.exp' -print)
216@GMAKE_TRUE@reordered_tests := $(slow_tests) $(filter-out $(slow_tests),$(all_tests))
217@GMAKE_TRUE@TEST_TARGETS := $(addprefix check/,$(reordered_tests))
c17ef0d5
DE
218@GMAKE_TRUE@else
219@GMAKE_TRUE@TEST_TARGETS := $(addprefix check/,$(expanded_tests_or_none))
220@GMAKE_TRUE@endif
81208388
TT
221
222do-check-parallel: $(TEST_TARGETS)
223 @:
224
225@GMAKE_TRUE@check/%.exp:
226@GMAKE_TRUE@ -mkdir -p outputs/$*
41d1845e 227@GMAKE_TRUE@ @$(DO_RUNTEST) GDB_PARALLEL=yes --outdir=outputs/$* $*.exp $(RUNTESTFLAGS)
c906108c 228
c17ef0d5
DE
229check/no-matching-tests-found:
230 @echo ""
231 @echo "No matching tests found."
232 @echo ""
233
3d338901
DE
234# Utility rule invoked by step 2 of the build-perf rule.
235@GMAKE_TRUE@workers/%.worker:
236@GMAKE_TRUE@ mkdir -p gdb.perf/outputs/$*
41d1845e 237@GMAKE_TRUE@ $(DO_RUNTEST) --outdir=gdb.perf/outputs/$* lib/build-piece.exp WORKER=$* GDB_PARALLEL=gdb.perf $(RUNTESTFLAGS) GDB_PERFTEST_MODE=compile GDB_PERFTEST_SUBMODE=build-pieces
3d338901
DE
238
239# Utility rule to build tests that support it in parallel.
240# The build is broken into 3 steps distinguished by GDB_PERFTEST_SUBMODE:
241# gen-workers, build-pieces, final.
242#
243# GDB_PERFTEST_MODE appears *after* RUNTESTFLAGS here because we don't want
244# anything in RUNTESTFLAGS to override it.
245#
246# We don't delete the outputs directory here as these programs can take
247# awhile to build, and perftest.exp has support for deciding whether to
248# recompile them. If you want to remove these directories, make clean.
249#
250# The point of step 1 is to construct the set of worker tasks for step 2.
251# All of the information needed by build-piece.exp is contained in the name
252# of the generated .worker file.
253@GMAKE_TRUE@build-perf: $(abs_builddir)/site.exp
254@GMAKE_TRUE@ rm -rf gdb.perf/workers
255@GMAKE_TRUE@ mkdir -p gdb.perf/workers
256@GMAKE_TRUE@ @: Step 1: Generate the build .worker files.
41d1845e 257@GMAKE_TRUE@ $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf/workers GDB_PARALLEL=gdb.perf $(RUNTESTFLAGS) GDB_PERFTEST_MODE=compile GDB_PERFTEST_SUBMODE=gen-workers
3d338901
DE
258@GMAKE_TRUE@ @: Step 2: Compile the pieces. Here is the build parallelism.
259@GMAKE_TRUE@ $(MAKE) $$(cd gdb.perf && echo workers/*/*.worker)
260@GMAKE_TRUE@ @: Step 3: Do the final link.
41d1845e 261@GMAKE_TRUE@ $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf GDB_PARALLEL=gdb.perf $(RUNTESTFLAGS) GDB_PERFTEST_MODE=compile GDB_PERFTEST_SUBMODE=final
3d338901
DE
262
263# The default is to both compile and run the tests.
264GDB_PERFTEST_MODE = both
265
7636ccf9
YQ
266check-perf: all $(abs_builddir)/site.exp
267 @if test ! -d gdb.perf; then mkdir gdb.perf; fi
3d338901 268 $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf GDB_PERFTEST_MODE=$(GDB_PERFTEST_MODE) $(RUNTESTFLAGS)
7636ccf9 269
c906108c
SS
270force:;
271
c906108c 272clean mostlyclean:
1d41d745 273 -rm -f *~ core *.o a.out xgdb *.x *.grt bigcore.corefile .gdb_history
576fd14c 274 -rm -f core.* *.tf *.cl tracecommandsscript copy1.txt zzz-gdbscript
957df313 275 -rm -f *.dwo *.dwp
81208388 276 -rm -rf outputs temp cache
3d338901 277 -rm -rf gdb.perf/workers gdb.perf/outputs gdb.perf/temp gdb.perf/cache
2a31c623 278 -rm -f read1.so expect-read1
c906108c
SS
279
280distclean maintainer-clean realclean: clean
281 -rm -f *~ core
282 -rm -f Makefile config.status *-init.exp
283 -rm -fr *.log summary detail *.plog *.sum *.psum site.*
c906108c 284
a4ce5b0d 285Makefile : Makefile.in config.status $(host_makefile_frag)
c906108c
SS
286 $(SHELL) config.status
287
288config.status: configure
289 $(SHELL) config.status --recheck
6bf58e63
TT
290
291TAGS: force
967d1f9b
TT
292 find $(srcdir) -name '*.exp' -print | \
293 etags --regex='/proc[ \t]+\([^ \t]+\)/\1/' -
2a31c623
PA
294
295# Build the expect wrapper script that preloads the read1.so library.
296expect-read1:
297 @echo Making expect-read1
298 @rm -f expect-read1-tmp
299 @touch expect-read1-tmp
300 @echo "# THIS FILE IS GENERATED -*- buffer-read-only: t -*- \n" >>expect-read1-tmp
301 @echo "# vi:set ro: */\n\n" >>expect-read1-tmp
302 @echo "# To regenerate this file, run:\n" >>expect-read1-tmp
303 @echo "# make clean; make/\n" >>expect-read1-tmp
304 @echo "export LD_PRELOAD=`pwd`/read1.so" >>expect-read1-tmp
305 @echo 'exec expect "$$@"' >>expect-read1-tmp
306 @chmod +x expect-read1-tmp
307 @mv expect-read1-tmp expect-read1
308
309# Build the read1.so preload library. This overrides the `read'
310# function, making it read one byte at a time. Running the testsuite
311# with this catches racy tests.
312read1.so: lib/read1.c
313 $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC $(CFLAGS)
314
315# Build the read1 machinery.
316.PHONY: read1
317read1: read1.so expect-read1