# $Source: /usr/local/kcs/sys.DAVIS_800/stand/RCS/makefile,v $
# $Revision: 1.32.98.1 $	$Author: root $
# $State: Exp $   	$Locker:  $
# $Date: 95/07/20 11:07:13 $


SHELL = /bin/sh
INCLUDES_DIR=	-I. -I../machine -I../h
CPPOPTS= -D__hp9000s800 -DRDB -DRDBIO -DIODCIO -DRDB_LOADER -DRDB_DEBUG \
	 -D_KERNEL_BUILD
CFLAGS= ${CPPOPTS} +Xxi ${INCLUDES_DIR}

CPP=	/lib/cpp
M4=	/usr/bin/m4
PREFIX= ../machine/pcc_prefix.s
AFLAGS=

CFILES = ../machine/iodc_prf.c rdb_com.c rdb_com_lan.c rdb_lan.c \
	 rdb_pll.c rdb_boot.c rdb_pllbw.c rdb_lanbw.c
SFILES = parallel.s intpHdlr.s comm_utl.s \
	../machine/iodc_llio.s ../machine/virt_phys.s
OFILES = iodc_prf.o rdb_com.o rdb_com_lan.o rdb_lanbw.o rdb_pllbw.o rdb_boot.o \
	 parallel.o comm_utl.o iodc_llio.o virt_phys.o

PRINTFLAGS = -DRDBIO


# The command after the following load command looks awful.  Actually all
# it is, is a one line shell script which determines whether the "parallel"
# command is in bounds or not.  Parallel, which becomes RDB in the boot
# partition of an S800 machine, must not grow beyond 4 megabytes, since it
# must fit into an S810's address space without a second memory card.  Also,
# There is no guarantee that more than one memory controller has been
# initialized when ISL invokes RDB.  This script guarantees that the end
# of parallel is less than the address 0x7FF000.  Note that the last four
# Kbytes of memory are reserved for RDB's use.  Future versions of RDB
# will use this area as an initialization area.
#
# If parallel does exceed its bounds, the easiest way to correct it is to
# decrease the -R 780000 value in the LD statement below.

