# 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} -I${IDIR2} ${OPT} -mstrict-align
AS	= gas960
ASFLAGS	= -ACA
LD	= gld960

# 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	# where to find the .h_v files
PSDIR	= ${ROOT}/i960/uart	# where to find the .c_v and .s_v files

IDIR	= ../include
IDIR2	= ../../bridge/include
.PATH.h_v = ${PIDIR} 
.PATH.h   = ${IDIR} 
.PATH.c_v = ${PSDIR}
.PATH.s_v = ${PSDIR}

#------------------------------------------------------------------------------
#   OBJECT FILES
#	Object files that are neither board- nor architecture-specific.
#------------------------------------------------------------------------------
UART_OBJS= uartasm.o uart.o
SLIP_OBJS= slipasm.o slip_io.o

ARCH=-ACA

uart: ${UART_OBJS} ${SLIP_OBJS} Makefile 
	${LD} ${ARCH} -o uart -r ${UART_OBJS}
	${LD} ${ARCH} -o slip -r ${SLIP_OBJS}
	cp uart ../lib/uart.o
	cp slip ../lib/slip.o

#------------------------------------------------------------------------------
# HEADER-FILE DEPENDENCIES
#------------------------------------------------------------------------------
uart.o:    ${IDIR}/types.h ${IDIR}/defines.h ${IDIR}/uart.h ${IDIR2}/memory.h

slip_io.o: ${IDIR}/types.h ${IDIR}/defines.h ${IDIR}/uart.h
