apple2a/Makefile

58 lines
1.4 KiB
Makefile
Raw Normal View History

ifeq ($(USER),lk)
TREES ?= $(HOME)/others
else
TREES ?= $(HOME)/trees
endif
CC65 ?= $(TREES)/cc65/bin
APPLE2E ?= $(TREES)/apple2e/apple2e
2018-08-06 18:31:44 +00:00
CPU = 6502
2018-09-25 21:22:14 +00:00
BIN = apple2a.bin
ROM = apple2a.rom
LIB = apple2rom.lib
2018-07-28 05:30:44 +00:00
2018-08-06 05:59:56 +00:00
CC65_FLAGS = -t none --cpu $(CPU) --register-vars
2018-09-25 21:22:14 +00:00
$(ROM): $(BIN)
(dd count=5 bs=4096 if=/dev/zero 2> /dev/null; cat $(BIN)) > $(ROM)
2018-07-28 19:12:52 +00:00
2018-08-06 06:25:38 +00:00
.PHONY: run
run: $(ROM)
2018-08-03 18:35:15 +00:00
$(APPLE2E) -mute -map main.map $(ROM)
2018-07-28 19:12:52 +00:00
2018-08-06 06:25:38 +00:00
.PHONY: debug
debug: $(ROM)
lldb -- $(APPLE2E) -mute -map main.map $(ROM)
2018-09-25 21:22:14 +00:00
$(BIN): main.o interrupt.o vectors.o exporter.o platform.o runtime.o apple2rom.cfg $(LIB)
$(CC65)/ld65 -o $(BIN) -C apple2rom.cfg -m main.map --dbgfile main.dbg interrupt.o vectors.o exporter.o platform.o runtime.o main.o $(LIB)
2018-07-31 23:05:56 +00:00
awk -f rom_usage.awk < main.map
2018-07-28 05:30:44 +00:00
clean:
2018-09-25 21:22:14 +00:00
rm -f *.o *.lst $(BIN) $(ROM) platform.s runtime.s main.s $(LIB) tmp.lib
2018-07-28 05:30:44 +00:00
2018-08-02 23:26:42 +00:00
main.s: main.c exporter.h platform.h runtime.h
$(CC65)/cc65 $(CC65_FLAGS) -O $<
2018-08-02 23:26:42 +00:00
runtime.s: runtime.c runtime.h
$(CC65)/cc65 $(CC65_FLAGS) -O $<
2018-07-28 05:30:44 +00:00
2018-07-31 22:02:57 +00:00
%.o: %.s
$(CC65)/ca65 -l $(<:.s=.lst) --cpu $(CPU) $<
2018-07-28 05:30:44 +00:00
2018-07-31 19:02:22 +00:00
# platform.c contains inline assembly and code that must not be optimized
platform.s: platform.c
$(CC65)/cc65 $(CC65_FLAGS) $<
2018-07-31 19:02:22 +00:00
platform.o: platform.s
2018-07-28 05:30:44 +00:00
interrupt.o: interrupt.s
vectors.o: vectors.s
2018-08-02 07:45:58 +00:00
exporter.o: exporter.s
2018-07-28 05:30:44 +00:00
crt0.o: crt0.s
$(LIB): crt0.o supervision.lib
cp supervision.lib tmp.lib
$(CC65)/ar65 a tmp.lib crt0.o
mv tmp.lib $(LIB)