TK2048/Makefile
2025-08-20 18:08:11 +02:00

54 lines
No EOL
1.4 KiB
Makefile

VPATH = src
# Apple Commander tool JAR
ACMD=/d/Users/hkzla/software/applecommander/AppleCommander-ac-1.11.0.jar
JAVA=/c/Program\ Files/Microsoft/jdk-21.0.8.9-hotspot/bin/java.exe
# Program output
PRG=output
# Libraries
LIBS=clib-6502.a
# Common source files
ASM_SRCS = tk2k_startup.s preserve_zero_pages.s
C_SRCS = main.c monitor_subroutines.c utility.c \
game_graphics.c game_logic.c input.c \
line_data.c tiles.c graph_misc_data.c \
arrows_pic.c loading_screen.c
# Object files
OBJS = $(ASM_SRCS:%.s=%.o) $(C_SRCS:%.c=%.o)
all: $(PRG).wav $(PRG).woz
%.o: %.s
as6502 --core=6502 --list-file=$(@:%.o=obj/%.lst) -o obj/$@ $<
%.o: %.c
cc6502 --core=6502 -O2 --list-file=$(@:%.o=obj/%.lst) --char-is-unsigned --pedantic-errors -o obj/$@ $<
$(PRG).hex: $(OBJS)
(cd obj ; ln6502 -g ../linker-files/linker.scm $^ -o ../out/$@ $(LIBS) -l --cross-reference --cstartup=tk2k --no-automatic-placement-rules --output-format intel-hex --rom-code)
$(PRG).bin: $(PRG).hex
(cd out ; objcopy -I ihex -O binary $(PRG).hex $(PRG).bin)
$(PRG).wav: $(PRG).bin
(cd out ; c2t -3 $(PRG).bin,801 $(PRG).wav)
$(PRG).dsk: $(PRG).bin
(cd out ; cp ../dsk/TK2048_AUTO_BRUN.dsk ./$(PRG).dsk; cat $(PRG).bin | $(JAVA) -jar $(ACMD) -p $(PRG).dsk HELLO B 0x801)
$(PRG).woz: $(PRG).dsk
(cd out ; dsk2woz ./$(PRG).dsk ./$(PRG).woz)
clean:
-(cd obj ; rm $(OBJS) $(OBJS:%.o=%.lst))
-rm obj/*.lst
-rm out/*.hex
-rm out/*.bin
-rm out/*.wav
-rm out/*.dsk
-rm out/*.woz