
ifdef SILENT
.SILENT:
endif

all: contiki-c64-main

APPS=program-handler process-list directory
CONTIKI=../..
TARGET=c64
include $(CONTIKI)/Makefile.include
 
config.cfg:
	echo C CFS-CBM.DRV > config.cfg
	echo T CTK-80COL.DRV >> config.cfg
	echo . >> config.cfg

d64: contiki-c64-main.c64 $(PROGRAMS) config.cfg
#	exomizer -s 2061 -o contiki-exo contiki-c64-main.c64
#	mv contiki-exo contiki-c64-main.c64

	pucrunch -x 0x080d -fshort contiki-c64-main.c64 contiki-pu
	mv contiki-pu contiki-c64-main.c64

	c1541 -format contiki,00 d64 contiki-c64.d64
	c1541 -attach contiki-c64.d64 -write contiki-c64-main.c64 contiki
	c1541 -attach contiki-c64.d64 -write config.cfg
	c1541 -attach contiki-c64.d64 $(foreach dsc, $(wildcard *.dsc), -write $(dsc))
	c1541 -attach contiki-c64.d64 $(foreach prg, $(wildcard *.prg), -write $(prg))
	c1541 -attach contiki-c64.d64 $(foreach sav, $(wildcard *.sav), -write $(sav))
	c1541 -attach contiki-c64.d64 $(foreach drv, $(wildcard *.drv), -write $(drv))
	c1541 -attach contiki-c64.d64 $(foreach ser, $(wildcard *.ser), -write $(ser))
	c1541 -attach contiki-c64.d64 -list

vice: d64
	x64 +sound -warp -truedrive -drive8type 1541 -drive8idle 0 -autostart contiki-c64.d64

# no more present in the 2.x tree (?!)
#lc-test: lc-test.o lc-asm.o
#	cl65 -o lc-test -t c64 $^
