TK2048/Makefile

42 lines
No EOL
1.1 KiB
Makefile

VPATH = src
# Program output
PRG=output
# Libraries
LIBS=clib-6502.a
# Common source files
ASM_SRCS = tk2k_startup.s
C_SRCS = main.c monitor_subroutines.c utility.c \
game_graphics.c game_logic.c input.c \
line_data.c
# Object files
OBJS = $(ASM_SRCS:%.s=%.o) $(C_SRCS:%.c=%.o)
all: $(PRG).wav
%.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 --hosted)
(cd obj ; ln6502 -g ../linker-files/linker.scm $^ -o ../out/$@ $(LIBS) -l --cross-reference --cstartup=tk2k --no-automatic-placement-rules --output-format intel-hex)
$(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)
clean:
-(cd obj ; rm $(OBJS) $(OBJS:%.o=%.lst))
-rm obj/*.lst
-rm out/*.hex
-rm out/*.bin
-rm out/*.wav