# 
# Mach Operating System
# Copyright (c) 1992 Carnegie Mellon University
# All Rights Reserved.
# 
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
# 
# CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 
# CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
# ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
# 
# Carnegie Mellon requests users of this software to return to
# 
#  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
#  School of Computer Science
#  Carnegie Mellon University
#  Pittsburgh PA 15213-3890
# 
# any improvements or extensions that they make and grant Carnegie the
# rights to redistribute these changes.
# 
#
# HISTORY
# $Log:	Makefile,v $
# Revision 2.4  92/03/05  22:47:38  rpd
# 	Changed to use Makefile-man.
# 	[92/02/29            rpd]
# 
# Revision 2.3  92/02/16  15:46:42  rpd
# 	Instead of redefining the cpu variable, use the gnucpu variable.
# 	[92/02/16            rpd]
# 
# Revision 2.2  92/02/15  19:34:53  rpd
# 	Created.
# 	[92/02/15  19:15:49  rpd]
# 

include ${MAKETOP}Makefile-common

PROGRAM = gdb
MAN1PAGES = gdb

# Unfortunately, @sys only works at the beginning of a file name,
# so we can't use it for m-@sys.h.  Also, some file systems don't do @sys.

PMAX_sys = pmax_mach
I386_sys = i386_mach
VAX_sys = vax_mach
SUN3_sys = sun3_mach
sys = ${${TARGET_MACHINE}_sys}

# Unfortunately, the cpu values in Makefile-common aren't
# quite what we want.  (We can't redefine cpu because recursive
# makes will override our redefinition.)

PMAX_gnucpu = mips
I386_gnucpu = i386
VAX_gnucpu = vax
SUN3_gnucpu = m68k
gnucpu = ${${TARGET_MACHINE}_gnucpu}

START =
TSOBS = core.o inflow.o ${sys}-dep.o

# a kdb version of gdb would use these definitions
# START = kdb-start.o
# TSOBS = standalone.o

OBS = blockframe.o breakpoint.o findvar.o stack.o \
	source.o values.o eval.o valops.o valarith.o valprint.o \
	printcmd.o symtab.o symmisc.o coffread.o dbxread.o infcmd.o \
	infrun.o remote.o command.o utils.o expread.o expprint.o \
	${gnucpu}-pinsn.o environ.o version.o mach_os.o copying.o

# these objects would seem to really belong in a library
# other possibilities are regex.o, alloca.o, and malloc.o

ADDED = obstack.o

OBJECTS = ${START} init.o main.o ${OBS} ${TSOBS} ${ADDED}

LIBRARIES = MACHID NETNAME MACH READLINE TERMCAP

# some files include <obstack.h>.
# maybe it is considered a pseudo-library file?
# in any case, this implies -I.

INCS = -I.
DEFS = -DHAVE_VPRINTF

include ${MAKETOP}Makefile-bin
include ${MAKETOP}Makefile-man

expread.c : expread.y
	@echo 'Expect 4 shift/reduce conflicts.'
	yacc expread.y && mv y.tab.c expread.c

copying.c : COPYING copying.awk
	awk -f copying.awk < COPYING > copying.c

init.c : muncher ${OBS} ${TSOBS}
	./muncher ${MUNCH_DEFINE} ${OBS} ${TSOBS} > init.c

muncher : munch
	rm -f $@
	ln -s $> $@

# make sure that these links are created first,
# so that they exist before they are used

.INIT :: opcode.h param.h

opcode.h : ${gnucpu}-opcode.h
	rm -f $@
	ln -s $> $@

param.h : m-${sys}.h
	rm -f $@
	ln -s $> $@

-include Makedep
