aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: be38f1af31d48ce1fce623c6f7b5a052c358a13d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
CC65   ?= cl65
CCOPTS ?= --target nes
ifeq "$(DEBUG)" "1"
CCOPTS += -g -Ln out/labels.txt
endif
QUIET  = @echo '   ' CC65 $@;

SOURCES = $(shell find src/ -type f -name '*.s' -printf "%f\n" | sort)
ROMS = $(SOURCES:%.s=out/%.nes)

.PHONY: all
all: clean deps build

.PHONY: clean
clean:
	@sed -i 's/RUN_TESTS = 1/RUN_TESTS = 0/g' test/defines.s
	@rm -rf out
	@mkdir out
	@find . -type f -name "*.o" -delete
	@find . -type f -name "*.nes" -delete

.PHONY: deps
deps:
	@which $(CC65) >/dev/null 2>/dev/null || (echo "ERROR: $(CC65) not found." && false)

.PHONY: build
build: $(ROMS)

out/%.nes: src/%.s
	$(QUIET) $(CC65) $(CCOPTS) $< -o $@

.PHONY: test
test:
	@bash test/run.sh