From 70a801a43c16fd7a5f61e8d876e5d5c2db48ebe8 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 16 Sep 2026 22:34:56 +0200 Subject: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- Makefile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b04fce7 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +V = +ifeq ($(strip $(V)),) + E = @echo + Q = @ +else + E = @\# + Q = +endif + +# CC65 is set to `xa65` if that exists, otherwise we resort to `cl65` by default. +XA65_BIN := $(shell command -v xa65 2>/dev/null) +ifneq ($(XA65_BIN),) + CC65 ?= xa65 +else + CC65 ?= cl65 +endif + +# NOTE: you can configure `CC65` and `CCOPTS` with the compiler and its options +# that you might require. +CCOPTS ?= --target nes + +# Be strict when using xa65, and extra verbose if V=1. +ifeq ($(CC65),xa65) + CCOPTS += --strict --stats +endif + +## +# all: clean the workspace and build the ROM file. + +.PHONY: all +all: clean deps build + +## +# clean & deps: clean the workspace and check that all dependencies are met. + +.PHONY: clean +clean: + $(Q) rm -rf out + $(Q) find . -type f -name "*.nes" -delete + $(Q) rm -rf .nasm/ + $(Q) mkdir -p out/ + +.PHONY: deps +deps: + @which $(CC65) >/dev/null 2>/dev/null || (echo "ERROR: '$(CC65)' not found." && false) + +## +# build: create the ROM file. + +.PHONY: build +build: + $(Q) $(CC65) $(CCOPTS) src/btree.s -C config/mmc1.cfg -o out/btree.nes 1>/dev/null -- cgit v1.2.3