diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-09-16 22:34:56 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-09-16 22:34:56 +0200 |
| commit | 70a801a43c16fd7a5f61e8d876e5d5c2db48ebe8 (patch) | |
| tree | f1836f8facd9dc69429ab5693afec8d4d326025d /Makefile | |
| download | btree.nes-70a801a43c16fd7a5f61e8d876e5d5c2db48ebe8.tar.gz btree.nes-70a801a43c16fd7a5f61e8d876e5d5c2db48ebe8.zip | |
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 52 |
1 files changed, 52 insertions, 0 deletions
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 |
