forked from Ax461/pokeblack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (46 loc) · 1.41 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
61
62
pokeblack_obj := audio.o main.o text.o wram.o
.SUFFIXES:
.SECONDEXPANSION:
.PRECIOUS:
.SECONDARY:
.PHONY: all clean black
roms := pokeblack.pocket
all: $(roms)
black: pokeblack.pocket
clean:
rm -f $(roms) $(pokeblack_obj) $(roms:.pocket=.sym)
find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} +
$(MAKE) clean -C tools/
tools:
$(MAKE) -C tools/
# Build tools when building the rom.
# This has to happen before the rules are processed, since that's when scan_includes is run.
ifeq (,$(filter clean tools,$(MAKECMDGOALS)))
$(info $(shell $(MAKE) -C tools))
endif
%.asm: ;
%.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
$(pokeblack_obj): %.o: %.asm $$(dep)
rgbasm -E -h -o $@ $*.asm
pokeblack_opt = -jsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03 -t "POKEMON BLACK" -f hg
%.pocket: $$(%_obj)
rgblink -n $*.sym -l linkerscript.link -o $@ $^
rgbfix $($*_opt) $@
sort $*.sym -o $*.sym
gfx/intro_nido_1.2bpp: rgbgfx += -h
gfx/intro_nido_2.2bpp: rgbgfx += -h
gfx/intro_nido_3.2bpp: rgbgfx += -h
gfx/game_boy.2bpp: tools/gfx += --remove-duplicates
gfx/theend.2bpp: tools/gfx += --interleave --png=$<
gfx/tilesets/%.2bpp: tools/gfx += --trim-whitespace
%.png: ;
%.2bpp: %.png
rgbgfx $(rgbgfx) -o $@ $<
$(if $(tools/gfx),\
tools/gfx $(tools/gfx) -o $@ $@)
%.1bpp: %.png
rgbgfx -d1 $(rgbgfx) -o $@ $<
$(if $(tools/gfx),\
tools/gfx $(tools/gfx) -d1 -o $@ $@)
%.pic: %.2bpp
tools/pkmncompress $< $@