# Defaults to GNU/960 tool set:
#
.LOGFILE .c_v(.c)
.LOGFILE .s_v(.s)
.LOGFILE .h_v(.h)

CC	= gcc960
OPT	= -O3
CFLAGS	= -ACA -I${IDIR} ${OPT} -mstrict-align
AS	= gas960
ASFLAGS	= -ACA
LD	= gld960
AR	= gar960
ARFLAGS	= ruos

GETOPTS = -q

# Essential under System V, harmless elsewhere
SHELL = /bin/sh

# Standard rules
#
.c_v.c:
	=get $(GETOPTS) $<\($@\)

.h_v.h:
	=get $(GETOPTS) $<\($@\)

.s_v.s:
	=get $(GETOPTS) $<\($@\)

.c.o:
	${CC} ${CFLAGS} -c $*.c

.c.s:
	${CC} ${CFLAGS} -S -c $*.c

.s.o:
	${AS} ${ASFLAGS} -o $*.o $*.s



#------------------------------------------------------------------------------
# Where to find things (include files, ROM images)
#------------------------------------------------------------------------------
ROOT	= /b/gregs
PIDIR	= ${ROOT}/i960/include
PSDIR	= ${ROOT}/i960/debugger

IDIR	= ../include

.PATH.h_v = ${PIDIR} 
.PATH.h   = ${IDIR} 
.PATH.c_v = ${PSDIR}
.PATH.s_v = ${PSDIR}

#------------------------------------------------------------------------------
#   OBJECT FILES
#------------------------------------------------------------------------------
DEBUG_OBJS= debug.o debugasm.o dis.o dhelp.o monitor.o dtty.o

ARCH=-ACA

debug: ${DEBUG_OBJS} Makefile
	${LD} ${ARCH} -o debug -r ${DEBUG_OBJS}
	cp debug ../lib/debug.o


#------------------------------------------------------------------------------
# HEADER-FILE DEPENDENCIES
#------------------------------------------------------------------------------
debug.o:   ${IDIR}/dbdefines.h ${IDIR}/globals.h break.h \
	   ${IDIR}/regs.h

dis.o:     ${IDIR}/dbdefines.h ${IDIR}/regs.h

monitor.o: ${IDIR}/dbdefines.h ${IDIR}/globals.h ${IDIR}/regs.h

help.o:    ${IDIR}/dbdefines.h
