summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile17
-rwxr-xr-xtools/sort_symfile.sh10
2 files changed, 21 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index c79484e..93bc43f 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ GFX := $(patsubst %.png, $(BUILD)/%.2bpp, \
.SECONDEXPANSION:
.PHONY: all
-all: $(ROMS) $(CORRECTEDROMS) compare coverage
+all: $(ROMS) $(CORRECTEDROMS) compare
.PHONY: compare
compare: $(ROMS)
@@ -40,6 +40,10 @@ compare: $(ROMS)
tools tools/pkmncompress tools/gfx:
$(MAKE) -C tools/
+.PHONY: coverage
+coverage: tools/disasm_coverage.py $(ROMS)
+ $(PYTHON) $< -m $(ROMS:.gb=.map) -b 0x40
+
# Remove files generated by the build process.
.PHONY: clean
clean:
@@ -52,9 +56,14 @@ mostlyclean:
rm -rf $(ROMS) $(OBJS) $(ROMS:.gb=.sym) $(ROMS:.gb=.map) $(CORRECTEDROMS)
find . \( -iname '*.d' \) -exec rm {} +
-$(ROMS): $(OBJS)
+$(ROMS): $(OBJS) | baserom.gb
$(RGBLINK) -d -n $(@:.gb=.sym) -m $(@:.gb=.map) -O $(BASEROM) -o $@ $^
$(RGBFIX) -f lh -k 01 -l 0x33 -m 0x03 -p 0 -r 3 -t "POKEMON2GOLD" $@
+ tools/sort_symfile.sh $(@:.gb=.sym)
+
+baserom.gb:
+ @echo "Please obtain a copy of Gold_debug.sgb and put it in this directory as $@"
+ @exit 1
$(CORRECTEDROMS): %-correctheader.gb: %.gb
cp $< $@
@@ -63,10 +72,6 @@ $(CORRECTEDROMS): %-correctheader.gb: %.gb
$(BUILD)/shim.asm: tools/make_shim.py shim.sym | $$(dir $$@)
$(PYTHON) tools/make_shim.py -w -- $(filter-out $<, $^) > $@
-.PHONY: coverage
-coverage: $(ROMS)
- $(PYTHON) tools/disasm_coverage.py -m $(ROMS:.gb=.map) -b 0x40
-
$(BUILD)/gfx.o: | $(GFX)
$(BUILD)/%.o: $(BUILD)/%.asm | $$(dir $$@)
$(RGBASM) $(RGBASMFLAGS) -M $(@:.o=.d) $(OUTPUT_OPTION) $<
diff --git a/tools/sort_symfile.sh b/tools/sort_symfile.sh
new file mode 100755
index 0000000..d53150f
--- /dev/null
+++ b/tools/sort_symfile.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+sed $1 \
+ -e "s/^..:[0-3]/0_ROM0@&/g" \
+ -e "s/^..:[4-7]/1_ROMX@&/g" \
+ -e "s/^..:[8-9]/2_VRAM@&/g" \
+ -e "s/^..:[A-B]/3_SRAM@&/g" \
+ -e "s/^00:[C-D]/4_WRAM0@&/g" \
+ -e "s/^..:[D-D]/5_WRAMX@&/g" \
+| sort -o $1
+sed -i $1 -e "s/^\w*@//g"