summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2018-07-03 17:07:05 -0400
committerluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2018-07-03 17:07:05 -0400
commite1659ecd41dfac70eb021c0f5fe983ed6f043433 (patch)
tree86ec6137c666650168716247fa63241e79b1788b /Makefile
parentf3f0e711bf4f4205fd29f2b448c93ff5597507e5 (diff)
Introduce linkerscript.
Addresses of sections will now be added to the linkerscript via `org`, and the section name will be the path/to/file. If there is more than one section in the file, then add a @SectionName after the path/to/file to describe the section.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 4 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index dd6c27a..129ea09 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,8 @@ sort_sym := tools/sort_symfile.sh
RGBASMFLAGS := -h -E -i $(BUILD)/ -DGOLD -DDEBUG=1
tools/gfx :=
-ROM := pokegold-spaceworld.gb
+ROMNAME := pokegold-spaceworld
+ROM := $(ROMNAME).gb
BASEROM := baserom.gb
SHIM := shim.sym
CORRECTEDROM := $(ROM:%.gb=%-correctheader.gb)
@@ -55,7 +56,7 @@ coverage: $(ROM:.gb=.map) tools/disasm_coverage.py
$(PYTHON) tools/disasm_coverage.py -m $< -b 0x40
.PHONY: linkerscript
-linkerscript: $(ROM:.gb=.link)
+linkerscript: $(ROMNAME)-gen.link
%.link: %.map tools/map2link.py
$(PYTHON3) tools/map2link.py $< $@
@@ -68,7 +69,7 @@ $(CORRECTEDROM): %-correctheader.gb: %.gb
$(RGBFIX) -f hg -m 0x10 $@
$(ROM): poke%-spaceworld.gb: $(OBJS) | $(BASEROM)
- $(RGBLINK) -d -n $(@:.gb=.sym) -m $(@:.gb=.map) -O $(BASEROM) -o $@ $^
+ $(RGBLINK) -d -n $(@:.gb=.sym) -m $(@:.gb=.map) -l $(ROMNAME).link -O $(BASEROM) -o $@ $^
$(RGBFIX) -f lh -k 01 -l 0x33 -m 0x03 -p 0 -r 3 -t "POKEMON2$(shell echo $* | cut -d _ -f 1 | tr '[:lower:]' '[:upper:]')" $@
$(sort_sym) $(@:.gb=.sym)