compile_flags  = -g -T -Cl -Oirs -I ../knes
link_flags     = --lib-path ../knes
obj            = header.o driver.o graphics.o main.o
bin            = demo.nes
chr            = video.chr

$(bin): $(obj)
	bin2head $(chr)
	cl65 -m map.txt -Ln labels.txt -C nes-nrom.cfg -t none -Wl --dbgfile,$(bin).dbg $(link_flags) -o $@ $^ knes.lib

gfx:
	bin2head $(chr)

clean:
	del *.o
	del demo.nes

%.o: %.s
	cl65 -v -g -t none -c -D INC_MUSIC $<

%.o: %.c
	cl65 -g -t none $(compile_flags) -c $<

