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