#
# redefine TOP to point to where GNU x-devel tools live
#

TOP = /h/hwa-jin/gnu

LIBC = $(TOP)/lib-sun4/sun3-libc.a
CC = $(TOP)/bin-sun4/mc68000-gcc
AS = $(TOP)/lib-sun4/mc68000-as
LD = $(TOP)/lib-sun4/mc68000-ld
LIB = $(TOP)/lib-sun4/mc68000-gnulib $(LIBC)

INCLUDE	=	.
SRC	=	.
TOHEX	=	tohex
CFLAGS	=	-B$(TOP)/lib-sun4/mc68000- -O -c -mc68000 -msoft-float
AFLAGS	=	-mc68000
MFLAGS	=	-B$(TOP)/lib-sun4/mc68000- -M -mc68000 -msoft-float
DEBUG	= 	-DDEBUG
OBJECTS	=	util.o panic.o vector.o cswitch.o context.o  duart.o trap.o \
		console.o stat_disp.o interrupt.o timer.o bcopy.o string.o \
		trapit.o test.o kern.o queue.o 

.s.o:
	$(AS) $(AFLAGS) -o $*.o $*.s

.c.o:
	$(CC) $(CFLAGS) $(DEBUG) -I$(INCLUDE) $*.c

default:	srectest.q

#
#	Monitor ROM program.
#

srec:	boot.o $(OBJECTS) srec.o
	$(LD) -N -T F00000 -o srec boot.o $(OBJECTS) srec.o $(LIB)

srec.q:	srec
	-$(TOHEX) -s srec > srec.q

srectest:	jump_main.o $(OBJECTS) srec.o
	$(LD) -Bstatic -N -T 400 -o srectest jump_main.o \
		$(OBJECTS) srec.o $(LIB)

srectest.q:	srectest
	-$(TOHEX) -s srectest > srectest.q

test:	jump_main.o $(OBJECTS) test.o
	$(LD) -N -T 400 -o test jump_main.o $(OBJECTS) test.o $(LIB)
	-$(TOHEX) -s test > test.q

clean:
	rm -f *.o srec srectest srec.q srectest.q test test.q

depend:
	$(CC) $(MFLAGS) *.c > Depend.out

include Depend.out
