1
- # Build Red/Blue. Yellow is WIP.
2
- roms := pokered.gbc pokeblue.gbc
3
-
4
-
5
- .PHONY : all clean red blue yellow compare
6
-
7
- all : $(roms )
8
- red : pokered.gbc
9
- blue : pokeblue.gbc
10
- yellow : pokeyellow.gbc
11
-
12
- versions := red blue yellow
13
-
14
-
15
- # Header options for rgbfix.
16
- dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03
17
- cgb_opt = -cjsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03
18
-
19
- red_opt = $(dmg_opt ) -t "POKEMON RED"
20
- blue_opt = $(dmg_opt ) -t "POKEMON BLUE"
21
- yellow_opt = $(cgb_opt ) -t "POKEMON YELLOW"
22
-
23
-
24
-
25
- # If your default python is 3, you may want to change this to python27.
1
+ # python 2.7
26
2
PYTHON := python
27
3
28
4
# md5sum -c is used to compare rom hashes. The options may vary across platforms.
29
5
MD5 := md5sum -c --quiet
30
6
31
7
32
- # The compare target is a shortcut to check that the build matches the original roms exactly.
33
- # This is for contributors to make sure a change didn't affect the contents of the rom.
34
- # More thorough comparison can be made by diffing the output of hexdump -C against both roms.
35
- compare : red blue
36
- @$(MD5 ) roms.md5
37
-
38
-
39
8
# Clear the default suffixes.
40
9
.SUFFIXES :
41
10
.SUFFIXES : .asm .o .gbc .png .2bpp .1bpp .pic
@@ -46,16 +15,19 @@ compare: red blue
46
15
# Suppress annoying intermediate file deletion messages.
47
16
.PRECIOUS : % .2bpp
48
17
49
- # Filepath shortcuts to avoid overly long recipes.
18
+ .PHONY : all clean red blue compare
19
+
20
+
50
21
poketools := extras/pokemontools
51
22
gfx := $(PYTHON ) $(poketools ) /gfx.py
52
- pic := $(PYTHON ) $(poketools ) /pic.py
23
+ 2bpp := $(gfx ) 2bpp
24
+ 1bpp := $(gfx ) 1bpp
25
+ pic := $(PYTHON ) $(poketools ) /pic.py compress
53
26
includes := $(PYTHON ) $(poketools ) /scan_includes.py
54
27
28
+ versions := red blue
55
29
56
-
57
- # Collect file dependencies for objects in red/, blue/ and yellow/.
58
- # These aren't provided by rgbds by default, so we have to look for file includes ourselves.
30
+ # Collect file dependencies for objects in red/ and blue/.
59
31
$(foreach ver, $(versions), \
60
32
$(eval $(ver)_asm := $(shell find $(ver) -iname '*.asm')) \
61
33
$(eval $(ver)_obj := $($(ver)_asm:.asm=.o)) \
@@ -66,32 +38,43 @@ $(foreach obj, $(all_obj), \
66
38
)
67
39
68
40
69
- # Image files are added to a queue to reduce build time. They're converted when building parent objects.
70
- % .png : ;
71
- % .2bpp : % .png ; $(eval 2bppq += $< ) @rm -f $@
72
- % .1bpp : % .png ; $(eval 1bppq += $< ) @rm -f $@
73
- % .pic : % .2bpp ; $(eval picq += $< ) @rm -f $@
41
+ roms := pokered.gbc pokeblue.gbc
74
42
75
- # Assemble source files into objects.
76
- # Queue payloads are here. These are made silent since there may be hundreds of targets.
77
- # Use rgbasm -h to use halts without nops.
78
- $(all_obj ) : $$* .asm $$($$* _dep)
79
- @$(gfx ) 2bpp $(2bppq ) ; $(eval 2bppq :=)
80
- @$(gfx ) 1bpp $(1bppq ) ; $(eval 1bppq :=)
81
- @$(pic ) compress $(picq ) ; $(eval picq :=)
82
- rgbasm -h -o $@ $* .asm
43
+ all : $(roms )
44
+ red : pokered.gbc
45
+ blue : pokeblue.gbc
83
46
47
+ # For contributors to make sure a change didn't affect the contents of the rom.
48
+ compare : red blue
49
+ @$(MD5 ) roms.md5
84
50
85
- # Link objects together to build a rom.
51
+ clean :
52
+ rm -f $(roms ) $(all_obj ) $(roms:.gbc=.sym )
53
+ find . \( -iname ' *.1bpp' -o -iname ' *.2bpp' -o -iname ' *.pic' \) -exec rm {} +
86
54
87
- # Make a symfile for debugging. Add the mapfile back in
88
- link = rgblink -n poke$* .sym
89
55
90
- poke% .gbc : $$(%_obj )
91
- $(link ) -o $@ $^
92
- rgbfix $($* _opt) $@
56
+ # Don't fix halts.
57
+ asm_opt = -h
93
58
59
+ # Make a symfile for debugging.
60
+ link_opt = -n poke$* .sym
94
61
95
- clean :
96
- rm -f $(roms ) $(all_obj ) poke* .sym
97
- find . \( -iname ' *.1bpp' -o -iname ' *.2bpp' -o -iname ' *.pic' \) -exec rm {} +
62
+ # Header options for rgbfix.
63
+ dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03
64
+ red_opt = $(dmg_opt ) -t "POKEMON RED"
65
+ blue_opt = $(dmg_opt ) -t "POKEMON BLUE"
66
+
67
+
68
+ % .png : ;
69
+ % .2bpp : % .png ; @$(2bpp ) $<
70
+ % .1bpp : % .png ; @$(1bpp ) $<
71
+ % .pic : % .2bpp ; @$(pic ) $<
72
+
73
+ # Assemble source files into objects.
74
+ $(all_obj ) : $$* .asm $$($$* _dep)
75
+ rgbasm $(asm_opt ) -o $@ $* .asm
76
+
77
+ # Link objects to produce a rom.
78
+ poke% .gbc : $$(%_obj )
79
+ rgblink $(link_opt ) -o $@ $^
80
+ rgbfix $($* _opt) $@
0 commit comments