Commit | Line | Data |
---|---|---|
c906108c | 1 | # Makefile for regression testing the GNU debugger. |
28e7fd62 | 2 | # Copyright 1992-2013 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 | |
19 | VPATH = @srcdir@ | |
20 | srcdir = @srcdir@ | |
21 | prefix = @prefix@ | |
22 | exec_prefix = @exec_prefix@ | |
b8b4e42b | 23 | abs_builddir = @abs_builddir@ |
c906108c | 24 | |
be2a5f71 | 25 | target_alias = @target_noncanonical@ |
c906108c SS |
26 | program_transform_name = @program_transform_name@ |
27 | build_canonical = @build@ | |
28 | host_canonical = @host@ | |
29 | target_canonical = @target@ | |
c906108c SS |
30 | |
31 | SHELL = @SHELL@ | |
93076499 | 32 | EXEEXT = @EXEEXT@ |
c906108c SS |
33 | SUBDIRS = @subdirs@ |
34 | RPATH_ENVVAR = @RPATH_ENVVAR@ | |
2f1d9bdd MM |
35 | ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.btrace gdb.cell gdb.cp \ |
36 | gdb.disasm gdb.dwarf2 gdb.fortran gdb.gdb gdb.hp \ | |
f8eba3c6 | 37 | gdb.java gdb.linespec gdb.mi gdb.modula2 gdb.multi \ |
1d41d745 | 38 | gdb.objc gdb.opencl gdb.opt gdb.pascal gdb.python gdb.server \ |
30e62689 | 39 | gdb.stabs gdb.reverse gdb.threads gdb.trace gdb.xml \ |
f4b49756 | 40 | $(SUBDIRS) |
c906108c SS |
41 | |
42 | EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \ | |
43 | echo $${rootme}/../../expect/expect ; \ | |
44 | else echo expect ; fi` | |
45 | ||
46 | RUNTEST = $(RUNTEST_FOR_TARGET) | |
47 | ||
48 | RUNTESTFLAGS = | |
49 | ||
6bc80edc TT |
50 | FORCE_PARALLEL = |
51 | ||
c906108c SS |
52 | RUNTEST_FOR_TARGET = `\ |
53 | if [ -f $${srcdir}/../../dejagnu/runtest ]; then \ | |
54 | echo $${srcdir}/../../dejagnu/runtest; \ | |
55 | else \ | |
56 | if [ "$(host_canonical)" = "$(target_canonical)" ]; then \ | |
57 | echo runtest; \ | |
58 | else \ | |
dcfff61f | 59 | t='$(program_transform_name)'; echo runtest | sed -e $$t; \ |
c906108c SS |
60 | fi; \ |
61 | fi` | |
62 | ||
63 | #### host, target, and site specific Makefile frags come in here. | |
64 | ||
65 | # The use of $$(x_FOR_TARGET) reduces the command line length by not | |
66 | # duplicating the lengthy definition. | |
67 | ||
68 | TARGET_FLAGS_TO_PASS = \ | |
69 | "prefix=$(prefix)" \ | |
70 | "exec_prefix=$(exec_prefix)" \ | |
71 | "against=$(against)" \ | |
72 | 'CC=$$(CC_FOR_TARGET)' \ | |
73 | "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ | |
74 | "CFLAGS=$(TESTSUITE_CFLAGS)" \ | |
c906108c SS |
75 | 'CXX=$$(CXX_FOR_TARGET)' \ |
76 | "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \ | |
77 | "CXXFLAGS=$(CXXFLAGS)" \ | |
78 | "MAKEINFO=$(MAKEINFO)" \ | |
79 | "INSTALL=$(INSTALL)" \ | |
80 | "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ | |
81 | "INSTALL_DATA=$(INSTALL_DATA)" \ | |
82 | "LDFLAGS=$(LDFLAGS)" \ | |
83 | "LIBS=$(LIBS)" \ | |
84 | "RUNTEST=$(RUNTEST)" \ | |
85 | "RUNTESTFLAGS=$(RUNTESTFLAGS)" | |
86 | ||
87 | all: | |
88 | @echo "Nothing to be done for all..." | |
89 | ||
90 | .NOEXPORT: | |
91 | INFODIRS=doc | |
92 | info: | |
93 | install-info: | |
94 | dvi: | |
9453113a DJ |
95 | pdf: |
96 | install-pdf: | |
085dd6e6 JM |
97 | html: |
98 | install-html: | |
c906108c SS |
99 | |
100 | install: | |
101 | ||
102 | uninstall: force | |
103 | ||
b8b4e42b JK |
104 | # Use absolute `site.exp' path everywhere to suppress VPATH lookups for it. |
105 | # Bare `site.exp' is used as a target here if user requests it explicitly. | |
106 | # $(RUNTEST) is looking up `site.exp' only in the current directory. | |
107 | ||
108 | $(abs_builddir)/site.exp site.exp: ./config.status Makefile | |
c906108c SS |
109 | @echo "Making a new config file..." |
110 | -@rm -f ./tmp? | |
111 | @touch site.exp | |
112 | -@mv site.exp site.bak | |
113 | @echo "## these variables are automatically generated by make ##" > ./tmp0 | |
114 | @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 | |
115 | @echo "# add them to the last section" >> ./tmp0 | |
c906108c SS |
116 | @echo "set host_triplet ${host_canonical}" >> ./tmp0 |
117 | @echo "set target_alias $(target_alias)" >> ./tmp0 | |
118 | @echo "set target_triplet ${target_canonical}" >> ./tmp0 | |
119 | @echo "set build_triplet ${build_canonical}" >> ./tmp0 | |
120 | @echo "set srcdir ${srcdir}" >> ./tmp0 | |
121 | @echo "set tool gdb" >> ./tmp0 | |
f3525b70 | 122 | @echo 'source $${srcdir}/lib/append_gdb_boards_dir.exp' >> ./tmp0 |
c906108c SS |
123 | @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 |
124 | @cat ./tmp0 > site.exp | |
125 | @cat site.bak | sed \ | |
126 | -e '1,/^## All variables above are.*##/ d' >> site.exp | |
127 | -@rm -f ./tmp? | |
128 | ||
129 | installcheck: | |
130 | ||
6bc80edc TT |
131 | # For GNU make, try to run the tests in parallel. If RUNTESTFLAGS is |
132 | # not empty, then by default the tests will be serialized. This can | |
133 | # be overridden by setting FORCE_PARALLEL to any non-empty value. | |
134 | # For a non-GNU make, do not parallelize. | |
135 | @GMAKE_TRUE@CHECK_TARGET = $(if $(FORCE_PARALLEL),check-parallel,$(if $(RUNTESTFLAGS),check-single,check-parallel)) | |
136 | @GMAKE_FALSE@CHECK_TARGET = check-single | |
137 | ||
138 | check: $(CHECK_TARGET) | |
139 | ||
140 | # All the hair to invoke dejagnu. A given invocation can just append | |
141 | # $(RUNTESTFLAGS) | |
142 | DO_RUNTEST = \ | |
c906108c SS |
143 | rootme=`pwd`; export rootme; \ |
144 | srcdir=${srcdir} ; export srcdir ; \ | |
145 | EXPECT=${EXPECT} ; export EXPECT ; \ | |
93076499 | 146 | EXEEXT=${EXEEXT} ; export EXEEXT ; \ |
c906108c SS |
147 | $(RPATH_ENVVAR)=$$rootme/../../expect:$$rootme/../../libstdc++:$$rootme/../../tk/unix:$$rootme/../../tcl/unix:$$rootme/../../bfd:$$rootme/../../opcodes:$$$(RPATH_ENVVAR); \ |
148 | export $(RPATH_ENVVAR); \ | |
149 | if [ -f $${rootme}/../../expect/expect ] ; then \ | |
150 | TCL_LIBRARY=$${srcdir}/../../tcl/library ; \ | |
151 | export TCL_LIBRARY ; fi ; \ | |
6bc80edc TT |
152 | $(RUNTEST) |
153 | ||
b8b4e42b | 154 | check-single: all $(abs_builddir)/site.exp |
6bc80edc TT |
155 | $(DO_RUNTEST) $(RUNTESTFLAGS) |
156 | ||
157 | # A list of all directories named "gdb.*" which also hold a .exp file. | |
158 | # We filter out gdb.base and add fake entries, because that directory | |
159 | # takes the longest to process, and so we split it in half. | |
160 | TEST_DIRS = gdb.base1 gdb.base2 $(filter-out gdb.base,$(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(srcdir)/gdb.*/*.exp)))))) | |
161 | ||
162 | TEST_TARGETS = $(addprefix check-,$(TEST_DIRS)) | |
163 | ||
164 | # We explicitly re-invoke make here for two reasons. First, it lets | |
165 | # us add a -k option, which makes the parallel check mimic the | |
166 | # behavior of the serial check; and second, it means that we can still | |
167 | # regenerate the sum and log files even if a sub-make fails -- which | |
168 | # it usually does because dejagnu exits with an error if any test | |
169 | # fails. | |
170 | check-parallel: | |
171 | $(MAKE) -k $(TEST_TARGETS); \ | |
172 | $(SHELL) $(srcdir)/dg-extract-results.sh \ | |
173 | $(addsuffix /gdb.sum,$(TEST_DIRS)) > gdb.sum; \ | |
174 | $(SHELL) $(srcdir)/dg-extract-results.sh -L \ | |
175 | $(addsuffix /gdb.log,$(TEST_DIRS)) > gdb.log | |
176 | ||
26e197f6 JK |
177 | @GMAKE_TRUE@$(filter-out check-gdb.base%,$(TEST_TARGETS)): check-gdb.%: all $(abs_builddir)/site.exp |
178 | @GMAKE_TRUE@ @if test ! -d gdb.$*; then mkdir gdb.$*; fi | |
179 | @GMAKE_TRUE@ $(DO_RUNTEST) --directory=gdb.$* --outdir=gdb.$* $(RUNTESTFLAGS) | |
6bc80edc TT |
180 | |
181 | # Each half (roughly) of the .exp files from gdb.base. | |
182 | BASE1_FILES = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/gdb.base/[a-m]*.exp)) | |
183 | BASE2_FILES = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/gdb.base/[n-z]*.exp)) | |
184 | ||
185 | # Handle each half of gdb.base. | |
b8b4e42b | 186 | check-gdb.base%: all $(abs_builddir)/site.exp |
6bc80edc TT |
187 | @if test ! -d gdb.base$*; then mkdir gdb.base$*; fi |
188 | $(DO_RUNTEST) $(BASE$*_FILES) --outdir gdb.base$* $(RUNTESTFLAGS) | |
189 | ||
c906108c SS |
190 | subdir_do: force |
191 | @for i in $(DODIRS); do \ | |
192 | if [ -d ./$$i ] ; then \ | |
193 | if (rootme=`pwd`/ ; export rootme ; \ | |
194 | rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \ | |
195 | cd ./$$i; \ | |
196 | $(MAKE) $(TARGET_FLAGS_TO_PASS) $(DO)) ; then true ; \ | |
197 | else exit 1 ; fi ; \ | |
198 | else true ; fi ; \ | |
199 | done | |
200 | ||
201 | force:; | |
202 | ||
203 | subdirs: | |
696d5a5b | 204 | for dir in ${ALL_SUBDIRS} ; \ |
c906108c SS |
205 | do \ |
206 | echo "$$dir:" ; \ | |
207 | if [ -d $$dir ] ; then \ | |
208 | (rootme=`pwd`/ ; export rootme ; \ | |
209 | rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \ | |
210 | cd $$dir; $(MAKE) $(TARGET_FLAGS_TO_PASS)); \ | |
211 | fi; \ | |
212 | done | |
213 | ||
214 | clean mostlyclean: | |
1d41d745 MS |
215 | -rm -f *~ core *.o a.out xgdb *.x *.grt bigcore.corefile .gdb_history |
216 | -rm -f core.* *.tf *.cl *.py tracecommandsscript copy1.txt zzz-gdbscript | |
957df313 | 217 | -rm -f *.dwo *.dwp |
696d5a5b DJ |
218 | if [ x"${ALL_SUBDIRS}" != x ] ; then \ |
219 | for dir in ${ALL_SUBDIRS}; \ | |
c906108c SS |
220 | do \ |
221 | echo "$$dir:"; \ | |
222 | if [ -d $$dir ]; then \ | |
223 | (cd $$dir; $(MAKE) clean); \ | |
224 | fi; \ | |
225 | done ; \ | |
226 | else true; fi | |
227 | ||
228 | distclean maintainer-clean realclean: clean | |
229 | -rm -f *~ core | |
230 | -rm -f Makefile config.status *-init.exp | |
231 | -rm -fr *.log summary detail *.plog *.sum *.psum site.* | |
696d5a5b DJ |
232 | if [ x"${ALL_SUBDIRS}" != x ] ; then \ |
233 | for dir in ${ALL_SUBDIRS}; \ | |
c906108c SS |
234 | do \ |
235 | echo "$$dir:"; \ | |
236 | if [ -d $$dir ]; then \ | |
237 | (cd $$dir; $(MAKE) distclean); \ | |
238 | fi; \ | |
239 | done ; \ | |
240 | else true; fi | |
241 | ||
a4ce5b0d | 242 | Makefile : Makefile.in config.status $(host_makefile_frag) |
c906108c SS |
243 | $(SHELL) config.status |
244 | ||
245 | config.status: configure | |
246 | $(SHELL) config.status --recheck | |
6bf58e63 TT |
247 | |
248 | TAGS: force | |
967d1f9b TT |
249 | find $(srcdir) -name '*.exp' -print | \ |
250 | etags --regex='/proc[ \t]+\([^ \t]+\)/\1/' - |