xref: /386bsd/usr/src/usr.bin/gdb/Makefile.dist (revision a2142627)
1/* This file should be run through the C preprocessor by config.gdb
2   to produce the Makefile.  */
3
4/* Define this to xgdb if you want to compile xgdb as well as gdb.  */
5XGDB=
6/* Place to install binaries.  */
7bindir=/usr/local/bin
8/* Place to install X binaries.  */
9xbindir=$(bindir)
10
11/* System V: If you compile gdb with a compiler which uses the coff
12   encapsulation feature (this is a function of the compiler used, NOT
13   of the m-?.h file selected by config.gdb), you must make sure that
14   the GNU nm is the one that is used by munch.  */
15
16/* If you are compiling with GCC, make sure that either 1) You use the
17 -traditional flag, or 2) You have the fixed include files where GCC
18 can reach them.  Otherwise the ioctl calls in inflow.c and readline.c
19 will be incorrectly compiled.  The "fixincludes" script in the gcc
20 distribution will fix your include files up. */
21/* CC=gcc -traditional */
22CC=cc
23
24/* It is also possible that you will need to add -I/usr/include/sys to the
25 CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
26 is where it should be according to Posix).  */
27
28YACC=bison -y -v
29/* YACC=yacc */
30SHELL=/bin/sh
31MAKE=make
32
33/* Set this up with gcc if you have gnu ld and the loader will print out
34 line numbers for undefinded refs.  */
35/* CC-LD=gcc -static */
36CC-LD=${CC}
37
38/* If you are using the GNU C library, uncomment the following line.  */
39/* HAVE_VPRINTF_DEFINE = -DHAVE_VPRINTF */
40
41/* -I. for "#include <obstack.h>".  Possibly regex.h also. */
42
43/* M_CFLAGS, if defined, has system-dependent CFLAGS.  */
44#if !defined(M_CFLAGS)
45#define M_CFLAGS
46#endif
47
48/* CFLAGS for both GDB and readline.  */
49GLOBAL_CFLAGS = -g M_CFLAGS
50CFLAGS = -I. ${HAVE_VPRINTF_DEFINE} ${GLOBAL_CFLAGS}
51/* None of the things in CFLAGS will do any harm, and on some systems
52   (e.g. SunOS4) it is important to use the M_CFLAGS.  */
53LDFLAGS = $(CFLAGS)
54
55/*
56 define this to be "obstack.o" if you don't have the obstack library installed
57 you must at the same time define OBSTACK1 as "obstack.o"
58 so that the dependencies work right.  Similarly with REGEX and "regex.o".
59 You must define REGEX and REGEX1 on USG machines.
60 If your sysyem is missing alloca(), or, more likely, it's there but
61 it doesn't work, define ALLOCA & ALLOCA1 */
62OBSTACK = obstack.o
63OBSTACK1 = obstack.o
64
65#ifdef M_REGEX
66REGEX = M_REGEX
67REGEX1 = M_REGEX
68#else
69REGEX =
70REGEX1 =
71#endif
72
73#ifdef M_ALLOCA
74ALLOCA = M_ALLOCA
75ALLOCA1 = M_ALLOCA
76#else
77ALLOCA =
78ALLOCA1 =
79#endif
80
81/*
82 define this to be "malloc.o" if you want to use the gnu malloc routine
83 (useful for debugging memory allocation problems in gdb).  Otherwise, leave
84 it blank. */
85/* GNU_MALLOC = */
86GNU_MALLOC = malloc.o
87
88/* Flags to be used in compiling malloc.o
89 Specify range checking for storage allocation. */
90/* MALLOC_FLAGS = ${CFLAGS} */
91MALLOC_FLAGS = ${CFLAGS} -Drcheck -Dbotch=fatal_dump_core -DMSTATS
92
93/*  Define SYSV if compiling on a system V or HP machine.  */
94#ifdef M_SYSV
95SYSV_DEFINE = -DSYSV
96#else
97SYSV_DEFINE =
98#endif
99
100/* MUNCH_DEFINE should be -DSYSV if have System V-style nm,
101   or null if have BSD-style nm.  */
102#ifdef M_BSD_NM
103MUNCH_DEFINE =
104#else
105MUNCH_DEFINE = ${SYSV_DEFINE}
106#endif
107
108/* Flags that describe where you can find the termcap library.
109 You may need to make other arrangements for USG. */
110TERMCAP = -ltermcap
111
112/* M_CLIBS, if defined, has system-dependent libs
113 For example, -lPW for System V to get alloca().  */
114#ifndef M_CLIBS
115#define M_CLIBS
116#endif
117CLIBS = ${ADD_FILES} ${TERMCAP} M_CLIBS
118
119ADD_FILES = ${OBSTACK} ${REGEX} ${ALLOCA} ${GNU_MALLOC}
120ADD_DEPS = ${OBSTACK1} ${REGEX1} ${ALLOCA1} ${GNU_MALLOC}
121
122SFILES = blockframe.c breakpoint.c dbxread.c coffread.c command.c core.c \
123	 environ.c eval.c expprint.c findvar.c infcmd.c inflow.c infrun.c \
124	 kdb-start.c main.c printcmd.c \
125	 remote.c source.c stack.c standalone.c stuff.c symmisc.c symtab.c \
126	 utils.c valarith.c valops.c valprint.c values.c version.c expread.y \
127	 xgdb.c
128
129DEPFILES = umax-dep.c gould-dep.c default-dep.c sun3-dep.c \
130	   sparc-dep.c hp9k320-dep.c hp300bsd-dep.c news-dep.c i386-dep.c \
131	   symmetry-dep.c convex-dep.c altos-dep.c isi-dep.c pyr-dep.c
132
133PINSNS = gld-pinsn.c i386-pinsn.c sparc-pinsn.c vax-pinsn.c m68k-pinsn.c \
134	 ns32k-pinsn.c convex-pinsn.c pyr-pinsn.c
135
136HFILES = command.h defs.h environ.h expression.h frame.h getpagesize.h \
137	 inferior.h symseg.h symtab.h value.h wait.h \
138	 a.out.encap.h a.out.gnu.h stab.gnu.h
139
140OPCODES = m68k-opcode.h pn-opcode.h sparc-opcode.h npl-opcode.h vax-opcode.h \
141	  ns32k-opcode.h convex-opcode.h pyr-opcode.h
142
143MFILES = m-hp9k320.h m-hp300bsd.h m-i386.h m-i386gas.h \
144  m-i386-sv32.h m-i386g-sv32.h m-isi.h m-merlin.h \
145  m-altos.h m-news.h m-newsos3.h m-npl.h m-pn.h \
146  m-sparc.h m-sun2.h m-sun3.h m-sun2os4.h \
147  m-sun3os4.h m-sun4os4.h m-umax.h m-vax.h m-symmetry.h m-convex.h \
148  m-pyr.h
149
150/* This list of files really shouldn't be in this makefile, but I can't think
151   of any good way to get the readline makefile to tell us what files
152   to put in our tarfile.  */
153READLINE = readline.c history.c funmap.c \
154  emacs_keymap.c vi_keymap.c vi_mode.c keymaps.c \
155  readline.h history.h keymaps.h chardefs.h \
156  inc-readline.texinfo inc-history.texinfo \
157  readline.texinfo history.texinfo \
158  Makefile ChangeLog
159
160REMOTE_EXAMPLES = remote-sa.m68k.shar remote-multi.shar
161
162POSSLIBS = obstack.h obstack.c regex.c regex.h malloc.c alloca.c
163
164TESTS = testbpt.c testfun.c testrec.c testreg.c testregs.c
165
166OTHERS = Makefile.dist createtags munch config.gdb ChangeLog README TAGS \
167	 gdb.texinfo .gdbinit COPYING expread.tab.c stab.def \
168	 XGDB-README copying.c Projects Convex.notes copying.awk hp-include
169
170TAGFILES = ${SFILES} ${DEPFILES} ${PINSNS} ${HFILES} ${OPCODES} ${MFILES} \
171	   ${POSSLIBS}
172TARFILES = ${TAGFILES} ${OTHERS} ${REMOTE_EXAMPLES}
173
174OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \
175    values.o eval.o valops.o valarith.o valprint.o printcmd.o \
176    symtab.o symmisc.o coffread.o dbxread.o infcmd.o infrun.o remote.o \
177    command.o utils.o expread.o expprint.o pinsn.o environ.o version.o \
178    copying.o ${READLINEOBS}
179
180TSOBS = core.o inflow.o dep.o
181
182NTSOBS = standalone.o
183
184TSSTART = /lib/crt0.o
185
186NTSSTART = kdb-start.o
187
188RL_LIB = readline/libreadline.a
189
190/* Do some fancy trickery to produce a line like
191   -DM_MAKEDEFINE="-DM_SYSV -DM_BSD_NM".
192*/
193MD=M_MAKEDEFINE
194
195/* Avoid funny things that Sun's make throws in for us. */
196/* TARGET_ARCH is supposed to get around it putting in the machine type.
197   If the "things" up there really is plural, we'll need to do something
198   else as well.  */
199/*.c.o:
200	${CC} -c ${CFLAGS} $< */
201TARGET_ARCH=
202
203all: gdb $(XGDB)
204
205install: gdb $(XGDB)
206	cp gdb $(bindir)/gdb.new
207	mv $(bindir)/gdb.new $(bindir)/gdb
208	-if [ "$(XGDB)" = xgdb ]; then \
209		cp xgdb $(xbindir)/xgdb.new; \
210		mv $(xbindir)/xgdb.new $(xbindir)xgdb; \
211	fi
212
213gdb : $(OBS) $(TSOBS) ${ADD_DEPS} ${RL_LIB}
214	rm -f init.c
215	./munch ${MUNCH_DEFINE} $(OBS) $(TSOBS) > init.c
216	${CC-LD} $(LDFLAGS) -o gdb init.c $(OBS) $(TSOBS) ${RL_LIB} $(CLIBS)
217
218/* This is useful when debugging GDB, because Unix doesn't let you run GDB
219   on itself without copying the executable.  So "make gdb1" will make
220   gdb and put a copy in gdb1, and you can run it with "gdb gdb1".  */
221gdb1 : gdb
222	cp gdb gdb1
223
224Makefile : Makefile.dist
225	cp Makefile.dist tmp.c
226	$(CC) -E >Makefile tmp.c $(MD) "-DM_MAKEDEFINE=$(MD)"
227	-rm tmp.c
228/* This did not work-- -Usparc became "-Usparc" became "-Usparc.
229   Or something like that.  */
230/*	$(CC) -E >Makefile tmp.c $(MD) "-DM_MAKEDEFINE=\"$(MD)\"" */
231
232xgdb : $(OBS) $(TSOBS) xgdb.o ${ADD_DEPS} ${RL_LIB}
233	rm -f init.c
234	./munch ${MUNCH_DEFINE} $(OBS) $(TSOBS) xgdb.o > init.c
235	$(CC-LD) $(LDFLAGS) -o xgdb init.c $(OBS) $(TSOBS) xgdb.o \
236	-lXaw -lXmu -lXt -lX11 ${RL_LIB} $(CLIBS)
237
238/* Old (pre R3) xgdb comp.
239	$(CC-LD) $(LDFLAGS) -o xgdb init.c $(OBS) $(TSOBS) xgdb.o \
240	-lXaw -lXt -lX11 $(CLIBS) */
241
242kdb : $(NTSSTART) $(OBS) $(NTSOBS) ${ADD_DEPS} ${RL_LIB}
243	rm -f init.c
244	./munch ${MUNCH_DEFINE} $(OBS) $(NTSOBS) > init.c
245	$(CC) $(LDFLAGS) -c init.c $(CLIBS)
246	ld -o kdb $(NTSSTART) $(OBS) $(NTSOBS) init.o ${RL_LIB} -lc $(CLIBS)
247
248/* If it can figure out the appropriate order, createtags will make sure
249 that the proper m-*, *-dep, *-pinsn, and *-opcode files come first
250 in the tags list.  It will attempt to do the same for dbxread.c and
251 coffread.c.  This makes using M-. on machine dependent routines much
252 easier.  */
253
254TAGS: ${TAGFILES}
255	createtags ${TAGFILES}
256tags: TAGS
257
258gdb.tar: ${TARFILES}
259	rm -f gdb.tar
260	mkdir dist-gdb
261	cd dist-gdb ; for i in ${TARFILES} ; do ln -s ../$$i . ; done
262	mkdir dist-gdb/readline
263	cd dist-gdb/readline ; for i in ${READLINE} ; do ln -s ../../readline/$$i . ; done
264	tar chf gdb.tar dist-gdb
265	rm -rf dist-gdb
266
267/* Remove gdb.tar.Z so stupid compress doesn't ask whether we want to
268   overwrite it.  compress -f is not what we want, because we do want
269   to know if compress would not make it smaller.  */
270gdb.tar.Z: gdb.tar
271	if [ -f gdb.tar.Z ]; then rm -f gdb.tar.Z; else true; fi
272	compress gdb.tar
273
274clean:
275	rm -f ${OBS} ${TSOBS} ${NTSOBS} ${OBSTACK} ${REGEX} ${GNU_MALLOC}
276	rm -f init.c init.o
277	rm -f xgdb.o xgdb
278	rm -f gdb core gdb.tar gdb.tar.Z make.log
279	rm -f gdb[0-9]
280	cd readline ; make clean
281
282distclean: clean expread.tab.c TAGS
283	rm -f dep.c opcode.h param.h pinsn.c config.status
284	rm -f y.output yacc.acts yacc.tmp
285	rm -f ${TESTS} Makefile
286
287realclean: clean
288	rm -f expread.tab.c TAGS
289	rm -f dep.c opcode.h param.h pinsn.c config.status
290	rm -f Makefile
291
292xgdb.o : defs.h param.h symtab.h frame.h
293
294/* Make copying.c from COPYING */
295copying.c : COPYING copying.awk
296	awk -f copying.awk < COPYING > copying.c
297
298expread.tab.c : expread.y
299	@echo 'Expect 4 shift/reduce conflict.'
300	${YACC} expread.y
301	mv y.tab.c expread.tab.c
302
303expread.o : expread.tab.c defs.h param.h symtab.h frame.h expression.h
304	$(CC) -c ${CFLAGS} expread.tab.c
305	mv expread.tab.o expread.o
306
307readline/libreadline.a : force_update
308	cd readline ; ${MAKE} "SYSV=${SYSV_DEFINE}" \
309		"DEBUG_FLAGS=${GLOBAL_CFLAGS}" "CC=${CC}" libreadline.a
310
311force_update :
312
313/* Only useful if you are using the gnu malloc routines.  */
314malloc.o : malloc.c
315	${CC} -c ${MALLOC_FLAGS} malloc.c
316
317/* dep.o depends on config.status in case someone reconfigures gdb out
318 from under an already compiled gdb.  */
319dep.o : dep.c config.status defs.h param.h frame.h inferior.h obstack.h \
320	a.out.encap.h
321
322/* pinsn.o depends on config.status in case someone reconfigures gdb out
323 from under an already compiled gdb.  */
324pinsn.o : pinsn.c config.status defs.h param.h symtab.h obstack.h symseg.h \
325	  frame.h opcode.h
326
327/* The rest of this is a standard dependencies list (hand edited output of
328   cpp -M).  It does not include dependencies of .o files on .c files. */
329/* All files which depend on config.status also depend on param.h in case
330   someone reconfigures gdb out from under an already compiled gdb.  */
331blockframe.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h
332breakpoint.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h
333coffread.o : defs.h param.h config.status
334command.o : command.h defs.h
335core.o : defs.h  param.h config.status a.out.encap.h
336dbxread.o : param.h config.status defs.h symtab.h obstack.h symseg.h a.out.encap.h \
337	    stab.gnu.h
338environ.o : environ.h
339eval.o : defs.h  param.h config.status symtab.h obstack.h symseg.h value.h expression.h
340expprint.o : defs.h symtab.h obstack.h symseg.h param.h config.status expression.h
341findvar.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h value.h
342infcmd.o : defs.h  param.h config.status symtab.h obstack.h symseg.h frame.h inferior.h \
343	   environ.h value.h
344inflow.o : defs.h  param.h config.status frame.h inferior.h
345infrun.o : defs.h  param.h config.status symtab.h obstack.h symseg.h frame.h inferior.h \
346	   wait.h
347kdb-start.o : defs.h param.h config.status
348main.o : defs.h  command.h param.h config.status
349malloc.o :  getpagesize.h
350obstack.o : obstack.h
351printcmd.o :  defs.h param.h config.status frame.h symtab.h obstack.h symseg.h value.h \
352	      expression.h
353regex.o : regex.h
354remote.o : defs.h  param.h config.status frame.h inferior.h wait.h
355source.o : defs.h  symtab.h obstack.h symseg.h param.h config.status
356stack.o :  defs.h param.h config.status symtab.h obstack.h symseg.h frame.h
357standalone.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h \
358	       inferior.h wait.h
359symmisc.o : defs.h symtab.h obstack.h symseg.h obstack.h
360symtab.o : defs.h  symtab.h obstack.h symseg.h param.h config.status  obstack.h
361utils.o : defs.h  param.h config.status
362valarith.o : defs.h param.h config.status symtab.h obstack.h symseg.h value.h expression.h
363valops.o :  defs.h param.h config.status symtab.h obstack.h symseg.h value.h frame.h \
364	    inferior.h
365valprint.o :  defs.h param.h config.status symtab.h obstack.h symseg.h value.h
366values.o :  defs.h param.h config.status symtab.h obstack.h symseg.h value.h
367
368robotussin.h : getpagesize.h
369symtab.h : obstack.h symseg.h
370a.out.encap.h : a.out.gnu.h
371
372