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