Makefile: Use lower-case variables and graphics conversion queues.

This is mostly to make it more like pokered.

Queues are an order of magnitude faster than invoking a new python instance for each file.
This commit is contained in:
yenatch 2014-06-15 16:20:40 -07:00
parent db27602679
commit f244e4483e

View File

@ -5,14 +5,13 @@ PYTHON := python
.PHONY: all clean crystal pngs .PHONY: all clean crystal pngs
.SECONDEXPANSION: .SECONDEXPANSION:
POKEMONTOOLS := extras/pokemontools poketools := extras/pokemontools
GFX := $(PYTHON) $(POKEMONTOOLS)/gfx.py gfx := $(PYTHON) $(poketools)/gfx.py
INCLUDES := $(PYTHON) $(POKEMONTOOLS)/scan_includes.py includes := $(PYTHON) $(poketools)/scan_includes.py
PREPROCESS := $(PYTHON) prequeue.py pre := $(PYTHON) prequeue.py
TEXTQUEUE :=
CRYSTAL_OBJS := \ crystal_obj := \
wram.o \ wram.o \
main.o \ main.o \
lib/mobile/main.o \ lib/mobile/main.o \
@ -29,20 +28,21 @@ data/pokedex/entries_crystal.o \
misc/crystal_misc.o \ misc/crystal_misc.o \
gfx/pics.o gfx/pics.o
OBJS := $(CRYSTAL_OBJS) all_obj := $(crystal_obj)
ROMS := pokecrystal.gbc
# object dependencies # object dependencies
$(shell $(foreach obj, $(OBJS), $(eval $(obj:.o=)_DEPENDENCIES := $(shell $(INCLUDES) $(obj:.o=.asm))))) $(foreach obj, $(all_obj), \
$(eval $(obj:.o=)_dep := $(shell $(includes) $(obj:.o=.asm))) \
)
all: $(ROMS)
roms := pokecrystal.gbc
all: $(roms)
crystal: pokecrystal.gbc crystal: pokecrystal.gbc
clean: clean:
rm -f $(ROMS) rm -f $(roms) $(all_obj)
rm -f $(OBJS)
find -iname '*.tx' -exec rm {} + find -iname '*.tx' -exec rm {} +
baserom.gbc: ; baserom.gbc: ;
@ -50,30 +50,31 @@ baserom.gbc: ;
%.asm: ; %.asm: ;
.asm.tx: %.tx: %.asm ; $(eval txq += $<) @rm -f $@
$(eval TEXTQUEUE += $<)
@rm -f $@
$(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES)) $(all_obj): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_dep))
@$(PREPROCESS) $(TEXTQUEUE) @$(pre) $(txq); $(eval txq :=)
$(eval TEXTQUEUE :=) @$(gfx) 2bpp $(2bppq); $(eval 2bppq :=)
@$(gfx) 1bpp $(1bppq); $(eval 1bppq :=)
@$(gfx) lz $(lzq); $(eval lzq :=)
rgbasm -o $@ $*.tx rgbasm -o $@ $*.tx
pokecrystal.gbc: $(CRYSTAL_OBJS) pokecrystal.gbc: $(crystal_obj)
rgblink -n $*.sym -m $*.map -o $@ $^ rgblink -n $*.sym -m $*.map -o $@ $^
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@ rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
cmp baserom.gbc $@ cmp baserom.gbc $@
pngs: pngs:
find . -iname "*.lz" -exec $(GFX) unlz {} + find . -iname "*.lz" -exec $(gfx) unlz {} +
find . -iname "*.[12]bpp" -exec $(GFX) png {} + find . -iname "*.[12]bpp" -exec $(gfx) png {} +
find . -iname "*.[12]bpp" -exec touch {} +
find . -iname "*.lz" -exec touch {} + find . -iname "*.lz" -exec touch {} +
find . -iname "*.[12]bpp" -exec touch {} +
%.2bpp: %.png ; $(eval 2bppq += $<) @rm -f $@
%.1bpp: %.png ; $(eval 1bppq += $<) @rm -f $@
%.lz: % ; $(eval lzq += $<) @rm -f $@
%.2bpp: %.png ; $(GFX) 2bpp $<
%.1bpp: %.png ; $(GFX) 1bpp $<
%.lz: % ; $(GFX) lz $<
%.pal: ; %.pal: ;
%.bin: ; %.bin: ;