.PHONY: all compare clean .SUFFIXES: .SUFFIXES: .asm .o .gbc .png .SECONDEXPANSION: # Build Pokemon Pinball. ROMS := pokepinball.gbc OBJS := main.o wram.o # If your default python is 3, you may want to change this to python27. PYTHON := python PRET := pokemon-reverse-engineering-tools/pokemontools $(foreach obj, $(OBJS), \ $(eval $(obj:.o=)_dep := $(shell $(PYTHON) $(PRET)/scan_includes.py $(obj:.o=.asm))) \ ) # Link objects together to build a rom. all: $(ROMS) compare # Assemble source files into objects. # Use rgbasm -h to use halts without nops. $(OBJS): $$*.asm $$($$*_dep) @$(PYTHON) $(PRET)/gfx.py 2bpp $(2bppq) @$(PYTHON) $(PRET)/gfx.py 1bpp $(1bppq) @$(PYTHON) $(PRET)/pcm.py pcm $(pcmq) rgbasm -h -o $@ $< $(ROMS): $(OBJS) rgblink -n $(ROMS:.gbc=.sym) -m $(ROMS:.gbc=.map) -o $@ $^ rgbfix -jsvc -k 01 -l 0x33 -m 0x1e -p 0 -r 02 -t "POKEPINBALL" -i VPHE $@ # The compare target is a shortcut to check that the build matches the original roms exactly. # This is for contributors to make sure a change didn't affect the contents of the rom. # More thorough comparison can be made by diffing the output of hexdump -C against both roms. compare: $(ROMS) baserom.gbc cmp $^ # Remove files generated by the build process. clean: rm -f $(ROMS) $(OBJS) $(ROMS:.gbc=.sym) find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pcm' \) -exec rm {} + %.2bpp: %.png $(eval 2bppq += $<) @rm -f $@ %.1bpp: %.png $(eval 1bppq += $<) @rm -f $@ %.pcm: %.wav $(eval pcmq += $<) @rm -f $@