Use rgbgfx and c tools instead of the submodule.

This commit is contained in:
yenatch 2018-03-10 18:01:54 -05:00
parent 37ded1d150
commit f75049feef
33 changed files with 1006 additions and 40 deletions

View file

@ -1,20 +1,13 @@
PYTHON := python
MD5 := md5sum -c --quiet
2bpp := $(PYTHON) extras/pokemontools/gfx.py 2bpp
1bpp := $(PYTHON) extras/pokemontools/gfx.py 1bpp
pic := $(PYTHON) extras/pokemontools/pic.py compress
includes := $(PYTHON) extras/pokemontools/scan_includes.py
MD5 := md5sum -c
pokered_obj := audio_red.o main_red.o text_red.o wram_red.o
pokeblue_obj := audio_blue.o main_blue.o text_blue.o wram_blue.o
.SUFFIXES:
.SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .pic
.SECONDEXPANSION:
# Suppress annoying intermediate file deletion messages.
.PRECIOUS: %.2bpp
.PHONY: all clean red blue compare
.PRECIOUS:
.SECONDARY:
.PHONY: all clean red blue compare tools
roms := pokered.gbc pokeblue.gbc
@ -29,14 +22,26 @@ compare: red blue
clean:
rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.sym)
find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} +
#$(MAKE) clean -C tools/
tools:
$(MAKE) -C tools/
# Build tools when building the rom.
# This has to happen before the rules are processed, since that's when scan_includes is run.
ifeq (,$(filter clean tools,$(MAKECMDGOALS)))
$(info $(shell $(MAKE) -C tools))
endif
%.asm: ;
%_red.o: dep = $(shell $(includes) $(@D)/$*.asm)
%_red.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
$(pokered_obj): %_red.o: %.asm $$(dep)
rgbasm -D _RED -h -o $@ $*.asm
%_blue.o: dep = $(shell $(includes) $(@D)/$*.asm)
%_blue.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
$(pokeblue_obj): %_blue.o: %.asm $$(dep)
rgbasm -D _BLUE -h -o $@ $*.asm
@ -48,7 +53,26 @@ pokeblue_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON BLUE"
rgbfix $($*_opt) $@
sort $*.sym -o $*.sym
%.png: ;
%.2bpp: %.png ; @$(2bpp) $<
%.1bpp: %.png ; @$(1bpp) $<
%.pic: %.2bpp ; @$(pic) $<
gfx/blue/intro_purin_1.2bpp: rgbgfx += -h
gfx/blue/intro_purin_2.2bpp: rgbgfx += -h
gfx/blue/intro_purin_3.2bpp: rgbgfx += -h
gfx/red/intro_nido_1.2bpp: rgbgfx += -h
gfx/red/intro_nido_2.2bpp: rgbgfx += -h
gfx/red/intro_nido_3.2bpp: rgbgfx += -h
gfx/game_boy.2bpp: tools/gfx += --remove-duplicates
gfx/theend.2bpp: tools/gfx += --interleave --png=$<
gfx/tilesets/%.2bpp: tools/gfx += --trim-whitespace
%.png: ;
%.2bpp: %.png
rgbgfx $(rgbgfx) -o $@ $<
$(if $(tools/gfx),\
tools/gfx $(tools/gfx) -o $@ $@)
%.1bpp: %.png
rgbgfx -d1 $(rgbgfx) -o $@ $<
$(if $(tools/gfx),\
tools/gfx $(tools/gfx) -d1 -o $@ $@)
%.pic: %.2bpp
tools/pkmncompress $< $@