
# @(#)makefile	4.4	20/5/92
# @(#)Copyright (C) 1991 National Semiconductor Corp.

.MEMSWAP

NBURN 		= nburn
AS 		= nasm 
CC 		= nmcc 
LD 		= nmeld
RM 		= del
RAM 		= -DRAM
GNXDIR		=

APRG		= helper.o  monio.o
ETHER_CPRG	= eload.o ether.o  extra.o udp.o eserv.o 
HEADERS 	= packet.h header.h

DIAG_BOARD_DEF	= gx320ed.h

DIAG_DEVICE_SRC = icu_diag.c sio_diag.c ram_diag.c epr_diag.c cpu_diag.c led_diag.c fpu_diag.c
DIAG_DEVICE_OBJ = icu_diag.o sio_diag.o ram_diag.o epr_diag.o cpu_diag.o led_diag.o fpu_diag.o

CDIAG		= diag.c $(DIAG_DEVICE_SRC) 
ADIAG		= diag_ext.s
ODIAG 		= diag.o diag_ext.o $(DIAG_DEVICE_OBJ) 

DIAG_INC_FILES  = global.h cc_def.h $(DIAG_BOARD_DEF) diag.h

DIAG_CFLAGS     = -I.\ "-DBOARD_FILE=<${DIAG_BOARD_DEF}>" -DDIAG
DIAG_ASFLAGS    = -I.\ "-DBOARD_FILE=<${DIAG_BOARD_DEF}>" -DDIAG -DASEM -n

CPRG		= $(ETHER_CPRG) date.o $(ODIAG)
CFLAGS 		= -KCGX320 -KF381  -J1 -c -R -KW -KB4 -Dmongx320 -DETHER
ASFLAGS 	= -KCGX320 -KF381 -KB4 -KW -c -Dmongx320 -DETHER


all		: gx320ed.hex

ram		: gx320ed.ram

gx320ed.hex    : gx320ed
	$(NBURN) -w1 -b0 -n -x0xf0000000 -l64 -i -o gx320ed.hex gx320ed


.s.o		: $(HEADERS)
	$(AS)  $(ASFLAGS) $*.s 

.c.o		: $(HEADERS)
	$(CC) $(CFLAGS) $(DIAG_CFLAGS) -O $*.c

diag_ext.o	: diag_ext.s
	$(AS) $(ASFLAGS) $(DIAG_ASFLAGS) diag_ext.s

gx320ed.o	: gxcore.s def.s
	$(AS) $(ASFLAGS) -c -o gx320ed.o gxcore.s

gx320ed 	: gx320ed.o $(APRG) $(CPRG)
	echo gx320ed.o $(APRG) $(ETHER_CPRG) date.o > link.op
	echo $(ODIAG) >> link.op
	$(LD) -o gx320ed -d linkfile.rom @link.op -lc -m > gx320ed.map

gx320ed.ram	: gxcore.s def.s $(APRG) $(CPRG)
	$(AS) $(ASFLAGS) $(RAM) -g -o gx320ed.o gxcore.s
	echo gx320ed.o $(APRG) $(ETHER_CPRG) date.o > link.op
	echo $(ODIAG) >> link.op
	$(LD) -o gx320ed.ram -e reset -m -d linkfile.ram @link.op -lc > gx320ed.map

date.o		: date.c
	$(CC) $(CFLAGS) -Wa,-r -Wa,-n date.c  
	

diag_ext.o	: diag_ext.s   $(DIAG_INC_FILES)
diag.o		: diag.c       $(DIAG_INC_FILES)
icu_diag.o	: icu_diag.c   $(DIAG_INC_FILES)
sio_diag.o	: sio_diag.c ns16550.h $(DIAG_INC_FILES)
ram_diag.o	: ram_diag.c   $(DIAG_INC_FILES)
epr_diag.o	: epr_diag.c $(DIAG_INC_FILES)
led_diag.o	: led_diag.c   $(DIAG_INC_FILES)
cpu_diag.o	: cpu_diag.c   $(DIAG_INC_FILES)
fpu_diag.o	: fpu_diag.c   $(DIAG_INC_FILES)

clean 		: 
	$(RM)  *.o

clobber 	: clean
	$(RM) gx320ed.map
	$(RM) gx320ed
	$(RM) gx320ed.hex
	$(RM) gx320ed.hx0
	$(RM) gx320ed.hx1

.SCCS_GET	:

