-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
60 lines (43 loc) · 1.28 KB
/
Makefile
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.PHONY: all compare clean text
.SUFFIXES:
.SUFFIXES: .asm .o .gbc .png
.SECONDEXPANSION:
ROMS := hm3.gbc
BASEROM := baserom.gbc
OBJS := main.o wram.o build/shim.o
# Link objects together to build a rom.
all: $(ROMS) compare
tools:
$(MAKE) -C tools/
define DEP
$1: $2 $$(shell tools/scan_includes $2)
rgbasm -l -E -o $$@ $$<
endef
ifeq (,$(filter clean tools,$(MAKECMDGOALS)))
$(info $(shell $(MAKE) -C tools))
$(foreach obj, $(OBJS), $(eval $(call DEP,$(obj),$(obj:.o=.asm))))
endif
build/shim.asm: shim.sym
python3 tools/make_shim.py $^ > $@
build/charmap.asm: charmap.tbl
python3 tools/tbl_to_charmap.py $^ > $@
build/text/dummy.asm: build/charmap.asm $(wildcard text/*.csv) scripts/text.py
python3 scripts/text.py asm_from_csv
python3 scripts/text.py pointer_tables
$(ROMS): $(OBJS)
rgblink -n $(ROMS:.gbc=.sym) -m $(ROMS:.gbc=.map) -O $(BASEROM) -o $@ $^
rgbfix -v -C -i BWAE -k E9 -l 0x33 -m 0x1B -p 0 -r 3 -t "H-MOON3 CGBBWAE" $@
compare: $(ROMS) $(BASEROM)
cmp $^
# Remove files generated by the build process.
clean:
rm -rf $(ROMS) $(OBJS) $(ROMS:.gbc=.sym) build/*
find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pcm' \) -exec rm {} +
%.2bpp: %.png
rgbgfx -o $@ $<
%.1bpp: %.png
rgbgfx -d1 -o $@ $<
%.tilemap: %.png
rgbgfx -t $@ $<
%.gbcpal: %.png
rgbgfx -p $@ $<