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