#
AS  =	nasm
LD  =	nmeld
CC  =	nmcc
BURN = nburn



APRG= helper.o monio.o
CPRG= eload.o ether.o extra.o udp.o eserv.o date.o
HEADERS = packet.h header.h
    
CFLAGS = -J1 -c -R -O -Dmongx320 -DETHER -KCcg16 -KF381 -KB4 -KW
ASFLAGS = -c -KCGX320 -KF381 -KB4 -DBURN -Dmongx320 -DETHER -KW


mongx320.hex: mongx320
	$(BURN) -w1 -b0 -x0xf0000000 -l64 -i -n -o mongx320.hex mongx320

mongx320: mongx320.o $(APRG) $(CPRG)
	$(LD) -o mongx320 -m mongx320.o eload.o \
        -d linkfile.rom -lc > mongx320.map

mongx320.ram :mongxcor.s def.s $(APRG) $(CPRG)
	$(AS) $(ASFLAGS) -DRAM mongxcor.s -o mongx320.o
	$(LD) -o mongx320.ram -m mongx320.o eload.o \
        -d linkfile.ram -lc > mongx320.map
	rm -f mongx320.o

mongx320.o: mongxcor.s def.s
	$(AS) $(ASFLAGS) mongxcor.s -o mongx320.o

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


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

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


.SCCS_GET:
