6502-OS/Makefile

42 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
2023-10-30 22:15:40 +01:00
ASMFLAGS = -g --cpu 65C02 $(foreach srcdir, $(SRC_DIRS), -I $(srcdir))
2023-10-26 19:51:20 +02:00
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-28 03:48:27 +02:00
.PHONY: default test clean
2023-12-08 00:01:30 +01:00
.DEFAULT_GOAL = default
2023-10-26 19:51:20 +02:00
default: $(ROM)
2023-10-28 03:48:27 +02:00
test: ../test.bin
2023-10-27 16:50:58 +02:00
$(ROM): $(BUILD_DIR)/main.o
$(LD) $(LDFLAGS) $< -o $@
../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
$(LD) $(LDFLAGS) $(BUILD_DIR)/test.o -o ../test.bin
2023-10-28 03:48:27 +02:00
$(BUILD_DIR)/%.o: %.s65 | $(BUILD_DIR)
$(ASM) $(ASMFLAGS) $(ASMDEPFLAGS) $< -o $@
2023-10-27 16:50:58 +02:00
clean:
rm -r $(BUILD_DIR)
rm $(ROM)