parallel: $(OFILES)
	${LD} -a archive -N -R 780000 -e rdb_bootstrap -o $@ \
		$(OFILES) -lc
	@nm parallel | grep "^end  " | cut -d\| -f2 | \
		( read a ; if expr $$$\{a} \>=  8384512 >/dev/null ; \
		then echo "\n" \
			"OH. NOOOO.\n" \
			'"parallel" has grown too large.  Please use a smaller -R parameter to ld.\n' \
			"end = $$a" ; \
			rm parallel ; exit 30 ; \
		else echo \"parallel\" made. ; fi )

prparallel: prpll_utlbw.o parallel.o comm_utl.o
	${LD} -N -R 3D8000 -e rdb_bootstrap -o $@ parallel.o comm_utl.o prpll_utlbw.o  ../iodc_printf/libiodcprf.a -lc

parallel.o: ../stand/parallel.s
	${CPP} -I. -DLOCORE ${CPPOPTS} ../stand/parallel.s | ${M4} \
		| cat ${PREFIX} - | ${AS} ${AFLAGS} -o parallel.o

comm_utl.o: ../stand/comm_utl.s
	${CPP} -I. -DLOCORE ${CPPOPTS} ../stand/comm_utl.s | ${M4} \
		| cat ${PREFIX} - | ${AS} ${AFLAGS} -o comm_utl.o

pll_utlbw.c: pll_utl.c
	rm -f $@
	cp pll_utl.c $@

prpll_utlbw.c: pll_utl.c
	rm -f $@
	cp pll_utl.c $@

pll_utlbw.o: pll_utlbw.c 
	${CC} -c -DBUSYWAIT ${CFLAGS} pll_utlbw.c

rdb_loader.o:	rdb_loader.c
	${CC} -c ${CFLAGS} $(@:.o=.c)

rdb_com.o:	rdb_com.c
	${CC} -c ${CFLAGS} $(@:.o=.c)

rdb_com_lan.o:	rdb_com_lan.c
	${CC} -c ${CFLAGS} $(@:.o=.c)

rdb_rs232bw.o:	rdb_rs232bw.c
	${CC} -c -DBUSYWAIT ${CFLAGS} $(@:.o=.c)

rdb_rs232.o:	rdb_rs232.c
	${CC} -c ${CFLAGS} $(@:.o=.c)

rdb_lanbw.o:	rdb_lanbw.c
	${CC} -c -DBUSYWAIT ${CFLAGS} $(@:.o=.c)

rdb_lan.o:	rdb_lan.c
	${CC} -c ${CFLAGS} $(@:.o=.c)

rdb_mp.o:	rdb_mp.c
	${CC} -c ${CFLAGS} $(@:.o=.c)

rdb_pllbw.o:	rdb_pllbw.c
	${CC} -c -DBUSYWAIT ${CFLAGS} $(@:.o=.c)

rdb_pll.o:	rdb_pll.c
	${CC} -c ${CFLAGS} $(@:.o=.c)

rdb_pllbw.c: rdb_pll.c
	rm -f $@
	cp rdb_pll.c $@

rdb_rs232bw.c: rdb_rs232.c
	rm -f $@
	cp rdb_rs232.c $@

rdb_lanbw.c: rdb_lan.c
	rm -f $@
	cp rdb_lan.c $@

monpll_utl.c: pll_utl.c
	rm -f $@
	cp pll_utl.c monpll_utl.c

monpll_utl.o: monpll_utl.c 
	${CC} -c -DINDIGO -DMONITOR ${CFLAGS} monpll_utl.c

iodc_prf.o: ../machine/iodc_prf.c 
	${CC} -c -DBUSYWAIT ${CFLAGS} ../machine/iodc_prf.c

iodc_llio.o: ../machine/iodc_llio.s
	${CPP} -I. -DLOCORE ${CPPOPTS} ../machine/iodc_llio.s | ${M4} \
		| cat ${PREFIX} - | ${AS} ${AFLAGS} -o iodc_llio.o

virt_phys.o: ../machine/virt_phys.s
	${CPP} -I. -DLOCORE ${CPPOPTS} ../machine/virt_phys.s | ${M4} \
		| cat ${PREFIX} - | ${AS} ${AFLAGS} -o virt_phys.o

assym.s: genassym.o
	${CC} -o genassym genassym.o
	rm -f assym.s
	./genassym >assym.s
	rm -f genassym

genassym.o:     ../machine/genassym.c
	${CC} -I. -c ${CFLAGS} -DKERNEL ../machine/genassym.c

mon.o: intpHdlr.o monpll_utl.o comm_utl.o iodc_prf.o iodc_llio.o virt_phys.o
	${LD} -N -R 8800 -e rdb_bootstrap -o $@ intpHdlr.o comm_utl.o \
		monpll_utl.o iodc_prf.o iodc_llio.o virt_phys.o -lc

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

prpll_utlbw.o: prpll_utlbw.c 
	${CC} -c -DBUSYWAIT ${CFLAGS} ${PRINTFLAGS} prpll_utlbw.c

intpHdlr.o: ../stand/intpHdlr.s
	${CPP} -I. -DLOCORE -DINDIGO -DMONITOR \
		${CPPOPTS} ../stand/intpHdlr.s | ${M4} \
		| cat ${PREFIX} - | ${AS} ${AFLAGS} -o intpHdlr.o

depend: assym.s pll_utlbw.c
	includes -do ${INCLUDES_DIR} ${CPPOPTS} ${SFILES} ${CFILES} \
		> makedep
	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

# DO NOT DELETE THIS LINE -- make depend uses it
parallel.o: parallel.s ./../machine/break.h ./../machine/spl.h  \
  ./../machine/trap.h ./../machine/reg.h /usr/include/sys/vmmac.h  \
  /usr/include/machine/param.h ./../machine/pde.h ./../machine/locore.h  \
  ./../h/syscall.h ./../machine/rdb.h ./../stand/rdb_com.h  \
  ./../machine/psl.h ./../machine/pdc_rqsts.h /usr/include/sys/sysmacros.h  \
  ./../machine/param.h /usr/include/sys/types.h /usr/include/sys/stdsyms.h  \
  ./../machine/cpu.h ./../machine/asm.h ./assym.s 

intpHdlr.o: intpHdlr.s ./../machine/pdc_rqsts.h ./../machine/param.h  \
  ./../machine/trap.h ./../machine/psl.h ./../machine/reg.h  \
  ./../machine/rdb.h ./../machine/locore.h /usr/include/sys/vmmac.h  \
  /usr/include/sys/sysmacros.h /usr/include/machine/param.h  \
  ./../machine/pde.h /usr/include/sys/types.h /usr/include/sys/stdsyms.h  \
  ./../machine/cpu.h 

comm_utl.o: comm_utl.s ./../machine/rdb.h ./../machine/psl.h  \
  /usr/include/sys/types.h ./../machine/cpu.h ./../machine/pdc_rqsts.h  \
  ./../machine/asm.h /usr/include/sys/stdsyms.h  \
  /usr/include/sys/sysmacros.h ./../machine/param.h ./assym.s 

iodc_llio.o: ../machine/iodc_llio.s ../machine/../machine/iodc_prf.h  \
  ../machine/../machine/reg.h ../machine/../machine/psl.h  \
  ../machine/../machine/asm.h /usr/include/sys/stdsyms.h  \
  /usr/include/sys/sysmacros.h ../machine/../machine/param.h ./assym.s 

virt_phys.o: ../machine/virt_phys.s /usr/include/sys/types.h  \
  ../machine/../machine/cpu.h ../machine/../machine/iodc_prf.h  \
  ../machine/../machine/rdb.h ../machine/../machine/psl.h  \
  ../machine/../machine/pdc_rqsts.h ../machine/../machine/asm.h  \
  /usr/include/sys/stdsyms.h /usr/include/sys/sysmacros.h  \
  ../machine/../machine/param.h ./assym.s 

iodc_prf.o: ../machine/iodc_prf.c ../machine/../h/vmmac.h  \
  /usr/include/sys/sysmacros.h ../machine/../machine/param.h  \
  ../machine/../h/param.h ../machine/../machine/reg.h  \
  ../machine/../machine/nvm.h ../machine/../machine/psl.h  \
  ../machine/../machine/pdc_rqsts.h ../machine/../h/time.h  \
  /usr/include/sys/types.h ../machine/../machine/cpu.h  \
  ../machine/../machine/iodc_prf.h /usr/include/sys/stdsyms.h  \
  ../machine/../h/types.h 

rdb_com.o: rdb_com.c ./../stand/../stand/../machine/rdb_ss.h  \
  ./../stand/../stand/lantalker.h ./../stand/../machine/pdc_rqsts.h  \
  ./../stand/rdb_boot.h ./../stand/rdb_com.h ./../machine/inline.h  \
  ./../machine/psl.h ./../machine/reg.h ./../machine/rdb.h  \
  /usr/include/sys/types.h ./../machine/cpu.h /usr/include/sys/stdsyms.h  \
  ./../h/time.h ./../h/param.h 

rdb_com_lan.o: rdb_com_lan.c ./../stand/lantalker.h  \
  ./../stand/../stand/../machine/rdb_ss.h ./../stand/../stand/lantalker.h  \
  ./../stand/../machine/pdc_rqsts.h ./../stand/rdb_boot.h  \
  ./../stand/rdb_com_lan.h ./../stand/rdb_com.h ./../machine/inline.h  \
  ./../machine/psl.h ./../machine/reg.h ./../machine/rdb.h  \
  /usr/include/sys/types.h ./../machine/cpu.h ./../h/errno.h  \
  /usr/include/sys/stdsyms.h ./../h/time.h ./../h/param.h 

rdb_lan.o: rdb_lan.c ./../stand/rdb_lan.h ./../stand/rdb_com.h  \
  ./../stand/../stand/lantalker.h ./../stand/../machine/pdc_rqsts.h  \
  ./../stand/rdb_boot.h ./../stand/../machine/rdb_ss.h  \
  ./../stand/lantalker.h ./../machine/inline.h ./../machine/reg.h  \
  ./../machine/iodc.h /usr/include/sys/types.h ./../machine/cpu.h  \
  ./../h/time.h /usr/include/sys/stdsyms.h ./../h/errno.h ./../h/param.h 

rdb_pll.o: rdb_pll.c ./../stand/rdb_com.h ./../stand/rdb_pll.h  \
  ./../machine/nvm.h ./../machine/psl.h ./../machine/pdc_rqsts.h  \
  ./../h/reboot.h ./../h/time.h ./../machine/reg.h  \
  /usr/include/sys/types.h /usr/include/sys/stdsyms.h ./../machine/cpu.h  \
  ./../machine/rdb.h ./../h/param.h 

rdb_boot.o: rdb_boot.c ./../stand/lantalker.h /usr/include/string.h  \
  ./../machine/rdb.h ./../stand/rdb_com.h  \
  ./../stand/../stand/../machine/rdb_ss.h ./../stand/../stand/lantalker.h  \
  ./../stand/../machine/pdc_rqsts.h ./../stand/rdb_boot.h  \
  ./../machine/reg.h ./../machine/iodc.h ./../h/utsname.h ./../h/time.h  \
  /usr/include/sys/types.h /usr/include/sys/stdsyms.h ./../machine/cpu.h  \
  ./../h/param.h 

rdb_pllbw.o: rdb_pllbw.c ./../stand/rdb_com.h ./../stand/rdb_pll.h  \
  ./../machine/nvm.h ./../machine/psl.h ./../machine/pdc_rqsts.h  \
  ./../h/reboot.h ./../h/time.h ./../machine/reg.h  \
  /usr/include/sys/types.h /usr/include/sys/stdsyms.h ./../machine/cpu.h  \
  ./../machine/rdb.h ./../h/param.h 

rdb_lanbw.o: rdb_lanbw.c ./../stand/rdb_lan.h ./../stand/rdb_com.h  \
  ./../stand/../stand/lantalker.h ./../stand/../machine/pdc_rqsts.h  \
  ./../stand/rdb_boot.h ./../stand/../machine/rdb_ss.h  \
  ./../stand/lantalker.h ./../machine/inline.h ./../machine/reg.h  \
  ./../machine/iodc.h /usr/include/sys/types.h ./../machine/cpu.h  \
  ./../h/time.h /usr/include/sys/stdsyms.h ./../h/errno.h ./../h/param.h 

