IDENT=-DSTANFORD -DSUNV1PCREVD -DBOOTHELP -DFRAMEBUF -DEMULATE -DBREAKTRAP -DBREAKKEY -DFTI10
#
# Makefile for Sun ROM Monitor, August 1981
#	Jeffrey Mogul @ Stanford
#
# This makefile is constructed from a machine description:
#	config machine
# Most changes should be made in the machine description
#	/usr/sun/src/monitor/conf/``machineid''
# after which you should do
#	 config machineid
# Generic makefile changes should be made in
#	/usr/sun/src/monitor/conf/makefile
# after which config should be rerun for all machines.
#
CC=cc68
AS=as68
LD=ld68

# define LFLAG as -L to get assembly listings
LFLAG=

COPTS= ${IDENT}
CFLAGS= -O ${COPTS} -DMC68000 $(LFLAG)

RELOC= 200000

OBJS=sunmon.b commands.b transparent.b emulate.b bedecode.b mapmem.b \
	tables.b version.b givehelp.b autoboot.b boottable.b proxies.b \
	gethexbyte.b getline.b getnum.b ishex.b message.b printhex.b \
	queryval.b busyio.b 

CFILES=../kernel/sunmon.c ../kernel/commands.c ../kernel/transparent.c \
	../kernel/emulate.c ../kernel/bedecode.c ../kernel/mapmem.c \
	../kernel/tables.c ../kernel/version.c ../kernel/givehelp.c \
	../kernel/autoboot.c ../kernel/boottable.c ../kernel/proxies.c \
	../subrs/gethexbyte.c ../subrs/getline.c ../subrs/getnum.c \
	../subrs/ishex.c ../subrs/message.c ../subrs/printhex.c \
	../subrs/queryval.c ../subrs/busyio.c 

stanford: makefile ${OBJS} 
	@echo loading stanford
	@rm -f stanford
	@$(LD) -M -s -o stanford -T $(RELOC) ${OBJS} -lpup -lc
	@size stanford
	$(CC) -d -o stanford.dl stanford
all: stanford

stanford.sym: makefile ${OBJS} 
	@echo loading stanford.tmp
	@rm -f stanford
	@$(LD) -o stanford.tmp -T $(RELOC) ${OBJS} -lpup -lc
	nm68 -g -x -n stanford.tmp >stanford.sym
symbols: stanford.sym

clean:
	rm -f *.dl *.b *.s.list touch errs linterrs *.ls

lint: /tmp
	@lint -hbxn -I. - ${COPTS} ${CFILES} | \
	    grep -v 'struct/union .* never defined' | \
	    grep -v 'possible pointer alignment problem'
touch: ../conf/touch.c
	cc ../conf/touch.c -o touch

depend:
	@echo 'making dependencies ...'
	@grep '^#include' ${CFILES} | grep -v '<' | \
	      sed 's/:[^"]*"\([^"]*\)".*/: \1/' | \
	      sed 's/\.c/.b/' | sed 's,../[0-9a-z]*/,,' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } \
	      END { print rec } ' > makedep
	@echo '$$r makedep' >>eddep
	@echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	@echo '$$r makedep' >>eddep
	@echo 'w' >>eddep
	@cp makefile makefile.bak
	@ed - makefile < eddep
	@rm eddep makedep
	@echo '... done'

tags:
	/usr/ucb/ctags ${CFILES}

print:
	yapp $(CFILES)
	yapp ../h/*.h

sunmon.b: ../kernel/sunmon.c
	${CC} -I. -c ${CFLAGS} ../kernel/sunmon.c
commands.b: ../kernel/commands.c
	${CC} -I. -c ${CFLAGS} ../kernel/commands.c
transparent.b: ../kernel/transparent.c
	${CC} -I. -c ${CFLAGS} ../kernel/transparent.c
emulate.b: ../kernel/emulate.c
	${CC} -I. -c ${CFLAGS} ../kernel/emulate.c
bedecode.b: ../kernel/bedecode.c
	${CC} -I. -c ${CFLAGS} ../kernel/bedecode.c
mapmem.b: ../kernel/mapmem.c
	${CC} -I. -c ${CFLAGS} ../kernel/mapmem.c
tables.b: ../kernel/tables.c
	${CC} -I. -c ${CFLAGS} ../kernel/tables.c
version.b: ../kernel/version.c
	${CC} -I. -c ${CFLAGS} ../kernel/version.c
givehelp.b: ../kernel/givehelp.c
	${CC} -I. -c ${CFLAGS} ../kernel/givehelp.c
autoboot.b: ../kernel/autoboot.c
	${CC} -I. -c ${CFLAGS} ../kernel/autoboot.c
boottable.b: ../kernel/boottable.c
	${CC} -I. -c ${CFLAGS} ../kernel/boottable.c
proxies.b: ../kernel/proxies.c
	${CC} -I. -c ${CFLAGS} ../kernel/proxies.c
gethexbyte.b: ../subrs/gethexbyte.c
	${CC} -I. -c ${CFLAGS} ../subrs/gethexbyte.c
getline.b: ../subrs/getline.c
	${CC} -I. -c ${CFLAGS} ../subrs/getline.c
getnum.b: ../subrs/getnum.c
	${CC} -I. -c ${CFLAGS} ../subrs/getnum.c
ishex.b: ../subrs/ishex.c
	${CC} -I. -c ${CFLAGS} ../subrs/ishex.c
message.b: ../subrs/message.c
	${CC} -I. -c ${CFLAGS} ../subrs/message.c
printhex.b: ../subrs/printhex.c
	${CC} -I. -c ${CFLAGS} ../subrs/printhex.c
queryval.b: ../subrs/queryval.c
	${CC} -I. -c ${CFLAGS} ../subrs/queryval.c
busyio.b: ../subrs/busyio.c
	${CC} -I. -c ${CFLAGS} ../subrs/busyio.c

# DO NOT DELETE THIS LINE -- make depend uses it

sunmon.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h ../h/sunuart.h
sunmon.b: ../h/suntimer.h ../h/confreg.h ../h/screen.h ../h/prom2.h
commands.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h ../h/sunuart.h
commands.b: ../h/confreg.h
transparent.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h ../h/sunuart.h
emulate.b: ../h/sunmon.h ../h/globram.h ../h/sunemt.h
version.b: ../h/sunmon.h
autoboot.b: ../h/sunmon.h ../h/globram.h ../h/confreg.h ../h/autoboot.h
boottable.b: ../h/autoboot.h
proxies.b: ../h/globram.h ../h/prom2.h
gethexbyte.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h
getline.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h
getnum.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h
ishex.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h
message.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h
printhex.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h
queryval.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h
busyio.b: ../h/sunmon.h ../h/asmdef.h ../h/globram.h ../h/sunuart.h
