# gnu make

DEBUG = 1

DIR = /home/trap/cc65-2.9.1

ifndef DEBUG
%.o: %.asm
	ca65 -o $@ -l -I $(DIR)/asminc $<
else
%.o: %.asm
	ca65 -o $@ -l -D DEBUG --debug-info -I $(DIR)/asminc $<
endif

%.asm: %.c
	cc65 --cpu 65C02 -o $@ $<

%.bin: %.o
	ld65 --config supervision16.cfg -o $@ $^

all: stub.bin test.bin pooredit.bin hexdump.bin tron.bin ctest.bin

supervision.lib:
	ar65 a supervision.lib $(DIR)/libsrc/common/*.o $(DIR)/libsrc/runtime/*.o

ctest.bin: crt0.o ctest.o supervision.lib
	ld65 --config supervision16.cfg -o $@ $^

ctest.asm: ctest.c

stub.bin: stub.o common.o

test.bin: test.o common.o

pooredit.bin: pooredit.o common.o

tron.bin: tron.o common.o




#test.bin: test.o

clean:
	rm *.o *.lst *~ *.bin
