ref: c5813528f8d21f7903d184336345ed5a7309e370
parent: 05c58eaa706a76e568faf7801a6156e4e7afbdf6
author: yenatch <yenatch@gmail.com>
date: Sat Apr 5 13:01:56 EDT 2014
Image handling in the makefile.
--- 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 @@
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 @@
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 @@
@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
@@ -64,4 +79,16 @@
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 $@
+