6502-OS/Makefile
2023-12-08 00:01:30 +01:00

42 lines
783 B
Makefile

ROM = ../rom.bin
BUILD_DIR = .build
SRC_DIRS = programs system
# VASM = ~/6502/vasm6502
ASM = ca65
ASMFLAGS = -g --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 $@
.PHONY: default test clean
.DEFAULT_GOAL = default
default: $(ROM)
test: ../test.bin
$(ROM): $(BUILD_DIR)/main.o
$(LD) $(LDFLAGS) $< -o $@
../test.bin: $(BUILD_DIR)/test.o
# $(VASM) -dotdir -opt-branch -wdc02 -chklabels test.asm6502
$(LD) $(LDFLAGS) $(BUILD_DIR)/test.o -o ../test.bin
$(BUILD_DIR)/%.o: %.s65 | $(BUILD_DIR)
$(ASM) $(ASMFLAGS) $(ASMDEPFLAGS) $< -o $@
clean:
rm -r $(BUILD_DIR)
rm $(ROM)