summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 7 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 8888cb5..dd6c27a 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ RGBFIX := rgbfix
sort_sym := tools/sort_symfile.sh
#sort_sym := $(PYTHON3) tools/sort_sym.py
-RGBASMFLAGS := -h -E -i build/ -DGOLD -DDEBUG=1
+RGBASMFLAGS := -h -E -i $(BUILD)/ -DGOLD -DDEBUG=1
tools/gfx :=
ROM := pokegold-spaceworld.gb
@@ -21,16 +21,9 @@ CORRECTEDROM := $(ROM:%.gb=%-correctheader.gb)
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))
DIRS := home engine data audio
-ASMFILES := $(call rwildcard, $(DIRS), *.asm)
-OBJS := $(addprefix $(BUILD)/, gfx.o vram.o sram.o wram.o hram.o shim.o)
-OBJS += $(patsubst %.asm, $(BUILD)/%.o, $(ASMFILES))
-
-GFX := $(patsubst %.png, $(BUILD)/%.2bpp, \
- $(patsubst %.1bpp.png, $(BUILD)/%.1bpp, \
- $(patsubst gfx/pokemon/%/front.png, $(BUILD)/gfx/pokemon/%/front.pic, \
- $(patsubst gfx/pokemon/%/back.png, $(BUILD)/gfx/pokemon/%/back.pic, \
- $(patsubst gfx/trainer/%.png, $(BUILD)/gfx/trainer/%.pic, \
- $(call rwildcard, gfx, *.png))))))
+ASMFILES := $(call rwildcard, $(DIRS), *.asm) gfx.asm vram.asm sram.asm wram.asm hram.asm
+OBJS := $(patsubst %.asm, $(BUILD)/%.o, $(ASMFILES))
+OBJS += $(BUILD)/shim.o
.SECONDEXPANSION:
@@ -48,13 +41,13 @@ tools tools/pkmncompress tools/gfx:
# Remove files generated by the build process.
.PHONY: clean
clean:
- rm -rf $(ROM) $(CORRECTEDROM) $(BUILD) $(ROMS:.gb=.sym) $(ROMS:.gb=.map)
+ rm -rf $(ROM) $(CORRECTEDROM) $(BUILD) $(ROMS:.gb=.sym) $(ROMS:.gb=.map) *.d
"$(MAKE)" -C tools clean
# Remove files except for graphics.
.PHONY: mostlyclean
mostlyclean:
- rm -rf $(ROM) $(CORRECTEDROM) $(OBJS) $(ROMS:.gb=.sym) $(ROMS:.gb=.map)
+ rm -rf $(ROM) $(CORRECTEDROM) $(OBJS) $(ROMS:.gb=.sym) $(ROMS:.gb=.map) *.d
# Utilities
.PHONY: coverage
@@ -86,7 +79,6 @@ $(BASEROM):
$(BUILD)/shim.asm: tools/make_shim.py $(SHIM) | $$(dir $$@)
$(PYTHON3) tools/make_shim.py -w $(filter-out $<, $^) > $@
-$(BUILD)/gfx.o: | $(GFX)
$(BUILD)/%.o: $(BUILD)/%.asm | $$(dir $$@)
$(RGBASM) $(RGBASMFLAGS) $(OUTPUT_OPTION) $<
$(BUILD)/%.o: %.asm | $$(dir $$@)
@@ -124,7 +116,7 @@ $(BUILD)/%.tilemap: %.png | $$(dir $$@)
%/:
mkdir -p $@
-DEPENDENCY_SCAN_EXIT_STATUS := $(shell $(PYTHON3) tools/scan_includes.py $(ASMFILES) > dependencies.d; echo $$?)
+DEPENDENCY_SCAN_EXIT_STATUS := $(shell $(PYTHON3) tools/scan_includes.py $(BUILD:%=-b %) $(ASMFILES) > dependencies.d; echo $$?)
ifneq ($(DEPENDENCY_SCAN_EXIT_STATUS), 0)
$(error Dependency scan failed)
endif