4
4
RGBDS_DIR =
5
5
endif
6
6
7
- PYTHON := python2
8
- MD5 := md5sum -c --quiet
9
-
10
- 2bpp := $(PYTHON ) extras/pokemontools/gfx.py 2bpp
11
- 1bpp := $(PYTHON ) extras/pokemontools/gfx.py 1bpp
12
- pic := $(PYTHON ) extras/pokemontools/pic.py compress
13
- includes := $(PYTHON ) extras/pokemontools/scan_includes.py
7
+ MD5 := md5sum -c
14
8
15
9
pokered_obj := audio_red.o main_red.o text_red.o wram_red.o
16
10
pokeblue_obj := audio_blue.o main_blue.o text_blue.o wram_blue.o
17
11
18
12
.SUFFIXES :
19
- .SUFFIXES : .asm .o .gbc .png .2bpp .1bpp .pic
20
13
.SECONDEXPANSION :
21
- # Suppress annoying intermediate file deletion messages.
22
- .PRECIOUS : % .2bpp
23
- .PHONY : all clean red blue compare
14
+ .PHONY : all clean red blue compare tools
24
15
25
16
roms := pokered.gbc pokeblue.gbc
26
17
@@ -35,14 +26,27 @@ compare: red blue
35
26
clean :
36
27
rm -f $(roms ) $(pokered_obj ) $(pokeblue_obj ) $(roms:.gbc=.sym )
37
28
find . \( -iname ' *.1bpp' -o -iname ' *.2bpp' -o -iname ' *.pic' \) -exec rm {} +
29
+ # $(MAKE) clean -C tools/
30
+
31
+ tools :
32
+ $(MAKE ) -C tools/
33
+
34
+
35
+ # Build tools when building the rom.
36
+ # This has to happen before the rules are processed, since that's when scan_includes is run.
37
+ ifeq (,$(filter clean tools,$(MAKECMDGOALS ) ) )
38
+ $(info $(shell $(MAKE) -C tools))
39
+ endif
40
+
41
+
38
42
39
43
% .asm : ;
40
44
41
- % _red.o : dep = $(shell $( includes ) $(@D ) /$* .asm)
45
+ % _red.o : dep = $(shell tools/scan_includes $(@D ) /$* .asm)
42
46
$(pokered_obj ) : % _red.o: % .asm $$(dep )
43
47
$(RGBDS_DIR ) rgbasm -D _RED -h -o $@ $* .asm
44
48
45
- % _blue.o : dep = $(shell $( includes ) $(@D ) /$* .asm)
49
+ % _blue.o : dep = $(shell tools/scan_includes $(@D ) /$* .asm)
46
50
$(pokeblue_obj ) : % _blue.o: % .asm $$(dep )
47
51
$(RGBDS_DIR ) rgbasm -D _BLUE -h -o $@ $* .asm
48
52
@@ -54,7 +58,26 @@ pokeblue_opt = -Cjv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED"
54
58
$(RGBDS_DIR ) rgbfix $($* _opt) $@
55
59
sort $* .sym -o $* .sym
56
60
57
- % .png : ;
58
- % .2bpp : % .png ; $(2bpp ) $<
59
- % .1bpp : % .png ; $(1bpp ) $<
60
- % .pic : % .2bpp ; $(pic ) $<
61
+ gfx/blue/intro_purin_1.6x6.2bpp : rgbgfx += -h
62
+ gfx/blue/intro_purin_2.6x6.2bpp : rgbgfx += -h
63
+ gfx/blue/intro_purin_3.6x6.2bpp : rgbgfx += -h
64
+ gfx/red/intro_nido_1.6x6.2bpp : rgbgfx += -h
65
+ gfx/red/intro_nido_2.6x6.2bpp : rgbgfx += -h
66
+ gfx/red/intro_nido_3.6x6.2bpp : rgbgfx += -h
67
+
68
+ gfx/game_boy.norepeat.2bpp : tools/gfx += --remove-duplicates
69
+ gfx/theend.interleave.2bpp : tools/gfx += --interleave --png=$<
70
+ gfx/tilesets/% .2bpp : tools/gfx += --trim-whitespace
71
+
72
+ % .png : ;
73
+
74
+ % .2bpp : % .png
75
+ rgbgfx $(rgbgfx ) -o $@ $<
76
+ $(if $(tools/gfx ) ,\
77
+ tools/gfx $(tools/gfx ) -o $@ $@ )
78
+ % .1bpp : % .png
79
+ rgbgfx -d1 $(rgbgfx ) -o $@ $<
80
+ $(if $(tools/gfx ) ,\
81
+ tools/gfx $(tools/gfx ) -d1 -o $@ $@ )
82
+ % .pic : % .2bpp
83
+ tools/pkmncompress $< $@
0 commit comments