summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorpfero <ohpee@loves.dicksinhisan.us>2018-06-03 20:42:34 +0200
committerpfero <ohpee@loves.dicksinhisan.us>2018-06-03 20:46:15 +0200
commit25853364c84f0c05611b501807d75e1a1ec10927 (patch)
treeafbab05e7692976d2e78dab08c64f9c8586e3150 /Makefile
parent63ee9c801200b64108dbfcfbc31fe2f5eda975c9 (diff)
Update tools/sort_symfile.sh and clean up Makefile
Fixed compare being ran before the correctedheader rom was built. Made `mostlyclean` clean up all the .d files it knows about and include the correct .d files.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile58
1 files changed, 20 insertions, 38 deletions
diff --git a/Makefile b/Makefile
index 11977d0..7f7346b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,27 @@
-include config.mk
-
-BUILDBASE := build
-BUILD := $(BUILDBASE)
+BUILD := build
MD5 := md5sum -c
PYTHON := python
-PYTHON3 := python3.6
+PYTHON3 := python3
-RGBASM := rgbasm -D$(GAME_VERSION)=1 -DDEBUG=$(DEBUG)
+RGBASM := rgbasm
RGBGFX := rgbgfx
RGBLINK := rgblink
RGBFIX := rgbfix
-
-RGBASMFLAGS := -h -E -i $(BUILD)/
-tools/gfx :=
-tools/make_shim :=
sort_sym := tools/sort_symfile.sh
#sort_sym := $(PYTHON3) tools/sort_sym.py
-ROM := poke$(BUILD_NAME)-spaceworld.gb
-ROMS := $(foreach r, gold gold-debug silver silver-debug, poke$(r)-spaceworld.gb)
-# Pokemon Gold Debug
+RGBASMFLAGS := -h -E -i $(BUILD)/ -DGOLD -DDEBUG=1
+tools/gfx :=
+
+ROM := pokegold-spaceworld.gb
BASEROM := baserom.gb
-DIRS := home engine data audio
-OBJS := $(addprefix $(BUILD)/, gfx.o sram.o wram.o hram.o shim.o)
SHIM := shim.sym
CORRECTEDROM := $(ROM:%.gb=%-correctheader.gb)
-CORRECTEDROMS := $(ROMS:%.gb=%-correctheader.gb)
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))
+DIRS := home engine data audio
+OBJS := $(addprefix $(BUILD)/, gfx.o sram.o wram.o hram.o shim.o)
OBJS += $(patsubst %.asm, $(BUILD)/%.o, $(call rwildcard, $(DIRS), *.asm))
GFX := $(patsubst %.png, $(BUILD)/%.2bpp, \
@@ -44,7 +37,7 @@ GFX := $(patsubst %.png, $(BUILD)/%.2bpp, \
all: $(ROM) $(CORRECTEDROM) compare
.PHONY: compare
-compare: $(ROM)
+compare: $(ROM) $(CORRECTEDROM)
$(MD5) roms.md5
.PHONY: tools
@@ -58,29 +51,29 @@ coverage: tools/disasm_coverage.py $(ROM)
# Remove files generated by the build process.
.PHONY: clean
clean:
- rm -rf $(ROMS) $(CORRECTEDROMS) $(BUILDBASE) $(ROMS:.gb=.sym) $(ROMS:.gb=.map) $(CORRECTEDROMS)
+ rm -rf $(ROM) $(CORRECTEDROM) $(BUILD) $(ROMS:.gb=.sym) $(ROMS:.gb=.map)
make -C tools clean
# Remove files except for graphics.
.PHONY: mostlyclean
mostlyclean:
- rm -rf $(ROMS) $(OBJS) $(ROMS:.gb=.sym) $(ROMS:.gb=.map) $(CORRECTEDROMS)
- find . \( -iname '*.d' \) -exec rm {} +
+ rm -rf $(ROM) $(CORRECTEDROM) $(OBJS) $(OBJS:.o=.d) $(ROMS:.gb=.sym) $(ROMS:.gb=.map)
+
+$(CORRECTEDROM): %-correctheader.gb: %.gb
+ cp $< $@
+ $(RGBFIX) -f hg -m 0x10 $@
-$(ROM): $(OBJS) | $(BASEROM)
+$(ROM): poke%-spaceworld.gb: $(OBJS) | $(BASEROM)
$(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 "POKEMON2$(GAME_VERSION)" $@
+ $(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)
$(BASEROM):
@echo "Please obtain a copy of Gold_debug.sgb and put it in this directory as $@"
@exit 1
-$(BUILD)/shim.asm: tools/make_shim $(SHIM) tools/make_shim | $$(dir $$@)
+$(BUILD)/shim.asm: tools/make_shim $(SHIM) | $$(dir $$@)
tools/make_shim -w $(filter-out $<, $^) > $@
-$(CORRECTEDROM): %-correctheader.gb: %.gb
- cp $< $@
- $(RGBFIX) -f hg -m 0x10 $@
$(BUILD)/gfx.o: | $(GFX)
$(BUILD)/%.o: $(BUILD)/%.asm | $$(dir $$@)
@@ -121,15 +114,4 @@ $(BUILD)/%.tilemap: %.png | $$(dir $$@)
%/:
mkdir -p $@
--include $(call rwildcard, $(BUILD)/, *.d)
-
-#gold: ; @$(MAKE) GAME_VERSION=GOLD
-#gold_debug: ; @$(MAKE) GAME_VERSION=GOLD DEBUG=1
-#silver: ; @$(MAKE) GAME_VERSION=SILVER
-#silver_debug: ; @$(MAKE) GAME_VERSION=SILVER DEBUG=1
-#compare: ;
-# @$(MAKE) GAME_VERSION=GOLD COMPARE=1
-# @$(MAKE) GAME_VERSION=GOLD DEBUG=1 COMPARE=1
-# @$(MAKE) GAME_VERSION=SILVER COMPARE=1
-# @$(MAKE) GAME_VERSION=SILVER DEBUG=1 COMPARE=1
-# @$(MD5) roms.md5
+-include $(OBJS:.o=.d)