summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-03 17:32:21 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-03 17:32:21 -0400
commit64da1f5d6bf96ff7f35165476ecc8d623f76060d (patch)
treea41a8b72ddf548ad53c1373b5082e247527efe37
parent62e137f6cedeeebb8457fdb710ea725f73ded49f (diff)
Move graphics-only object file sources into gfx/
Previously this wasn't working, but now the Makefile uses pokegold's technique for running scan_includes. It also enables and fixes some rgbds warnings ("Non-local labels without a colon are deprecated").
-rw-r--r--Makefile45
-rw-r--r--gfx/pics.asm (renamed from pics.asm)0
-rw-r--r--gfx/sprites.asm (renamed from sprites.asm)0
-rw-r--r--gfx/tilesets.asm (renamed from tilesets.asm)0
-rwxr-xr-xscripts/CeladonMart3F.asm2
-rwxr-xr-xscripts/CeruleanCaveB1F.asm2
-rwxr-xr-xscripts/PowerPlant.asm2
7 files changed, 33 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 9475c377..684d665e 100644
--- a/Makefile
+++ b/Makefile
@@ -5,11 +5,11 @@ audio.o \
home.o \
main.o \
maps.o \
-pics.o \
-sprites.o \
text.o \
-tilesets.o \
wram.o \
+gfx/pics.o \
+gfx/sprites.o \
+gfx/tilesets.o
pokered_obj := $(rom_obj:.o=_red.o)
pokeblue_obj := $(rom_obj:.o=_blue.o)
@@ -35,7 +35,7 @@ RGBLINK ?= $(RGBDS)rgblink
.PHONY: all red blue clean tidy compare tools
all: $(roms)
-red: pokered.gbc
+red: pokered.gbc
blue: pokeblue.gbc
# For contributors to make sure a change didn't affect the contents of the rom.
@@ -44,7 +44,7 @@ compare: $(roms)
clean:
rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym)
- find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} +
+ find gfx \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -delete
$(MAKE) clean -C tools/
tidy:
@@ -55,28 +55,43 @@ tools:
$(MAKE) -C tools/
+RGBASMFLAGS = -h -Weverything
+# Create a sym/map for debug purposes if `make` run with `DEBUG=1`
+ifeq ($(DEBUG),1)
+RGBASMFLAGS += -E
+endif
+
+$(pokered_obj): RGBASMFLAGS += -D _RED
+$(pokeblue_obj): RGBASMFLAGS += -D _BLUE
+
+# The dep rules have to be explicit or else missing files won't be reported.
+# As a side effect, they're evaluated immediately instead of when the rule is invoked.
+# It doesn't look like $(shell) can be deferred so there might not be a better way.
+define DEP
+$1: $2 $$(shell tools/scan_includes $2)
+ $$(RGBASM) $$(RGBASMFLAGS) -o $$@ $$<
+endef
+
# Build tools when building the rom.
# This has to happen before the rules are processed, since that's when scan_includes is run.
ifeq (,$(filter clean tools,$(MAKECMDGOALS)))
+
$(info $(shell $(MAKE) -C tools))
-endif
+# Dependencies for objects (drop _red and _blue from asm file basenames)
+$(foreach obj, $(pokered_obj), $(eval $(call DEP,$(obj),$(obj:_red.o=.asm))))
+$(foreach obj, $(pokeblue_obj), $(eval $(call DEP,$(obj),$(obj:_blue.o=.asm))))
-%.asm: ;
+endif
-%_red.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
-$(pokered_obj): %_red.o: %.asm $$(dep)
- $(RGBASM) -D _RED -h -o $@ $*.asm
-%_blue.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
-$(pokeblue_obj): %_blue.o: %.asm $$(dep)
- $(RGBASM) -D _BLUE -h -o $@ $*.asm
+%.asm: ;
pokered_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED"
pokeblue_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON BLUE"
-%.gbc: $$(%_obj)
- $(RGBLINK) -d -m $*.map -n $*.sym -l layout.link -o $@ $^
+%.gbc: $$(%_obj) layout.link
+ $(RGBLINK) -d -m $*.map -n $*.sym -l layout.link -o $@ $(filter %.o,$^)
$(RGBFIX) $($*_opt) $@
diff --git a/pics.asm b/gfx/pics.asm
index 0e2adc24..0e2adc24 100644
--- a/pics.asm
+++ b/gfx/pics.asm
diff --git a/sprites.asm b/gfx/sprites.asm
index 4548bbe3..4548bbe3 100644
--- a/sprites.asm
+++ b/gfx/sprites.asm
diff --git a/tilesets.asm b/gfx/tilesets.asm
index f64dc20a..f64dc20a 100644
--- a/tilesets.asm
+++ b/gfx/tilesets.asm
diff --git a/scripts/CeladonMart3F.asm b/scripts/CeladonMart3F.asm
index e7e216d9..c8d8b509 100755
--- a/scripts/CeladonMart3F.asm
+++ b/scripts/CeladonMart3F.asm
@@ -74,7 +74,7 @@ CeladonMart3Text5:
TX_FAR _CeladonMart3Text5
db "@"
-CeladonMart3Text12
+CeladonMart3Text12:
CeladonMart3Text10:
CeladonMart3Text8:
CeladonMart3Text6:
diff --git a/scripts/CeruleanCaveB1F.asm b/scripts/CeruleanCaveB1F.asm
index a570ab18..9017bec3 100755
--- a/scripts/CeruleanCaveB1F.asm
+++ b/scripts/CeruleanCaveB1F.asm
@@ -7,7 +7,7 @@ CeruleanCaveB1F_Script:
ld [wCeruleanCaveB1FCurScript], a
ret
-CeruleanCaveB1F_ScriptPointers
+CeruleanCaveB1F_ScriptPointers:
dw CheckFightingMapTrainers
dw DisplayEnemyTrainerTextAndStartBattle
dw EndTrainerBattle
diff --git a/scripts/PowerPlant.asm b/scripts/PowerPlant.asm
index 35b4893f..f720b6f8 100755
--- a/scripts/PowerPlant.asm
+++ b/scripts/PowerPlant.asm
@@ -7,7 +7,7 @@ PowerPlant_Script:
ld [wPowerPlantCurScript], a
ret
-PowerPlant_ScriptPointers
+PowerPlant_ScriptPointers:
dw CheckFightingMapTrainers
dw DisplayEnemyTrainerTextAndStartBattle
dw EndTrainerBattle