summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 14 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index a5c11e8..2cf4922 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ baserom := DMGAKVJ0.1
dir_source := source
dir_build := build
-dir_assets := assets
+dir_gfx := gfx
dir_tools := tools
RGBASM := rgbasm
@@ -12,13 +12,18 @@ RGBLINK := rgblink
RGBFIX := rgbfix
RGBASMFLAGS := -p 0xff -L
-RGBLINKFLAGS := -p 0xff -d -t
+RGBLINKFLAGS := -p 0xff -d
RGBFIXFLAGS := -p 0xff -c -m 0x1b -r 0x03 -k "01" -i "AKVJ" -t "POKEPICROSS"
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))
-objects := $(patsubst $(dir_source)/%.asm, $(dir_build)/%.o, $(call rwildcard, $(dir_source)/, *.asm))
+
+objects := $(patsubst $(dir_source)/%.asm, $(dir_build)/%.o, \
+ $(call rwildcard, $(dir_source)/, *.asm))
objects += $(dir_build)/shim.o
+gfx := $(patsubst $(dir_gfx)/%.png, $(dir_build)/gfx/%.bin, \
+ $(call rwildcard, $(dir_gfx)/, *.png))
+
.SECONDEXPANSION:
.PHONY: all
@@ -33,14 +38,17 @@ $(name).gbc: layout.link $(objects) | $(baserom)
$(RGBLINK) $(RGBLINKFLAGS) -O $(baserom) -l $< -n $(@:.gbc=.sym) -m $(@:.gbc=.map) -o $@ $(filter-out $<, $^)
$(RGBFIX) $(RGBFIXFLAGS) -v $@
-$(dir_build)/shim.asm: shim.sym
+$(dir_build)/shim.asm: shim.sym | $$(dir $$@)
$(dir_tools)/makeshim.py $< > $@
-$(dir_build)/%.o: $(dir_build)/%.asm | $$(dir $$@)
+$(dir_build)/%.o: $(dir_build)/%.asm | $(gfx) $$(dir $$@)
$(RGBASM) $(RGBASMFLAGS) -i $(dir_build)/ -i $(dir_source)/ -M $(@:.o=.d) -o $@ $<
-$(dir_build)/%.o: $(dir_source)/%.asm | $$(dir $$@)
+$(dir_build)/%.o: $(dir_source)/%.asm | $(gfx) $$(dir $$@)
$(RGBASM) $(RGBASMFLAGS) -i $(dir_build)/ -i $(dir_source)/ -M $(@:.o=.d) -o $@ $<
+$(dir_build)/gfx/%.bin: $(dir_gfx)/%.png | $$(dir $$@)
+ $(RGBGFX) -o $@ $<
+
.PRECIOUS: %/
%/:
mkdir -p $@