summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2014-04-05 17:01:56 -0400
committeryenatch <yenatch@gmail.com>2014-04-05 17:01:56 -0400
commitc5813528f8d21f7903d184336345ed5a7309e370 (patch)
tree2b7f53cd0030dc2c193a39e5e21eb1cb440b53e6
parent05c58eaa706a76e568faf7801a6156e4e7afbdf6 (diff)
Image handling in the makefile.
-rw-r--r--Makefile41
1 files changed, 34 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 6aa1050e..7a7ffcdd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,16 @@
PYTHON := python
+
+.SUFFIXES:
.SUFFIXES: .asm .tx .o .gbc
-.PHONY: all clean red blue compare
+.PHONY: all clean red blue compare pngs
+.PRECIOUS: %.2bpp
.SECONDEXPANSION:
+POKEMONTOOLS := extras/pokemontools
+GFX := $(PYTHON) $(POKEMONTOOLS)/gfx.py
+PIC := $(PYTHON) $(POKEMONTOOLS)/pic.py
+INCLUDES := $(PYTHON) $(POKEMONTOOLS)/scan_includes.py
+PREPROCESS := $(PYTHON) prequeue.py
TEXTQUEUE :=
@@ -23,10 +31,8 @@ OBJS := $(sort $(OBJS))
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))) \
-))
+# object dependencies
+$(shell $(foreach obj, $(OBJS), $(eval $(obj:.o=)_DEPENDENCIES := $(shell $(INCLUDES) $(obj:.o=.asm)))))
all: $(ROMS)
red: pokered.gbc
@@ -36,7 +42,10 @@ compare:
clean:
rm -f $(ROMS)
rm -f $(OBJS)
- find . -iname '*.tx' -exec rm {} +
+ find . -iname '*.tx' -exec rm {} +
+ find gfx -iname '*.[12]bpp' -exec rm {} +
+ find pic -iname '*.pic' -exec rm {} +
+ find pic -iname '*.2bpp' -exec rm {} +
rm -f redrle
@@ -50,8 +59,14 @@ redrle: extras/redtools/redrle.c
@rm -f $@
$(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES))
- @$(PYTHON) prequeue.py $(TEXTQUEUE)
+ @$(PREPROCESS) $(TEXTQUEUE)
@$(eval TEXTQUEUE :=)
+ @$(GFX) 2bpp $(2BPPQUEUE)
+ @$(eval 2BPPQUEUE :=)
+ @$(GFX) 1bpp $(1BPPQUEUE)
+ @$(eval 1BPPQUEUE :=)
+ @$(PIC) compress $(PICQUEUE)
+ @$(eval PICQUEUE :=)
rgbasm -o $@ $*.tx
@@ -65,3 +80,15 @@ pokeblue.gbc: $(BLUE_OBJS)
rgblink -n $*.sym -m $*.map -o $@ $^
rgbfix $(OPTIONS) -t "POKEMON BLUE" $@
+
+%.2bpp: %.png
+ $(eval 2BPPQUEUE += $<)
+ @rm -f $@
+%.1bpp: %.png
+ $(eval 1BPPQUEUE += $<)
+ @rm -f $@
+%.pic: %.2bpp
+ $(eval PICQUEUE += $<)
+ @rm -f $@
+
+