#############################################################################
#	Program Name:	BOOTER for stanley
#
#	Filename:	Makefile
#
#	Creation Date:	5.8.91
#
#	Date:		5.8.91
#
#	Version:	1.0
#
#	Programmers:	K Kong
#
#	Modifications:
#
#	Comments:	The makefile for the booter
#			This makefile will call all other makefiles 
#			to produce the booter image.  The directory
#			structures are:=
#
#			Makefile	This file
#				
#			main.c		The main function
#			booter/
#				system/	It contains the startup module,
#					fault table, interrupt table and
#					prob ...etc.
#
#	Copyright (c) 1991 by Hughes LAN Systems
#
#############################################################################
# Defaults to GNU/960 tool set:
#

.LOGFILE .c_v(.c)
.LOGFILE .s_v(.s)
.LOGFILE .h_v(.h)

CC	= gcc960			# gnu960 cross C compiler 
ARCH	= -ACA				# This is CA architecture
OPT	= -O3 -c -DSTANLEY  			# O3 - optimization level 3
					# c  - compile only
VERSION	=
VER	=
CFLAGS	= ${ARCH} -I${IDIR1} -I${IDIR2} ${OPT} -mstrict-align 
					#
					# I - 	specify the search path for
					# 	any include files
					# mstrict-align
					#	Sequences of smaller memory
					#	reference are used instead
					#	of larger ones which might
					#	not be correctly aligned.
AS	= gas960			# gnu960 assembler
ASFLAGS	= ${ARCH}
LD	= gld960  			# gnu960 linker
TOOLSET = ${GFLAG}

# 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

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


#------------------------------------------------------------------------------
# Where to find things (include files, ROM images)
#------------------------------------------------------------------------------
#ROOT	= /h/pvcs
ROOT	= junk				# so it can't clobber my changes
PIDIR1	= ${ROOT}/bridge/include	# where the .h_v files are
PIDIR2	= ${ROOT}/i960/include
PSDIR	= ${ROOT}/bridge/booter		# where the .c_v and .s_v files are

IDIR1	= ../include
IDIR2	= ../../i960/include
.PATH.h_v = ${PIDIR1} ;${PIDIR2} 
.PATH.h   = ${IDIR1} ;${IDIR2} 
.PATH.c_v = ${PSDIR}
.PATH.s_v = ${PSDIR}


ODIR	= ../lib
TCPLIB	= ../../i960/lib
#------------------------------------------------------------------------------
# TARG OBJECT FILES
#------------------------------------------------------------------------------
BOOTER_OBJS= startup.o main.o \
	../tr_util/hw_sled.o \
	../booter/system/system \
	../util/ctrlio.o

TARG_IBR = ../booter/system/imi.o

# Address at which 960CX Initial Boot Record must be linked
IBR_ADDR = 0xffffff00
#BOOTER_ADDR = 0x30000000
BOOTER_ADDR = 0xfffc0000
BOOTER_DATA = 0x2ffe0000

booter: startup.o main.o ramtest.o Makefile
	${LD} ${ARCH} -o qtest -M -Ttext ${BOOTER_ADDR} \
			-e _start -defsym _load_addr=${BOOTER_ADDR} \
			 ${BOOTER_OBJS} -ltcpip -ltest -lutil -lc \
			-Tdata ${BOOTER_DATA} \
			 -L../../i960/lib -L../lib
	makenim qtest 

	${LD} ${ARCH} -o ibr -T ${IBR_ADDR} -R qtest \
		-defsym _cs6=-_rom_prcb-_start ${TARG_IBR} 
	grom960 -l0x40000 -m -i -oqtest.bin qtest ibr,0x3ff00

startup.o:	Makefile

tdummy.o:	Makefile ${IDIR2}/types.h ${IDIR2}/dbd.h \
		${IDIR2}/uart.h ${IDIR1}/eeprecs.h ${IDIR2}/eeprom.h \
		${IDIR1}/dips.h ${IDIR2}/tcpip.h ${IDIR2}/lme.h

main.o:		Makefile ${IDIR2}/krnl.h ${IDIR1}/target.h  \
		${IDIR1}/memory.h ${IDIR2}/types.h \
		${IDIR2}/eeprom.h ${IDIR2}/nim960h.h ${IDIR2}/uart.h \
		${IDIR1}/dips.h ${IDIR1}/led.h ${IDIR1}/sys.h \
		${IDIR1}/eeprecs.h ${IDIR2}/sncvar.h ${IDIR2}/malloc.h \
		${IDIR2}/dbd.h ${IDIR1}/sys.h ${IDIR2}/sonic.h

init.o:		Makefile ${IDIR2}/krnl.h ${IDIR1}/target.h  \
		${IDIR1}/memory.h ${IDIR2}/types.h \
		${IDIR2}/eeprom.h ${IDIR2}/nim960h.h ${IDIR2}/uart.h \
		${IDIR1}/dips.h ${IDIR1}/led.h ${IDIR1}/sys.h \
		${IDIR1}/eeprecs.h ${IDIR2}/sncvar.h ${IDIR2}/malloc.h \
		${IDIR2}/netbuf.h ${IDIR2}/dbd.h ${IDIR2}/ether.h \
		${IDIR2}/sonic.h

ramtest.o:	Makefile

