Reorganized GDB tests - base
[external/binutils.git] / gdb / testsuite / gdb.base / Makefile.in
1 # Makefile for regression testing the GNU debugger.
2 #   Copyright (C) 1992, 93, 1994 Free Software Foundation, Inc.
3
4 # This file is part of GDB.
5
6 # GDB is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10
11 # GDB is distributed in the hope that it will be useful,
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.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; see the file COPYING.  If not, write to
18 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 srcdir = .
21 prefix = /usr/local
22 program_transform_name =
23
24 exec_prefix = $(prefix)
25 bindir = $(exec_prefix)/bin
26 libdir = $(exec_prefix)/lib
27 tooldir = $(libdir)/$(target_alias)
28
29 datadir = $(exec_prefix)/lib/dejagnu
30 mandir = $(prefix)/man
31 man1dir = $(mandir)/man1
32 man2dir = $(mandir)/man2
33 man3dir = $(mandir)/man3
34 man4dir = $(mandir)/man4
35 man5dir = $(mandir)/man5
36 man6dir = $(mandir)/man6
37 man7dir = $(mandir)/man7
38 man8dir = $(mandir)/man8
39 man9dir = $(mandir)/man9
40 infodir = $(prefix)/info
41 includedir = $(prefix)/include
42 gxx_includedir = $(tooldir)/g++-include
43 docdir = $(datadir)/doc
44 targetdir = $(datadir)/$(target_alias)
45
46 SHELL = /bin/sh
47
48 INSTALL = install -c
49 INSTALL_PROGRAM = $(INSTALL)
50 INSTALL_DATA = $(INSTALL)
51
52 CFLAGS = -g
53 # start-sanitize-chill
54 CHILLFLAGS = $(CFLAGS)
55 # end-sanitize-chill
56 # This should probably be consistent with the top-level Makefile.in,
57 # gdb/Makefile.in, and gdb/testsuite/gdb.t2*/Makefile.in, so that "make check"
58 # has the same effect no matter where it is run.
59 CXXFLAGS = -g -O
60
61 LINK=           ln -s
62
63 RUNTEST = runtest
64
65 EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \
66           echo $${rootme}/../../expect/expect ; \
67           else echo expect ; fi`
68
69 RUNTEST_FOR_TARGET = ` \
70   if [ -f $${rootme}/../../dejagnu/site.exp ] ; then \
71     echo $${rootme}/../../dejagnu/runtest ; \
72   else \
73     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
74       echo $(RUNTEST); \
75     else \
76       t='$(program_transform_name)'; echo runtest | sed -e '' $$t; \
77     fi; \
78   fi`
79
80 RUNTESTFLAGS = 
81
82 CC_FOR_TARGET = ` \
83   if [ -f $${rootme}/../../gcc/xgcc ] ; then \
84     echo $${rootme}/../../gcc/xgcc -B$${rootme}/../../gcc/; \
85   else \
86     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
87       echo $(CC); \
88     else \
89       t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
90     fi; \
91   fi`
92
93 CFLAGS_FOR_TARGET = $(CFLAGS)
94
95 GDB = ` \
96   if [ -f $${rootme}/../gdb ] ; \
97     then echo $${rootme}|sed -e 's@/[^/]*$$@@'|sed -e 's@$$@/gdb@' ; \
98     else echo gdb; \
99   fi`
100
101 GDBFLAGS = -nx
102
103 #### host, target, and site specific Makefile frags come in here.
104
105 EXECUTABLES =  \
106         bitfields  \
107         break  \
108         callfuncs  \
109         coremaker  \
110         exprs  \
111         funcargs  \
112         interrupt  \
113         list  \
114         mips_pro  \
115         nodebug  \
116         opaque  \
117         opaque-info.exp  \
118         printcmds  \
119         ptype  \
120         recurse  \
121         return  \
122         run  \
123         scope  \
124         setvar  \
125         signals  \
126         t10  \
127         twice  \
128         watchpoint  \
129         whatis  \
130         whatis-info.exp  \
131         $(CROSS_EXECUTABLES)
132
133 # List of test executables that we have available.  They are kept in
134 # uuencoded format to avoid SCCS/RCS problems with binary files.
135
136 CROSS_EXECUTABLES =  \
137         i486-elf  \
138         i860-elf  \
139         m68k-elf  \
140         m68k-aout  \
141         m68k-aout2  \
142         mips-ecoff  \
143         sparc-aout  \
144         sparc-elf
145
146 all:    $(EXECUTABLES) corefile
147
148 CC_CFLAGS_LD_FOR_TARGET = $(CC_FOR_TARGET) $(CFLAGS) $(LDFLAGS_FOR_TARGET)
149
150 CC_CFLAGS_FOR_TARGET = $(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET)
151
152 run: run.o
153         $(CC_CFLAGS_LD_FOR_TARGET) -o run run.o $(LIBS)
154
155 run.o: run.c
156         $(CC_FOR_TARGET) $(CFLAGS) -c $(srcdir)/run.c
157
158 # We want to make sure comp-info.exp reflects the way that whatis was compiled;
159 # that's why this isn't a separate rule.
160
161 whatis whatis-info.exp: whatis.o
162         $(CC_CFLAGS_LD_FOR_TARGET) -o whatis.tmp whatis.o $(LIBS)
163         $(CC_FOR_TARGET) $(CFLAGS) -E $(srcdir)/whatis-info.c >whatis-info.tmp
164         mv whatis-info.tmp whatis-info.exp
165         mv whatis.tmp whatis
166
167 .PRECIOUS: whatis whatis-info.exp
168
169 whatis.o: whatis.c
170         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/whatis.c
171
172 ptype: ptype.o
173         $(CC_CFLAGS_LD_FOR_TARGET) -o ptype ptype.o $(LIBS)
174
175 ptype.o: ptype.c
176         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/ptype.c
177
178 setvar: setvar.o
179         $(CC_CFLAGS_LD_FOR_TARGET) -o setvar setvar.o $(LIBS)
180
181 setvar.o: setvar.c
182         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/setvar.c
183
184 exprs: exprs.o
185         $(CC_CFLAGS_LD_FOR_TARGET) -o exprs exprs.o $(LIBS)
186
187 exprs.o: exprs.c
188         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/exprs.c
189
190 break: break.o
191         $(CC_CFLAGS_LD_FOR_TARGET) -o break break.o $(LIBS)
192
193 break.o: break.c
194         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/break.c
195
196 signals: signals.o
197         ${CC} ${CFLAGS} ${LDFLAGS_FOR_TARGET} -o signals signals.o ${LIBS}
198
199 signals.o: signals.c
200         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/signals.c
201
202 twice: twice.c
203         echo '#include "twice.c"' >twice-tmp.c
204         $(CC_CFLAGS_LD_FOR_TARGET) -I$(srcdir) -o twice twice-tmp.c $(LIBS)
205         rm -f twice-tmp.c
206
207 watchpoint: watchpoint.o
208         $(CC_CFLAGS_LD_FOR_TARGET) -o watchpoint watchpoint.o $(LIBS)
209
210 watchpoint.o: watchpoint.c
211         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/watchpoint.c
212
213 recurse: recurse.o
214         $(CC_CFLAGS_LD_FOR_TARGET) -o recurse recurse.o $(LIBS)
215
216 recurse.o: recurse.c
217         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/recurse.c
218
219 # We want to make sure opaque-info.exp reflects the way that opaque
220 # was compiled; that's why this isn't a separate rule.
221
222 opaque opaque-info.exp: opaque0.o opaque1.o
223         $(CC_CFLAGS_LD_FOR_TARGET) -o opaque.tmp opaque0.o opaque1.o $(LIBS)
224         $(CC_CFLAGS_FOR_TARGET) -E $(srcdir)/opaque-info.c >opaque-info.tmp
225         mv opaque-info.tmp opaque-info.exp
226         mv opaque.tmp opaque
227
228 opaque0.o: opaque0.c
229         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/opaque0.c
230
231 opaque1.o: opaque1.c
232         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/opaque1.c
233
234 coremaker: coremaker.o
235         $(CC_CFLAGS_LD_FOR_TARGET) -o coremaker coremaker.o $(LIBS)
236
237 coremaker.o: coremaker.c
238         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/coremaker.c
239
240 # Create a core file named "corefile" rather than just "core", to
241 # avoid problems with sys admin types that like to regularly prune all
242 # files named "core" from the system.
243 # bsd 386 systems append the name of the program to the corefile name.
244
245 corefile: coremaker
246         -rm -f core
247         -echo Expect a coredump from this next command...
248         -./coremaker >/dev/null 2>&1 || true
249         -if [ -f core ]; then mv core corefile; else true; fi
250         -if [ -f core.coremaker ]; then mv core.coremaker corefile; else true; fi
251
252 nodebug: nodebug.o
253         $(CC_FOR_TARGET) $(LDFLAGS_FOR_TARGET) -o nodebug nodebug.o $(LIBS)
254
255 # This gets compiled *without* -g, so don't add CFLAGS here.
256
257 nodebug.o: nodebug.c
258         $(CC_FOR_TARGET) -c $(srcdir)/nodebug.c
259
260 # For VPATH and Sun Make, we have to make explicit dependencies.
261 # DEC make doesn't seem to understand the ".u" dependency w/VPATH either.
262
263 m68k-elf: $(srcdir)/m68k-elf.u
264         uudecode $(srcdir)/m68k-elf.u
265
266 m68k-aout: $(srcdir)/m68k-aout.u
267         uudecode $(srcdir)/m68k-aout.u
268
269 m68k-aout2: $(srcdir)/m68k-aout2.u
270         uudecode $(srcdir)/m68k-aout2.u
271
272 mips-ecoff: $(srcdir)/mips-ecoff.u
273         uudecode $(srcdir)/mips-ecoff.u
274
275 i486-elf: $(srcdir)/i486-elf.u
276         uudecode $(srcdir)/i486-elf.u
277
278 sparc-aout: $(srcdir)/sparc-aout.u
279         uudecode $(srcdir)/sparc-aout.u
280
281 i860-elf: $(srcdir)/i860-elf.u
282         uudecode $(srcdir)/i860-elf.u
283
284 sparc-elf: $(srcdir)/sparc-elf.u
285         uudecode $(srcdir)/sparc-elf.u
286
287 t10: t10.o
288         $(CC_CFLAGS_LD_FOR_TARGET) -o t10 t10.o $(LIBS)
289
290 list: list0.o list1.o
291         $(CC_CFLAGS_LD_FOR_TARGET) -o list list0.o list1.o $(LIBS)
292
293 list0.o: list0.c list0.h
294         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/list0.c
295
296 list1.o: list1.c
297         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/list1.c
298
299 scope: scope0.o scope1.o
300         $(CC_CFLAGS_LD_FOR_TARGET) -o scope scope0.o scope1.o $(LIBS)
301
302 scope0.o: scope0.c
303         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/scope0.c
304
305 scope1.o: scope1.c
306         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/scope1.c
307
308 bitfields: bitfields.o
309         $(CC_CFLAGS_LD_FOR_TARGET) -o bitfields.tmp bitfields.o $(LIBS)
310         mv bitfields.tmp bitfields
311
312 .PRECIOUS: bitfields
313
314 bitfields.o: bitfields.c
315         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/bitfields.c
316
317 funcargs: funcargs.o
318         $(CC_CFLAGS_LD_FOR_TARGET) -o funcargs funcargs.o $(LIBS)
319
320 funcargs.o: funcargs.c
321         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/funcargs.c
322
323 return: return.o
324         $(CC_CFLAGS_LD_FOR_TARGET) -o return return.o $(LIBS)
325
326 return.o: return.c
327         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/return.c
328
329 mips_pro: mips_pro.o
330         $(CC_CFLAGS_LD_FOR_TARGET) -o mips_pro mips_pro.o $(LIBS)
331
332 mips_pro.o: mips_pro.c
333         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/mips_pro.c
334
335 printcmds: printcmds.o
336         $(CC_CFLAGS_LD_FOR_TARGET) -o printcmds printcmds.o $(LIBS)
337
338 printcmds.o: printcmds.c
339         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/printcmds.c
340
341 callfuncs: callfuncs.o
342         $(CC_CFLAGS_LD_FOR_TARGET) -o callfuncs callfuncs.o $(LIBS)
343
344 callfuncs.o: callfuncs.c
345         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/callfuncs.c
346
347 interrupt: interrupt.o
348         $(CC_CFLAGS_LD_FOR_TARGET) -o interrupt interrupt.o $(LIBS)
349
350 interrupt.o: interrupt.c
351         $(CC_CFLAGS_FOR_TARGET) -c $(srcdir)/interrupt.c
352
353 .NOEXPORT:
354 INFODIRS=doc
355 info:
356 install-info:
357 dvi:
358
359 install:
360
361 uninstall: force
362
363 site.exp: ./config.status Makefile
364         @echo "Making a new config file..."
365         -@rm -f ./tmp?
366         @touch site.exp
367         -@mv site.exp site.bak
368         @echo "## these variables are automatically generated by make ##" > ./tmp0
369         @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
370         @echo "# add them to the last section" >> ./tmp0
371         @echo "set GDBFLAGS \"${GDBFLAGS}\"" >> ./tmp0
372         @echo "set host_os ${host_os}" >> ./tmp0
373         @echo "set host_alias ${host_alias}" >> ./tmp0
374         @echo "set host_cpu ${host_cpu}" >> ./tmp0
375         @echo "set host_vendor ${host_vendor}" >> ./tmp0
376         @echo "set target_os ${target_os}" >> ./tmp0
377         @echo "set target_alias ${target_alias}" >> ./tmp0
378         @echo "set target_cpu ${target_cpu}" >> ./tmp0
379         @echo "set target_vendor ${target_vendor}" >> ./tmp0
380         @echo "set host_triplet ${host_canonical}" >> ./tmp0
381         @echo "set target_triplet ${target_canonical}" >> ./tmp0
382         @echo "set srcdir ${srcdir}" >> ./tmp0
383                 @echo "set objdir `pwd`" >> ./tmp0
384         @echo "set tool gdb" >> ./tmp0
385         @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
386                 @cat ./tmp0 > site.exp
387         @cat site.bak | sed \
388                         -e '1,/^## All variables above are.*##/ d' >> site.exp
389         -@rm -f ./tmp?
390
391 installcheck:
392 check: site.exp all just-check
393 just-check:
394         rootme=`pwd`; export rootme; \
395         srcdir=${srcdir} ; export srcdir ; \
396         EXPECT=${EXPECT} ; export EXPECT ; \
397         if [ -f $${rootme}/../../expect/expect ] ; then  \
398           TCL_LIBRARY=$${srcdir}/../../tcl/library ; \
399           export TCL_LIBRARY ; fi ; \
400         $(RUNTEST_FOR_TARGET) $(RUNTESTFLAGS) --tool gdb GDB=$(GDB) --srcdir $(srcdir)
401
402 clean mostlyclean:
403         -rm -f *~ *.o a.out xgdb *.x $(EXECUTABLES)
404         -rm -f core core.coremaker corefile
405
406 distclean realclean: clean
407         -rm -f *~ core *.log *.plog *.sum *.psum site.*
408         -rm -f Makefile config.status *-init.exp
409         -rm -fr *.log summary detail *.plog *.sum *.psum site.*
410
411 Makefile : $(srcdir)/Makefile.in $(srcdir)/configure.in $(host_makefile_frag) $(target_makefile_frag)
412         $(SHELL) ./config.status
413