1 ##Copyright (C) 1989-1991 Free Software Foundation, Inc.
3 # This file is part of GDB.
5 # GDB is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 1, or (at your option)
10 # GDB is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GDB; see the file COPYING. If not, write to
17 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 # Place to install binaries.
22 # System V: If you compile gdb with a compiler which uses the coff
23 # encapsulation feature (this is a function of the compiler used, NOT
24 # of the m-?.h file selected by config.gdb), you must make sure that
25 # the GNU nm is the one that is used by munch.
27 # If you are compiling with GCC, make sure that either 1) You use the
28 # -traditional flag, or 2) You have the fixed include files where GCC
29 # can reach them. Otherwise the ioctl calls in inflow.c and readline.c
30 # will be incorrectly compiled. The "fixincludes" script in the gcc
31 # distribution will fix your include files up.
38 # It is also possible that you will need to add -I/usr/include/sys to the
39 # CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
40 # is where it should be according to Posix).
47 # Set this up with gcc if you have gnu ld and the loader will print out
48 # line numbers for undefinded refs.
52 # define this to be "gmalloc.o" if you want to use the gnu malloc routine
53 # (useful for debugging memory allocation problems in gdb). To use your
54 # system malloc, uncomment the following two lines.
56 #MALLOC_CFLAGS = -DNO_MALLOC_CHECK
57 GNU_MALLOC = gmalloc.o mcheck.o mtrace.o
60 # Where is the "include" directory? Traditionally ../include or ./include
61 INCLUDE_DIR = ${srcdir}/../include
62 INCLUDE_DEP = $$(INCLUDE_DIR)
64 # Where is the BFD library? Traditionally ../bfd or ./bfd
65 BFD_DIR = ${srcdir}/../bfd
68 # All the includes used for CFLAGS and for lint.
69 # -I. for config files.
70 # -I${srcdir} possibly for regex.h also.
71 INCLUDE_CFLAGS = -I. -I${srcdir} -I$(INCLUDE_DIR) -I${srcdir}/vx-share
73 # {X,T}M_CFLAGS, if defined, has system-dependent CFLAGS.
74 # CFLAGS for both GDB and readline.
75 GLOBAL_CFLAGS = -g ${TM_CFLAGS} ${XM_CFLAGS}
78 CFLAGS = ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} ${MALLOC_CFLAGS} ${INCLUDE_CFLAGS}
79 # None of the things in CFLAGS will do any harm, and on some systems
80 # (e.g. SunOS4) it is important to use the M_CFLAGS.
83 # Where is the "-liberty" library, containing getopt and obstack?
84 LIBIBERTY = ${srcdir}/../libiberty/libiberty.a
86 # Flags that describe where you can find the termcap library.
87 # You may need to make other arrangements for USG.
90 # You must define REGEX and REGEX1 on USG machines.
91 # If your sysyem is missing alloca(), or, more likely, it's there but
92 # it doesn't work, define ALLOCA & ALLOCA1
94 # {X,T}M_CLIBS, if defined, has system-dependent libs
95 # For example, -lPW for System V to get alloca().
96 # FIXME STOPGAP FOR BFD LIBRARY: BFD stuff
97 CLIBS = ${TERMCAP} $(XM_CLIBS) ${TM_CLIBS} ${BFD_DIR}/libbfd.a \
99 CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_DIR}/libbfd.a \
102 ADD_FILES = ${REGEX} ${ALLOCA} ${GNU_MALLOC}
103 ADD_DEPS = ${REGEX1} ${ALLOCA1} ${GNU_MALLOC}
111 # Source files in the main directory.
112 # Files which are included via a tconfig/* or xconfig/* file
113 # should *not* be specified here; they're in "ALLDEPFILES".
115 blockframe.c breakpoint.c command.c core.c \
116 environ.c eval.c expprint.c findvar.c infcmd.c inflow.c infrun.c \
118 remote.c source.c stack.c symmisc.c symtab.c symfile.c \
119 utils.c valarith.c valops.c valprint.c values.c expread.y \
120 signame.c cplus-dem.c mem-break.c target.c inftarg.c \
121 dbxread.c coffread.c \
124 # Source files in subdirectories (which will be handled separately by
126 # Files which are included via a tconfig/* or xconfig/* file
127 # should *not* be specified here; they're in "ALLDEPFILES".
129 ${srcdir}/vx-share/dbgRpcLib.h \
130 ${srcdir}/vx-share/ptrace.h \
131 ${srcdir}/vx-share/reg.h \
132 ${srcdir}/vx-share/vxTypes.h \
133 ${srcdir}/vx-share/vxWorks.h \
134 ${srcdir}/vx-share/wait.h \
135 ${srcdir}/vx-share/xdr_ld.h \
136 ${srcdir}/vx-share/xdr_ptrace.h \
137 ${srcdir}/vx-share/xdr_rdb.h \
138 ${srcdir}/vx-share/xdr_regs.h \
139 ${srcdir}/nindy-share/Makefile \
140 ${srcdir}/nindy-share/VERSION \
141 ${srcdir}/nindy-share/b.out.h \
142 ${srcdir}/nindy-share/block_io.h \
143 ${srcdir}/nindy-share/coff.h \
144 ${srcdir}/nindy-share/demux.h \
145 ${srcdir}/nindy-share/env.h \
146 ${srcdir}/nindy-share/stop.h \
147 ${srcdir}/nindy-share/ttycntl.h
149 # All source files that go into linking GDB, except config-specified files.
150 SFILES = $(SFILES_MAINDIR) $(SFILES_SUBDIR)
152 # All source files that lint should look at
153 LINTFILES = $(SFILES) expread.tab.c init.c
155 # Any additional files specified on these lines should also be added to
156 # the OTHERS = definition below, so they go in the tar files.
157 SFILES_STAND = $(SFILES) standalone.c
158 SFILES_KGDB = $(SFILES) stuff.c kdb-start.c
160 # Header files that are not named in tconfig/* or xconfig/* go here.
161 HFILES= breakpoint.h command.h defs.h environ.h \
162 expression.h frame.h gdbcmd.h gdbcore.h \
163 getpagesize.h ieee-float.h inferior.h param-no-tm.h param.h \
164 signals.h signame.h symfile.h symtab.h \
165 target.h tdesc.h terminal.h tm-68k.h tm-i960.h tm-sunos.h \
168 OPCODES = pn-opcode.h np1-opcode.h sparc-opcode.h vax-opcode.h m68k-opcode.h \
169 ns32k-opcode.h convx-opcode.h pyr-opcode.h mips-opcode.h \
172 REMOTE_EXAMPLES = rem-m68k.shar rem-multi.shar
174 MALLOCSRC = gmalloc.c mcheck.c mtrace.c mtrace.awk \
175 ansidecl.h stdlib.h gmalloc.h stddef.h
177 POSSLIBS_MAINDIR = regex.c regex.h alloca.c $(MALLOCSRC)
178 POSSLIBS = $(POSSLIBS_MAINDIR)
180 TESTS = testbpt.c testfun.c testrec.c testreg.c testregs.c
182 # tdesc-lib cannot be named simply tdesc, because if if it were GNU make
183 # would try to make it from tdesc.c.
185 OTHERS = Makefile.dist depend alldeps.mak Makefile.sdir \
186 createtags munch config.gdb config.status \
187 ChangeLog ChangeLog-3.x \
188 README TODO TAGS WHATS.NEW \
189 gdb.texinfo gdbint.texinfo gdbrc.tex threecol.tex \
190 .gdbinit COPYING expread.tab.c stab.def \
191 copying.c Projects Convex.notes copying.awk \
192 saber.suppress standalone.c stuff.c kdb-start.c \
195 DEPFILES= ${TDEPFILES} ${XDEPFILES}
197 SOURCES=$(SFILES) $(ALLDEPFILES)
198 TAGFILES = $(SOURCES) ${HFILES} ${OPCODES} ${ALLPARAM} ${POSSLIBS}
199 TAGFILES_MAINDIR = $(SFILES_MAINDIR) $(ALLDEPFILES_MAINDIR) \
200 ${HFILES} ${OPCODES} ${ALLPARAM} ${POSSLIBS_MAINDIR}
201 TARFILES = ${TAGFILES_MAINDIR} ${OTHERS} ${REMOTE_EXAMPLES}
203 OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \
204 values.o eval.o valops.o valarith.o valprint.o printcmd.o \
205 symtab.o symfile.o symmisc.o infcmd.o infrun.o remote.o \
206 command.o utils.o expread.o expprint.o environ.o version.o \
207 copying.o $(DEPFILES) signame.o cplus-dem.o mem-break.o target.o \
208 inftarg.o ieee-float.o putenv.o \
209 dbxread.o coffread.o # mipsread.o
211 RAPP_OBS = rgdb.o rudp.o rserial.o serial.o udp.o $(XDEPFILES)
213 TSOBS = core.o inflow.o
215 NTSOBS = standalone.o
217 TSSTART = /lib/crt0.o
219 NTSSTART = kdb-start.o
221 RL_LIB = readline/libreadline.a
222 RL_LIB_DEP = $(RL_LIB)
224 # Prevent Sun make from putting in the machine type. Setting
225 # TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
227 ${CC} -c ${CFLAGS} $<
232 cp gdb $(bindir)/gdb.new
233 mv $(bindir)/gdb.new $(bindir)/gdb
236 init.c: $(srcdir)/munch $(MUNCH_DEFINE) $(OBS) $(TSOBS)
237 $(srcdir)/munch ${MUNCH_DEFINE} $(OBS) $(TSOBS) > init.c
239 gdb: $(OBS) $(TSOBS) ${ADD_DEPS} ${RL_LIB_DEP} ${CDEPS} init.o
240 ${CC-LD} $(LDFLAGS) -o gdb init.o $(OBS) $(TSOBS) $(ADD_FILES) \
243 saber_gdb: $(SFILES) $(DEPFILES) copying.c version.c
244 #setopt load_flags $(CFLAGS) -I$(BFD_DIR)
245 #load ./init.c $(SFILES)
246 #unload ${srcdir}/expread.y
247 #load ${srcdir}/expread.tab.c readline/libreadline.a
248 #load copying.c version.c
249 #load `echo " "$(DEPFILES) | sed -e 's/\.o/.c/g' -e 's, , ../,g'`
250 #load ${BFD_DIR}/libbfd.a -ltermcap
251 ##void mcheck(a) void (*a)(); { }
255 # This is useful when debugging GDB, because some Unix's don't let you run GDB
256 # on itself without copying the executable. So "make gdb1" will make
257 # gdb and put a copy in gdb1, and you can run it with "gdb gdb1".
258 # Removing gdb1 before the copy is the right thing if gdb1 is open
259 # in another process.
264 # This is a remote stub which runs under unix and starts up an
265 # inferior process. This is at least useful for debugging GDB's
269 ${srcdir}/munch ${RAPP_OBS} > rapp_init.c
270 ${CC-LD} $(LDFLAGS) -o $@ rapp_init.c $(RAPP_OBS)
272 Makefiles= Makefile.sdir $(M_MAKEFILE) \
273 ${srcdir}/alldeps.mak ${srcdir}/Makefile.dist
275 MAKE_MAKEFILE= echo "M_MAKEFILE=$(M_MAKEFILE)" | \
276 cat - ${Makefiles} ${srcdir}/depend >Makefile
278 Makefile: $(Makefiles)
281 alldeps.mak: ${srcdir}/tconfig ${srcdir}/xconfig
282 rm -f alldeps.mak alldeps.tmp allparam.tmp allconfig.tmp
283 for i in `ls -d ${srcdir}/tconfig/*[0-9A-Za-z] \
284 ${srcdir}/xconfig/*[0-9A-Za-z] | grep -v RCS` ; do \
285 echo $$i >>allconfig.tmp; \
287 $$1 == "TDEPFILES=" || $$1 == "XDEPFILES=" { \
288 for (i = 2; i <= NF; i++) \
289 print $$i >> "alldeps.tmp" ; \
291 $$1 == "TM_FILE=" || $$1 == "XM_FILE=" { \
292 print $$2 >> "allparam.tmp" }' ; \
294 sort <alldeps.tmp | uniq | \
295 sed -e 's/arm-convert.o/arm-convert.s/' \
296 -e 's!^Onindy.o!nindy-share/Onindy.c!' \
297 -e 's!^nindy.o!nindy-share/nindy.c!' \
298 -e 's!ttybreak.o!nindy-share/ttybreak.c!' \
299 -e 's!ttyflush.o!nindy-share/ttyflush.c!' \
300 -e 's!xdr_ld.o!vx-share/xdr_ld.c!' \
301 -e 's!xdr_ptrace.o!vx-share/xdr_ptrace.c!' \
302 -e 's!xdr_rdb.o!vx-share/xdr_rdb.c!' \
303 -e 's!xdr_regs.o!vx-share/xdr_regs.c!' \
306 echo 'ALLDEPFILES = $$(ALLDEPFILES_MAINDIR) $$(ALLDEPFILES_SUBDIR)' \
308 grep -v / alldeps2.tmp | \
309 awk 'BEGIN {printf "ALLDEPFILES_MAINDIR="} \
310 NR == 0 {printf $$0;} \
311 NR != 0 {printf "\\\n" $$0} \
312 END {printf "\n\n"}' >>alldeps.mak;
313 grep / alldeps2.tmp | \
314 awk 'BEGIN {printf "ALLDEPFILES_SUBDIR="} \
315 NR == 0 {printf $$0;} \
316 NR != 0 {printf "\\\n" $$0} \
317 END {printf "\n\n"}' >>alldeps.mak;
318 sort <allparam.tmp | uniq | awk 'BEGIN {printf "ALLPARAM="} \
319 NR == 0 {printf $$0;} \
320 NR != 0 {printf "\\\n" $$0} \
321 END {printf "\n\n"}' >>alldeps.mak;
322 sort <allconfig.tmp | uniq | awk 'BEGIN {printf "ALLCONFIG="} \
323 NR == 0 {printf $$0;} \
324 NR != 0 {printf "\\\n" $$0} \
325 END {printf "\n\n"}' >>alldeps.mak;
326 rm -f alldeps.tmp alldeps2.tmp allparam.tmp allconfig.tmp
328 # The sed script makes everything which depends on {x,t}m.h depend on
329 # config.status as well, in case someone reconfigures gdb out from
330 # under an already compiled gdb.
331 depend: $(SOURCES) Makefile.dist
332 @echo Ignore errors about non-existent system-supplied include files
333 @echo for systems other than the one you are using.
334 @echo "If xm.h and tm.h don't exist, the error messages saying so"
335 @echo can safely be ignored.
336 @echo Also ignore parse errors in valops.c, and any errors in
338 -$(GCC) -MM $(CFLAGS) -I$(BFD_DIR) \
339 `ls $(SOURCES) | sort -u` >depend.tmp
340 <depend.tmp sed -e 's/ [xt]m.h/& config.status/g' \
341 -e 's; vx-share/; $${srcdir}/vx-share/;g' \
342 -e 's; nindy-share/; $${srcdir}/nindy-share/;g' \
343 -e 's; $(INCLUDE_DIR)/; $(INCLUDE_DEP)/;g' \
344 -e 's; [a-z0-9./]*bfd/; $(BFD_DEP)/;g' \
345 -e 's; \./; $${srcdir}/;g' \
351 @echo "You must configure gdb. Look at the README file for details."
354 # These are not generated by "make depend" because they only are there
356 # But these rules don't do what we want; we want to hack the foo.o: tm.h
357 # dependency to do the right thing.
358 tm-isi.h tm-sun3.h tm-news.h tm-hp300bsd.h tm-altos.h : tm-68k.h
359 tm-hp300hpux.h tm-sun2.h tm-3b1.h : tm-68k.h
360 xm-news1000.h : xm-news.h
361 xm-i386-sv32.h : xm-i386.h
362 tm-i386gas.h: tm-i386.h
363 xm-sun4os4.h : xm-sparc.h
364 tm-sun4os4.h : tm-sparc.h
366 kdb : $(NTSSTART) $(OBS) $(NTSOBS) ${ADD_DEPS} ${RL_LIB_DEP}
368 $(srcdir)/munch ${MUNCH_DEFINE} $(OBS) $(NTSOBS) > init.c
369 $(CC) $(LDFLAGS) -c init.c $(CLIBS)
370 ld -o kdb $(NTSSTART) $(OBS) $(NTSOBS) init.o $(ADD_FILES) \
371 ${RL_LIB} -lc $(CLIBS)
373 # Put the proper machine-specific files first.
374 # createtags will edit the .o in DEPFILES into .c
376 $(srcdir)/createtags $(TM_FILE) ${XM_FILE} $(DEPFILES) ${TAGFILES}
379 # FIXME: Get alldeps.mak up to date, config.gdb none, THEN make gdb.tar.Z!
380 gdb.tar.Z: ${TARFILES}
381 rm -f gdb.tar; rm -rf $(DIST)
382 cd readline ; make readline.tar
384 cd $(DIST) ; for i in ${TARFILES} ; do ln -s ../$$i . ; done
385 mkdir $(DIST)/readline
386 cd $(DIST)/readline ; tar xf ../../readline/readline.tar
387 mkdir $(DIST)/xconfig ${DIST}/tconfig
388 cd $(DIST)/tconfig ; \
389 for i in $(ALLCONFIG) ; do ln -s ../../$$i ../$$i ; done
390 mkdir $(DIST)/vx-share $(DIST)/nindy-share
391 cd $(DIST)/tconfig ; \
392 for i in $(SFILES_SUBDIR) $(ALLDEPFILES_SUBDIR); \
393 do ln -s ../../$$i ../$$i ; done
394 tar chf - $(DIST) | compress >gdb.tar.Z
398 rm -f ${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES}
399 rm -f init.c init.o version.c
400 rm -f gdb core gdb.tar gdb.tar.Z make.log
402 cd readline ; make clean
404 distclean: clean expread.tab.c TAGS
405 rm -f tm.h xm.h config.status
406 rm -f y.output yacc.acts yacc.tmp
407 rm -f ${TESTS} Makefile
410 rm -f expread.tab.c TAGS
411 rm -f tm.h xm.h config.status
414 gdb.dvi : gdb.texinfo
419 # Make copying.c from COPYING
420 copying.c : COPYING copying.awk
421 awk -f copying.awk < COPYING > copying.c
423 version.c : Makefile.dist
424 echo 'char *version = "$(VERSION)";' >version.c
426 ${srcdir}/expread.tab.c : $(srcdir)/expread.y
427 @echo 'Expect 4 shift/reduce conflict.'
428 ${YACC} $(srcdir)/expread.y
429 mv y.tab.c ${srcdir}/expread.tab.c
431 expread.o : ${srcdir}/expread.tab.c defs.h param.h symtab.h \
433 $(CC) -c ${CFLAGS} `echo ${srcdir}/expread.tab.c | sed 's,^\./,,'`
434 mv expread.tab.o expread.o
436 # dbxread, coffread, mipsread have dependencies on BFD header files.
437 dbxread.o: ${srcdir}/dbxread.c
438 ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/dbxread.c
440 coffread.o: ${srcdir}/coffread.c
441 ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/coffread.c
443 mipsread.o: ${srcdir}/mipsread.c
444 ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/mipsread.c
446 # Drag in the files that are in another directory.
448 xdr_ld.o: ${srcdir}/vx-share/xdr_ld.c
449 ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_ld.c
451 xdr_ptrace.o: ${srcdir}/vx-share/xdr_ptrace.c
452 ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_ptrace.c
454 xdr_rdb.o: ${srcdir}/vx-share/xdr_rdb.c
455 ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_rdb.c
457 xdr_regs.o: ${srcdir}/vx-share/xdr_regs.c
458 ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_regs.c
460 nindy.o: ${srcdir}/nindy-share/nindy.c
461 ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/nindy.c
463 Onindy.o: ${srcdir}/nindy-share/Onindy.c
464 ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/Onindy.c
466 ttybreak.o: ${srcdir}/nindy-share/ttybreak.c
467 ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/ttybreak.c
469 ttyflush.o: ${srcdir}/nindy-share/ttyflush.c
470 ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/ttyflush.c
472 tdesc-lib/libdc.o : force_update
473 cd tdesc-lib ; ${MAKE} "SYSV_DEFINE=${SYSV_DEFINE}"
475 # In LOCAL_INCLUDES, -I${srcdir} is right if srcdir is an absolute path,
476 # and -I../${srcdir} is right if it is relative (e.g. ".."), so search both.
477 readline/libreadline.a : force_update
478 cd readline ; ${MAKE} "SYSV=${SYSV_DEFINE}"\
479 "VPATH=${srcdir}/readline:../${srcdir}/readline"\
480 "LOCAL_INCLUDES=-I../ -I${srcdir}/ -I../${srcdir}/"\
481 "DEBUG_FLAGS=${GLOBAL_CFLAGS}" "CC=${CC}" libreadline.a
484 $(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES)
487 cxref -I. $(SFILES) >gdb.cxref
491 # When used with GDB, the demangler should never look for leading
492 # underscores because GDB strips them off during symbol read-in. Thus
495 cplus-dem.o : cplus-dem.c
496 ${CC} -c ${CFLAGS} -Dnounderscore \
497 `echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'`