Simple graphics handling in the makefile.

Two-way conversion invokes circular dependency warnings, and is outside the scope of the build.
Now it's one-way.
This commit is contained in:
yenatch 2014-03-31 21:06:34 -04:00
parent 8f67227209
commit 6122490cc3

View File

@ -1,9 +1,15 @@
PYTHON := python PYTHON := python
POKEMONTOOLS := extras/pokemontools
.SUFFIXES: .asm .tx .o .gbc .png .2bpp .1bpp .lz .pal .bin .SUFFIXES:
.SUFFIXES: .asm .tx .o .gbc .png .2bpp .1bpp .lz .pal .bin .blk .tilemap
.PHONY: all clean crystal pngs .PHONY: all clean crystal pngs
.SECONDEXPANSION: .SECONDEXPANSION:
POKEMONTOOLS := extras/pokemontools
GFX := $(PYTHON) $(POKEMONTOOLS)/gfx.py
INCLUDES := $(PYTHON) $(POKEMONTOOLS)/scan_includes.py
PREPROCESS := $(PYTHON) prequeue.py
TEXTQUEUE := TEXTQUEUE :=
CRYSTAL_OBJS := \ CRYSTAL_OBJS := \
@ -26,12 +32,8 @@ OBJS := $(CRYSTAL_OBJS)
ROMS := pokecrystal.gbc ROMS := pokecrystal.gbc
# object dependencies
# generate a list of dependencies for each object file $(shell $(foreach obj, $(OBJS), $(eval $(obj:.o=)_DEPENDENCIES := $(shell $(INCLUDES) $(obj:.o=.asm)))))
$(shell $(foreach obj, $(OBJS), \
$(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) $(POKEMONTOOLS)/scan_includes.py $(obj:.o=.asm))) \
))
all: $(ROMS) all: $(ROMS)
@ -52,7 +54,7 @@ baserom.gbc: ;
@rm -f $@ @rm -f $@
$(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES)) $(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES))
@$(PYTHON) prequeue.py $(TEXTQUEUE) @$(PREPROCESS) $(TEXTQUEUE)
$(eval TEXTQUEUE :=) $(eval TEXTQUEUE :=)
rgbasm -o $@ $*.tx rgbasm -o $@ $*.tx
@ -63,49 +65,17 @@ pokecrystal.gbc: $(CRYSTAL_OBJS)
pngs: pngs:
$(PYTHON) $(POKEMONTOOLS)/gfx.py mass-decompress find . -iname "*.lz" -exec $(GFX) unlz {} +
$(PYTHON) $(POKEMONTOOLS)/gfx.py dump-pngs find . -iname "*.[12]bpp" -exec $(GFX) png {} +
find . -iname "*.[12]bpp" -exec touch {} +
find . -iname "*.lz" -exec touch {} +
gfx/pics/%/front.lz:: gfx/pics/%/tiles.2bpp gfx/pics/%/front.png %.2bpp: %.png ; $(GFX) 2bpp $<
$(PYTHON) $(POKEMONTOOLS)/gfx.py png-to-lz --front $^ %.1bpp: %.png ; $(GFX) 1bpp $<
gfx/pics/%/front.2bpp:: gfx/pics/%/front.lz %.lz: % ; $(GFX) lz $<
$(PYTHON) $(POKEMONTOOLS)/gfx.py front-to-2bpp $<
gfx/pics/%/front.png:: gfx/pics/%/front.2bpp
$(PYTHON) $(POKEMONTOOLS)/gfx.py 2bpp-to-png $<
gfx/pics/%/tiles.2bpp:: gfx/pics/%/front.lz
$(PYTHON) $(POKEMONTOOLS)/gfx.py anim-from-front $<
gfx/pics/%/tiles.2bpp:: gfx/pics/%/tiles.png
$(PYTHON) $(POKEMONTOOLS)/gfx.py png-to-2bpp $<
gfx/pics/%/tiles.png:: gfx/pics/%/tiles.2bpp
$(PYTHON) $(POKEMONTOOLS)/gfx.py 2bpp-to-png $<
gfx/pics/%/back.lz:: gfx/pics/%/back.png
$(PYTHON) $(POKEMONTOOLS)/gfx.py png-to-lz --vert $<
gfx/pics/%/back.png:: gfx/pics/%/back.lz
$(PYTHON) $(POKEMONTOOLS)/gfx.py lz-to-png --vert $<
gfx/trainers/%.lz:: gfx/trainers/%.png
$(PYTHON) $(POKEMONTOOLS)/gfx.py png-to-lz --vert $<
gfx/trainers/%.png:: gfx/trainers/%.lz
$(PYTHON) $(POKEMONTOOLS)/gfx.py lz-to-png --vert $<
%.lz:: %.png
$(PYTHON) $(POKEMONTOOLS)/gfx.py png-to-lz $<
%.png:: %.lz
$(PYTHON) $(POKEMONTOOLS)/gfx.py lz-to-png $<
%.2bpp:: %.png
$(PYTHON) $(POKEMONTOOLS)/gfx.py png-to-2bpp $<
%.png:: %.2bpp
$(PYTHON) $(POKEMONTOOLS)/gfx.py 2bpp-to-png $<
%.1bpp:: %.png
$(PYTHON) $(POKEMONTOOLS)/gfx.py png-to-1bpp $<
%.png:: %.1bpp
$(PYTHON) $(POKEMONTOOLS)/gfx.py 1bpp-to-png $<
%.pal: ; %.pal: ;
%.bin: ; %.bin: ;
%.blk: ;
%.tilemap: ;