diff --git a/Makefile b/Makefile index 6aa1050e48..7a7ffcdd96 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 $@ + +