6502-OS/Makefile
matthias@rpi a63bd562d1 cleanup
2023-10-27 16:50:58 +02:00

40 lines
783 B
Makefile

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
$(BUILD_DIR):
mkdir $@
default: $(ROM)
$(ROM): $(BUILD_DIR)/main.o
$(LD) $(LDFLAGS) $< -o $@
$(BUILD_DIR)/%.o: %.s65 $(BUILD_DIR)
$(ASM) $(ASMFLAGS) $(ASMDEPFLAGS) $< -o $@
.PHONY = test
test: ../test.bin
../test.bin: $(BUILD_DIR)/test.o
# $(VASM) -dotdir -opt-branch -wdc02 -chklabels test.asm6502
# $(ASM) $(ASMFLAGS) test.asm6502 -o test.o
$(LD) $(LDFLAGS) $(BUILD_DIR)/test.o -o ../test.bin
clean:
rm -r $(BUILD_DIR)
rm $(ROM)