summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-12-06 22:40:46 -0500
committeryenatch <yenatch@gmail.com>2013-12-07 20:01:50 -0500
commit120ba9664992cada4781e4d524304e4499e9083f (patch)
tree93dbfcf49a5835d5708c6b6a58c608e60297d773 /Makefile
parentbacc4594c0772dab004e4f97e21529a523918a89 (diff)
handle preprocessing in one python procress; export asm labels
instead of running a process for each file, one process handles all files rgbasm requires label EXPORT definitions for cross-object compiling. this is handled by globals.asm
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 21 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 0163ebf9..41a620a0 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,8 @@ PYTHON := python
.SECONDEXPANSION:
+TEXTQUEUE :=
+
RED_OBJS := pokered.o
BLUE_OBJS := pokeblue.o
@@ -13,9 +15,11 @@ ROMS := pokered.gbc pokeblue.gbc
# generate dependencies for each object
$(shell $(foreach obj, $(OBJS), \
- $(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) extras/pokemontools/scan_includes.py $(obj:.o=.asm))) \
+ $(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) extras/pokemontools/scan_includes.py $(obj:.o=.asm) | sed s/globals.asm//g)) \
+))
+$(shell $(foreach obj, $(OBJS), \
+ $(eval ALL_DEPENDENCIES := $(ALL_DEPENDENCIES) $($(obj:.o=)_DEPENDENCIES)) \
))
-
all: $(ROMS)
red: pokered.gbc
@@ -27,6 +31,7 @@ redrle: extras/redtools/redrle.c
clean:
rm -f $(ROMS)
rm -f $(OBJS)
+ rm -f globals.asm
find -iname '*.tx' -delete
rm -f redrle
@@ -35,20 +40,26 @@ baserom.gbc: ;
@echo "Wait! Need baserom.gbc first. Check README and INSTALL for details." && false
%.asm: ;
-
.asm.tx:
- $(PYTHON) preprocessor.py < $< > $@
+ $(eval TEXTQUEUE := $(TEXTQUEUE) $<)
+ @rm -f $@
+
+globals.asm: $(ALL_DEPENDENCIES:.asm=.tx) $(OBJS:.o=.tx)
+ @touch $@
+ @$(PYTHON) prequeue.py $(TEXTQUEUE)
+globals.tx: globals.asm
+ @cp $< $@
-$(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES))
- rgbasm -o $@ $(@:.o=.tx)
+$(OBJS): $$*.tx $$($$*_DEPENDENCIES$:.asm=.tx)
+ rgbasm -o $@ $*.tx
-pokered.gbc: $(RED_OBJS)
- rgblink -n $*.sym -m $*.map -o $@ $^
+pokered.gbc: globals.tx $(RED_OBJS)
+ rgblink -n $*.sym -m $*.map -o $@ $(RED_OBJS)
rgbfix -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED" $@
cmp baserom.gbc $@
-pokeblue.gbc: $(BLUE_OBJS)
- rgblink -n $*.sym -m $*.map -o $@ $^
+pokeblue.gbc: globals.tx $(BLUE_OBJS)
+ rgblink -n $*.sym -m $*.map -o $@ $(BLUE_OBJS)
rgbfix -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON BLUE" $@
cmp blue.gbc $@