Port pokegold's method of defining rgblink arguments per ROM

This commit is contained in:
Rangi 2020-07-13 16:10:52 -04:00
parent e239aa4aba
commit 7580f1119b
3 changed files with 39 additions and 46 deletions

7
FAQ.md
View File

@ -4,7 +4,7 @@
## Questions ## Questions
- [What is pokecrystal11.gbc?](#what-is-pokecrystal11gbc) - [What is pokecrystal11.gbc?](#what-is-pokecrystal11gbc)
- [What is pokecrystal-au.gbc?](#what-is-pokecrystal-augbc) - [What is pokecrystal_au.gbc?](#what-is-pokecrystal_augbc)
- [I can't build the ROM, `make` just prints an error!](#i-cant-build-the-rom-make-just-prints-an-error) - [I can't build the ROM, `make` just prints an error!](#i-cant-build-the-rom-make-just-prints-an-error)
- [`gcc`: command not found](#gcc-command-not-found) - [`gcc`: command not found](#gcc-command-not-found)
- ["ERROR: `UNION` already defined"](#error-union-already-defined) - ["ERROR: `UNION` already defined"](#error-union-already-defined)
@ -25,9 +25,10 @@
Version 1.1 of Pokémon Crystal, which fixed some issues with the initial international release. `make crystal11` defines `_CRYSTAL11` so the assembly builds the changed version. Version 1.1 of Pokémon Crystal, which fixed some issues with the initial international release. `make crystal11` defines `_CRYSTAL11` so the assembly builds the changed version.
## What is pokecrystal-au.gbc?
The Australian release of Pokémon Crystal, which is based on the international 1.1 release but censors gambling references from the Game Corners. `make crystal-au` defines `_CRYSTAL11` and `_CRYSTAL_AU` so the assembly builds the changed version. ## What is pokecrystal_au.gbc?
The Australian release of Pokémon Crystal, which is based on the international 1.1 release but censors gambling references from the Game Corners. `make crystal_au` defines `_CRYSTAL11` and `_CRYSTAL_AU` so the assembly builds the changed version.
## I can't build the ROM, `make` just prints an error! ## I can't build the ROM, `make` just prints an error!

View File

@ -1,6 +1,6 @@
roms := pokecrystal.gbc pokecrystal11.gbc pokecrystal-au.gbc pokecrystal-debug.gbc pokecrystal11-debug.gbc roms := pokecrystal.gbc pokecrystal11.gbc pokecrystal_au.gbc pokecrystal_debug.gbc pokecrystal11_debug.gbc
crystal_obj := \ rom_obj := \
audio.o \ audio.o \
home.o \ home.o \
main.o \ main.o \
@ -17,10 +17,11 @@ gfx/sprites.o \
gfx/tilesets.o \ gfx/tilesets.o \
lib/mobile/main.o lib/mobile/main.o
crystal11_obj := $(crystal_obj:.o=11.o) pokecrystal_obj := $(rom_obj:.o=.o)
crystal_au_obj := $(crystal_obj:.o=_au.o) pokecrystal11_obj := $(rom_obj:.o=11.o)
crystal_debug_obj := $(crystal_obj:.o=_debug.o) pokecrystal_au_obj := $(rom_obj:.o=_au.o)
crystal11_debug_obj := $(crystal_obj:.o=11_debug.o) pokecrystal_debug_obj := $(rom_obj:.o=_debug.o)
pokecrystal11_debug_obj := $(rom_obj:.o=11_debug.o)
### Build tools ### Build tools
@ -41,7 +42,7 @@ RGBLINK ?= $(RGBDS)rgblink
### Build targets ### Build targets
.SUFFIXES: .SUFFIXES:
.PHONY: all crystal crystal11 crystal-au crystal-debug crystal11-debug clean tidy compare tools .PHONY: all crystal crystal11 crystal_au crystal_debug crystal11_debug clean tidy compare tools
.SECONDEXPANSION: .SECONDEXPANSION:
.PRECIOUS: .PRECIOUS:
.SECONDARY: .SECONDARY:
@ -49,18 +50,18 @@ RGBLINK ?= $(RGBDS)rgblink
all: crystal all: crystal
crystal: pokecrystal.gbc crystal: pokecrystal.gbc
crystal11: pokecrystal11.gbc crystal11: pokecrystal11.gbc
crystal-au: pokecrystal-au.gbc crystal_au: pokecrystal_au.gbc
crystal-debug: pokecrystal-debug.gbc crystal_debug: pokecrystal_debug.gbc
crystal11-debug: pokecrystal11-debug.gbc crystal11_debug: pokecrystal11_debug.gbc
clean: clean:
rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(crystal_debug_obj) $(crystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o rm -f $(roms) $(pokecrystal_obj) $(pokecrystal11_obj) $(pokecrystal_au_obj) $(pokecrystal_debug_obj) $(pokecrystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
find gfx \( -name "*.[12]bpp" -o -name "*.lz" -o -name "*.gbcpal" -o -name "*.sgb.tilemap" \) -delete find gfx \( -name "*.[12]bpp" -o -name "*.lz" -o -name "*.gbcpal" -o -name "*.sgb.tilemap" \) -delete
find gfx/pokemon -mindepth 1 ! -path "gfx/pokemon/unown/*" \( -name "bitmask.asm" -o -name "frames.asm" -o -name "front.animated.tilemap" -o -name "front.dimensions" \) -delete find gfx/pokemon -mindepth 1 ! -path "gfx/pokemon/unown/*" \( -name "bitmask.asm" -o -name "frames.asm" -o -name "front.animated.tilemap" -o -name "front.dimensions" \) -delete
$(MAKE) clean -C tools/ $(MAKE) clean -C tools/
tidy: tidy:
rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(crystal_debug_obj) $(crystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o rm -f $(roms) $(pokecrystal_obj) $(pokecrystal11_obj) $(pokecrystal_au_obj) $(pokecrystal_debug_obj) $(pokecrystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
$(MAKE) clean -C tools/ $(MAKE) clean -C tools/
compare: $(roms) compare: $(roms)
@ -76,11 +77,11 @@ ifeq ($(DEBUG),1)
RGBASMFLAGS += -E RGBASMFLAGS += -E
endif endif
$(crystal_obj): RGBASMFLAGS += $(pokecrystal_obj): RGBASMFLAGS +=
$(crystal11_obj): RGBASMFLAGS += -D _CRYSTAL11 $(pokecrystal11_obj): RGBASMFLAGS += -D _CRYSTAL11
$(crystal_au_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU $(pokecrystal_au_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU
$(crystal_debug_obj): RGBASMFLAGS += -D _DEBUG $(pokecrystal_debug_obj): RGBASMFLAGS += -D _DEBUG
$(crystal11_debug_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _DEBUG $(pokecrystal11_debug_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _DEBUG
rgbdscheck.o: rgbdscheck.asm rgbdscheck.o: rgbdscheck.asm
$(RGBASM) -o $@ $< $(RGBASM) -o $@ $<
@ -99,34 +100,25 @@ ifeq (,$(filter clean tools,$(MAKECMDGOALS)))
$(info $(shell $(MAKE) -C tools)) $(info $(shell $(MAKE) -C tools))
$(foreach obj, $(crystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm)))) # Dependencies for shared objects objects
$(foreach obj, $(crystal11_obj), $(eval $(call DEP,$(obj),$(obj:11.o=.asm)))) $(foreach obj, $(pokecrystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm))))
$(foreach obj, $(crystal_au_obj), $(eval $(call DEP,$(obj),$(obj:_au.o=.asm)))) $(foreach obj, $(pokecrystal11_obj), $(eval $(call DEP,$(obj),$(obj:11.o=.asm))))
$(foreach obj, $(crystal_debug_obj), $(eval $(call DEP,$(obj),$(obj:_debug.o=.asm)))) $(foreach obj, $(pokecrystal_au_obj), $(eval $(call DEP,$(obj),$(obj:_au.o=.asm))))
$(foreach obj, $(crystal11_debug_obj), $(eval $(call DEP,$(obj),$(obj:11_debug.o=.asm)))) $(foreach obj, $(pokecrystal_debug_obj), $(eval $(call DEP,$(obj),$(obj:_debug.o=.asm))))
$(foreach obj, $(pokecrystal11_debug_obj), $(eval $(call DEP,$(obj),$(obj:11_debug.o=.asm))))
endif endif
pokecrystal.gbc: $(crystal_obj) layout.link pokecrystal_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
$(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l layout.link -p 0 -o $@ $(crystal_obj) pokecrystal11_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@ pokecrystal_au_opt = -Cjv -t PM_CRYSTAL -i BYTU -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal11_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal11.gbc: $(crystal11_obj) layout.link %.gbc: $$(%_obj) layout.link
$(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l layout.link -p 0 -o $@ $(crystal11_obj) $(RGBLINK) -n $*.sym -m $*.map -l layout.link -o $@ $(filter %.o,$^)
$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@ $(RGBFIX) $($*_opt) $@
pokecrystal-au.gbc: $(crystal_au_obj) layout.link
$(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l layout.link -p 0 -o $@ $(crystal_au_obj)
$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTU -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
pokecrystal-debug.gbc: $(crystal_debug_obj) layout.link
$(RGBLINK) -n pokecrystal-debug.sym -m pokecrystal-debug.map -l layout.link -p 0 -o $@ $(crystal_debug_obj)
$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
pokecrystal11-debug.gbc: $(crystal11_debug_obj) layout.link
$(RGBLINK) -n pokecrystal11-debug.sym -m pokecrystal11-debug.map -l layout.link -p 0 -o $@ $(crystal11_debug_obj)
$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
### LZ compression rules ### LZ compression rules

View File

@ -1,5 +1,5 @@
f4cd194bdee0d04ca4eac29e09b8e4e9d818c133 *pokecrystal.gbc f4cd194bdee0d04ca4eac29e09b8e4e9d818c133 *pokecrystal.gbc
f2f52230b536214ef7c9924f483392993e226cfb *pokecrystal11.gbc f2f52230b536214ef7c9924f483392993e226cfb *pokecrystal11.gbc
a0fc810f1d4e124434f7be2c989ab5b5892ddf36 *pokecrystal-au.gbc a0fc810f1d4e124434f7be2c989ab5b5892ddf36 *pokecrystal_au.gbc
c60d57a24bbe8ecf7cba54ab3f90669f97bd330d *pokecrystal-debug.gbc c60d57a24bbe8ecf7cba54ab3f90669f97bd330d *pokecrystal_debug.gbc
391ae86b1d5a26db712ffe6c28bbf2a1f804c3c4 *pokecrystal11-debug.gbc 391ae86b1d5a26db712ffe6c28bbf2a1f804c3c4 *pokecrystal11_debug.gbc