summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile114
1 files changed, 114 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 759990fa..63c1364b 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,11 @@ silver: pokesilver.gbc
clean:
rm -f $(roms) $(gold_obj) $(silver_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
+ find gfx \( -name "*.[12]bpp" -o -name "*.lz" \) -delete
+ $(MAKE) clean -C tools/
+
+tidy:
+ rm -f $(roms) $(gold_obj) $(silver_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
$(MAKE) clean -C tools/
compare: $(roms)
@@ -111,6 +116,115 @@ pokesilver.gbc: $(silver_obj) layout.link
$(RGBLINK) -n pokesilver.sym -m pokesilver.map -l layout.link -o $@ $(silver_obj)
$(RGBFIX) -cjsv -i AAXE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t "POKEMON_SLV" $@
+
+### LZ compression rules
+
+# Delete this line if you don't care about matching and just want optimal compression.
+include gfx/lz.mk
+
+%.lz: %
+ tools/lzcomp $(LZFLAGS) -- $< $@
+
+
+### Misc file-specific graphics rules
+
+gfx/pokemon/%/front.2bpp: rgbgfx += -h
+gfx/pokemon/%/front_gold.2bpp: rgbgfx += -h
+gfx/pokemon/%/front_silver.2bpp: rgbgfx += -h
+
+gfx/pokemon/%/back.2bpp: rgbgfx += -h
+gfx/pokemon/%/back_gold.2bpp: rgbgfx += -h
+gfx/pokemon/%/back_silver.2bpp: rgbgfx += -h
+
+gfx/trainers/%.2bpp: rgbgfx += -h
+
+gfx/new_game/shrink1.2bpp: rgbgfx += -h
+gfx/new_game/shrink2.2bpp: rgbgfx += -h
+
+gfx/mail/dragonite.1bpp: tools/gfx += --remove-whitespace
+gfx/mail/large_note.1bpp: tools/gfx += --remove-whitespace
+gfx/mail/surf_mail_border.1bpp: tools/gfx += --remove-whitespace
+gfx/mail/flower_mail_border.1bpp: tools/gfx += --remove-whitespace
+gfx/mail/litebluemail_border.1bpp: tools/gfx += --remove-whitespace
+
+gfx/pokedex/pokedex.2bpp: tools/gfx += --trim-whitespace
+gfx/pokedex/pokedex_sgb.2bpp: tools/gfx += --trim-whitespace
+gfx/pokedex/question_mark.2bpp: rgbgfx += -h
+gfx/pokedex/slowpoke.2bpp: tools/gfx += --trim-whitespace
+
+gfx/pokegear/pokegear.2bpp: rgbgfx += -x2
+gfx/pokegear/pokegear_sprites.2bpp: tools/gfx += --trim-whitespace
+
+gfx/mystery_gift/mystery_gift.2bpp: tools/gfx += --remove-whitespace
+gfx/mystery_gift/mystery_gift_2.2bpp: tools/gfx += --trim-whitespace
+gfx/mystery_gift/question_mark.1bpp: tools/gfx += --remove-whitespace
+
+gfx/trade/ball.2bpp: tools/gfx += --remove-whitespace
+
+gfx/slots/slots_1.2bpp: tools/gfx += --trim-whitespace
+gfx/slots/slots_2.2bpp: tools/gfx += --interleave --png=$<
+gfx/slots/slots_3.2bpp: tools/gfx += --interleave --png=$< --remove-duplicates --keep-whitespace --remove-xflip
+
+gfx/card_flip/card_flip_1.2bpp: tools/gfx += --trim-whitespace
+gfx/card_flip/card_flip_2.2bpp: tools/gfx += --remove-whitespace
+
+gfx/battle_anims/angels.2bpp: tools/gfx += --trim-whitespace
+gfx/battle_anims/beam.2bpp: tools/gfx += --remove-xflip --remove-yflip --remove-whitespace
+gfx/battle_anims/bubble.2bpp: tools/gfx += --trim-whitespace
+gfx/battle_anims/charge.2bpp: tools/gfx += --trim-whitespace
+gfx/battle_anims/egg.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/explosion.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/hit.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/horn.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/lightning.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/misc.2bpp: tools/gfx += --remove-duplicates --remove-xflip
+gfx/battle_anims/noise.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/objects.2bpp: tools/gfx += --remove-whitespace --remove-xflip
+gfx/battle_anims/pokeball.2bpp: tools/gfx += --remove-xflip --keep-whitespace
+gfx/battle_anims/reflect.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/rocks.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/skyattack.2bpp: tools/gfx += --remove-whitespace
+gfx/battle_anims/status.2bpp: tools/gfx += --remove-whitespace
+
+gfx/player/chris.2bpp: rgbgfx += -h
+gfx/player/chris_back.2bpp: rgbgfx += -h
+
+gfx/trainer_card/leaders.2bpp: tools/gfx += --trim-whitespace
+
+gfx/overworld/chris_fish.2bpp: tools/gfx += --trim-whitespace
+
+gfx/sprites/big_onix.2bpp: tools/gfx += --remove-whitespace --remove-xflip
+
+gfx/battle/dude.2bpp: rgbgfx += -h
+
+gfx/font/unused_bold_font.1bpp: tools/gfx += --trim-whitespace
+
+gfx/sgb/gold_border.2bpp: tools/gfx += --trim-whitespace
+gfx/sgb/silver_border.2bpp: tools/gfx += --trim-whitespace
+
+
+### Catch-all graphics rules
+
+gfx/pokemon/%/back_gold.2bpp: gfx/pokemon/%/back.png
+ $(RGBGFX) $(rgbgfx) -o $@ $<
+ $(if $(tools/gfx),\
+ tools/gfx $(tools/gfx) -o $@ $@)
+
+gfx/pokemon/%/back_silver.2bpp: gfx/pokemon/%/back.png
+ $(RGBGFX) $(rgbgfx) -o $@ $<
+ $(if $(tools/gfx),\
+ tools/gfx $(tools/gfx) -o $@ $@)
+
+%.2bpp: %.png
+ $(RGBGFX) $(rgbgfx) -o $@ $<
+ $(if $(tools/gfx),\
+ tools/gfx $(tools/gfx) -o $@ $@)
+
+%.1bpp: %.png
+ $(RGBGFX) $(rgbgfx) -d1 -o $@ $<
+ $(if $(tools/gfx),\
+ tools/gfx $(tools/gfx) -d1 -o $@ $@)
+
pngs:
find gfx -iname "*.lz" -exec $(gfx) unlz {} +
find gfx -iname "*.[12]bpp" -exec $(gfx) png {} +