2015-10-25 07:04:52 +00:00
|
|
|
# python 2.7
|
2013-12-06 06:12:02 +00:00
|
|
|
PYTHON := python
|
2014-07-11 18:02:04 +00:00
|
|
|
|
|
|
|
# md5sum -c is used to compare rom hashes. The options may vary across platforms.
|
2014-07-11 18:50:02 +00:00
|
|
|
MD5 := md5sum -c --quiet
|
2014-07-16 22:28:46 +00:00
|
|
|
|
|
|
|
|
2014-07-11 18:02:04 +00:00
|
|
|
# Clear the default suffixes.
|
2014-04-05 21:01:56 +00:00
|
|
|
.SUFFIXES:
|
2014-11-05 01:25:33 +00:00
|
|
|
.SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .pic
|
2014-07-11 18:02:04 +00:00
|
|
|
|
|
|
|
# Secondary expansion is required for dependency variables in object rules.
|
2013-12-06 06:12:02 +00:00
|
|
|
.SECONDEXPANSION:
|
2010-01-05 00:58:43 +00:00
|
|
|
|
2014-07-11 18:02:04 +00:00
|
|
|
# Suppress annoying intermediate file deletion messages.
|
|
|
|
.PRECIOUS: %.2bpp
|
|
|
|
|
2015-10-25 07:04:52 +00:00
|
|
|
.PHONY: all clean red blue compare
|
|
|
|
|
|
|
|
|
2014-05-30 01:52:37 +00:00
|
|
|
poketools := extras/pokemontools
|
|
|
|
gfx := $(PYTHON) $(poketools)/gfx.py
|
2015-10-25 07:04:52 +00:00
|
|
|
2bpp := $(gfx) 2bpp
|
|
|
|
1bpp := $(gfx) 1bpp
|
|
|
|
pic := $(PYTHON) $(poketools)/pic.py compress
|
2014-05-30 01:52:37 +00:00
|
|
|
includes := $(PYTHON) $(poketools)/scan_includes.py
|
2011-12-17 06:54:36 +00:00
|
|
|
|
2015-10-25 07:04:52 +00:00
|
|
|
versions := red blue
|
2013-12-07 03:40:46 +00:00
|
|
|
|
2015-10-25 07:04:52 +00:00
|
|
|
# Collect file dependencies for objects in red/ and blue/.
|
2014-05-30 01:52:37 +00:00
|
|
|
$(foreach ver, $(versions), \
|
|
|
|
$(eval $(ver)_asm := $(shell find $(ver) -iname '*.asm')) \
|
|
|
|
$(eval $(ver)_obj := $($(ver)_asm:.asm=.o)) \
|
|
|
|
$(eval all_obj += $($(ver)_obj)) \
|
|
|
|
)
|
|
|
|
$(foreach obj, $(all_obj), \
|
|
|
|
$(eval $(obj:.o=)_dep := $(shell $(includes) $(obj:.o=.asm))) \
|
|
|
|
)
|
2010-03-19 06:18:39 +00:00
|
|
|
|
2013-12-06 06:12:02 +00:00
|
|
|
|
2015-10-25 07:04:52 +00:00
|
|
|
roms := pokered.gbc pokeblue.gbc
|
2014-07-11 18:02:04 +00:00
|
|
|
|
2015-10-25 07:04:52 +00:00
|
|
|
all: $(roms)
|
|
|
|
red: pokered.gbc
|
|
|
|
blue: pokeblue.gbc
|
|
|
|
|
|
|
|
# For contributors to make sure a change didn't affect the contents of the rom.
|
|
|
|
compare: red blue
|
|
|
|
@$(MD5) roms.md5
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(roms) $(all_obj) $(roms:.gbc=.sym)
|
|
|
|
find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} +
|
|
|
|
|
|
|
|
|
|
|
|
# Don't fix halts.
|
|
|
|
asm_opt = -h
|
2011-12-30 00:09:44 +00:00
|
|
|
|
2015-01-19 00:39:16 +00:00
|
|
|
# Make a symfile for debugging.
|
2015-10-25 06:44:58 +00:00
|
|
|
link_opt = -n poke$*.sym
|
2014-05-30 01:52:37 +00:00
|
|
|
|
2015-10-25 07:04:52 +00:00
|
|
|
# Header options for rgbfix.
|
2015-10-25 07:06:22 +00:00
|
|
|
dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03
|
|
|
|
red_opt = $(dmg_opt) -t "POKEMON RED"
|
|
|
|
blue_opt = $(dmg_opt) -t "POKEMON BLUE"
|
2015-10-25 07:04:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
%.png: ;
|
|
|
|
%.2bpp: %.png ; @$(2bpp) $<
|
|
|
|
%.1bpp: %.png ; @$(1bpp) $<
|
|
|
|
%.pic: %.2bpp ; @$(pic) $<
|
|
|
|
|
|
|
|
# Assemble source files into objects.
|
|
|
|
$(all_obj): $$*.asm $$($$*_dep)
|
|
|
|
rgbasm $(asm_opt) -o $@ $*.asm
|
|
|
|
|
|
|
|
# Link objects to produce a rom.
|
2014-07-14 03:42:46 +00:00
|
|
|
poke%.gbc: $$(%_obj)
|
2015-10-25 06:44:58 +00:00
|
|
|
rgblink $(link_opt) -o $@ $^
|
2014-07-14 03:42:46 +00:00
|
|
|
rgbfix $($*_opt) $@
|