OSDN Git Service

06c9a770bc5427df8c7c1df90401fb7fae1dc0f2
[pf3gnuchains/pf3gnuchains3x.git] / gdb / testsuite / Makefile.in
1 # Makefile for regression testing the GNU debugger.
2 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003, 2004,
3 # 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
4
5 # This file is part of GDB.
6
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 3 of the License, or
10 # (at your option) any later version.
11 #
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.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 VPATH = @srcdir@
21 srcdir = @srcdir@
22 prefix = @prefix@
23 exec_prefix = @exec_prefix@
24 abs_builddir = @abs_builddir@
25
26 target_alias = @target_noncanonical@
27 program_transform_name = @program_transform_name@
28 build_canonical = @build@
29 host_canonical = @host@
30 target_canonical = @target@
31
32 SHELL = @SHELL@
33 EXEEXT = @EXEEXT@
34 SUBDIRS = @subdirs@
35 RPATH_ENVVAR = @RPATH_ENVVAR@
36 ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cp gdb.disasm \
37         gdb.dwarf2 \
38         gdb.fortran gdb.server gdb.java gdb.mi gdb.multi \
39         gdb.objc gdb.opt gdb.pascal gdb.python gdb.threads gdb.trace \
40         gdb.xml \
41         $(SUBDIRS)
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
51 FORCE_PARALLEL =
52
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 \
60       t='$(program_transform_name)'; echo runtest | sed -e $$t; \
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)" \
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:
96 pdf:
97 install-pdf:
98 html:
99 install-html:
100
101 install:
102
103 uninstall: force
104
105 # Use absolute `site.exp' path everywhere to suppress VPATH lookups for it.
106 # Bare `site.exp' is used as a target here if user requests it explicitly.
107 # $(RUNTEST) is looking up `site.exp' only in the current directory.
108
109 $(abs_builddir)/site.exp site.exp: ./config.status Makefile
110         @echo "Making a new config file..."
111         -@rm -f ./tmp?
112         @touch site.exp
113         -@mv site.exp site.bak
114         @echo "## these variables are automatically generated by make ##" > ./tmp0
115         @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
116         @echo "# add them to the last section" >> ./tmp0
117         @echo "set host_triplet ${host_canonical}" >> ./tmp0
118         @echo "set target_alias $(target_alias)" >> ./tmp0
119         @echo "set target_triplet ${target_canonical}" >> ./tmp0
120         @echo "set build_triplet ${build_canonical}" >> ./tmp0
121         @echo "set srcdir ${srcdir}" >> ./tmp0
122         @echo "set tool gdb" >> ./tmp0
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
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 = \
143         rootme=`pwd`; export rootme; \
144         srcdir=${srcdir} ; export srcdir ; \
145         EXPECT=${EXPECT} ; export EXPECT ; \
146         EXEEXT=${EXEEXT} ; export EXEEXT ; \
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 ; \
152         $(RUNTEST)
153
154 check-single: all $(abs_builddir)/site.exp
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
177 $(filter-out check-gdb.base%,$(TEST_TARGETS)): check-gdb.%: all $(abs_builddir)/site.exp
178         @if test ! -d gdb.$*; then mkdir gdb.$*; fi
179         $(DO_RUNTEST) --directory=gdb.$* --outdir=gdb.$* $(RUNTESTFLAGS)
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.
186 check-gdb.base%: all $(abs_builddir)/site.exp
187         @if test ! -d gdb.base$*; then mkdir gdb.base$*; fi
188         $(DO_RUNTEST) $(BASE$*_FILES) --outdir gdb.base$* $(RUNTESTFLAGS)
189
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:
204         for dir in ${ALL_SUBDIRS} ; \
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:
215         -rm -f *~ core *.o a.out xgdb *.x *.grt
216         if [ x"${ALL_SUBDIRS}" != x ] ; then \
217             for dir in ${ALL_SUBDIRS}; \
218             do \
219                     echo "$$dir:"; \
220                     if [ -d $$dir ]; then \
221                             (cd $$dir; $(MAKE) clean); \
222                     fi; \
223             done ; \
224         else true; fi
225
226 distclean maintainer-clean realclean: clean
227         -rm -f *~ core
228         -rm -f Makefile config.status *-init.exp
229         -rm -fr *.log summary detail *.plog *.sum *.psum site.*
230         if [ x"${ALL_SUBDIRS}" != x ] ; then \
231             for dir in ${ALL_SUBDIRS}; \
232             do \
233                     echo "$$dir:"; \
234                     if [ -d $$dir ]; then \
235                             (cd $$dir; $(MAKE) distclean); \
236                     fi; \
237             done ; \
238         else true; fi
239
240 Makefile : Makefile.in config.status $(host_makefile_frag)
241         $(SHELL) config.status
242
243 config.status: configure
244         $(SHELL) config.status --recheck