6502-OS/Makefile

40 lines
783 B
Makefile
Raw Normal View History

2023-10-26 19:51:20 +02:00
ROM = ../rom.bin
BUILD_DIR = .build
SRC_DIRS = programs system
# VASM = ~/6502/vasm6502
ASM = ca65
ASMFLAGS = --cpu 65C02 $(foreach srcdir, $(SRC_DIRS), -I $(srcdir))
ASMDEPFLAGS = --create-dep .dependencies
LD = ld65
LDFLAGS = -C linker.conf
# DEPENDS = $(shell $(VASM) -depend=make $(MAIN))
-include .dependencies
2023-10-27 16:50:58 +02:00
$(BUILD_DIR):
mkdir $@
2023-10-26 19:51:20 +02:00
default: $(ROM)
2023-10-27 16:50:58 +02:00
$(ROM): $(BUILD_DIR)/main.o
$(LD) $(LDFLAGS) $< -o $@
$(BUILD_DIR)/%.o: %.s65 $(BUILD_DIR)
$(ASM) $(ASMFLAGS) $(ASMDEPFLAGS) $< -o $@
2023-10-26 19:51:20 +02:00
.PHONY = test
2023-10-27 16:50:58 +02:00
test: ../test.bin
../test.bin: $(BUILD_DIR)/test.o
2023-10-26 19:51:20 +02:00
# $(VASM) -dotdir -opt-branch -wdc02 -chklabels test.asm6502
2023-10-27 16:50:58 +02:00
# $(ASM) $(ASMFLAGS) test.asm6502 -o test.o
$(LD) $(LDFLAGS) $(BUILD_DIR)/test.o -o ../test.bin
clean:
rm -r $(BUILD_DIR)
rm $(ROM)