Use $(if) in the makefile. Fix gfx/mail.

Fixes 384788f370
This commit is contained in:
yenatch 2017-06-20 23:36:28 -04:00
parent a71005fafa
commit 93a3a7d3c5

View File

@ -58,10 +58,6 @@ pokecrystal.gbc: $(crystal_obj)
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 $@
define LOUD
echo "$1"; $1
endef
# For files that the compressor can't match, there will be a .lz file suffixed with the hash of the correct uncompressed file. # For files that the compressor can't match, there will be a .lz file suffixed with the hash of the correct uncompressed file.
# If the hash of the uncompressed file matches, use this .lz instead. # If the hash of the uncompressed file matches, use this .lz instead.
# This allows pngs to be used for compressed graphics and still match. # This allows pngs to be used for compressed graphics and still match.
@ -69,11 +65,7 @@ endef
%.lz: hash = $(shell md5sum $(*D)/$(*F) | sed "s/\(.\{8\}\).*/\1/") %.lz: hash = $(shell md5sum $(*D)/$(*F) | sed "s/\(.\{8\}\).*/\1/")
%.lz: % %.lz: %
$(eval filename := $@.$(hash)) $(eval filename := $@.$(hash))
@if [ -f $(filename) ]; then \ $(if $(wildcard $(filename)),cp $(filename) $@,tools/lzcomp $< $@)
$(call LOUD, cp $(filename) $@); \
else \
$(call LOUD, tools/lzcomp $< $@); \
fi
# Terrible hacks to match animations. Delete these rules if you don't care about matching. # Terrible hacks to match animations. Delete these rules if you don't care about matching.
@ -118,23 +110,27 @@ gfx/pics/%/front.animated.tilemap: gfx/pics/%/front.2bpp gfx/pics/%/front.dimens
# Misc file-specific graphics rules # Misc file-specific graphics rules
gfx/shrink%.2bpp: gfx/shrink%.png gfx/shrink%.2bpp: rgbgfx += -h
rgbgfx -h -o $@ $<
gfx/trainers/%.2bpp: gfx/trainers/%.png gfx/trainers/%.2bpp: rgbgfx += -h
rgbgfx -h -o $@ $<
gfx/mail/%.1bpp: gfx/mail/%.png gfx/mail/0b9b46.1bpp: tools/gfx += --remove-whitespace
rgbgfx -d1 -o $@ $< gfx/mail/0b9d46.1bpp: tools/gfx += --remove-whitespace
tools/gfx -d1 --remove-whitespace -o $@ $@ gfx/mail/0b9d86.1bpp: tools/gfx += --remove-whitespace
gfx/mail/0b9dc6.1bpp: tools/gfx += --remove-whitespace
gfx/mail/0b9cfe.1bpp: tools/gfx += --remove-whitespace
%.bin: ; %.bin: ;
%.blk: ; %.blk: ;
%.2bpp: %.png %.2bpp: %.png
rgbgfx -o $@ $< rgbgfx $(rgbgfx) -o $@ $<
$(if $(tools/gfx),tools/gfx $(tools/gfx) -o $@ $@)
%.1bpp: %.png %.1bpp: %.png
rgbgfx -d1 -o $@ $< rgbgfx $(rgbgfx) -d1 -o $@ $<
$(if $(tools/gfx),tools/gfx $(tools/gfx) -d1 -o $@ $@)
%.tilemap: %.png %.tilemap: %.png
rgbgfx -t $@ $< rgbgfx -t $@ $<
%.gbcpal: %.png %.gbcpal: %.png