2018-12-31 23:12:25 +00:00
|
|
|
roms := pokered.gbc pokeblue.gbc
|
2016-02-17 20:33:01 +00:00
|
|
|
|
2020-06-27 19:32:24 +00:00
|
|
|
rom_obj := \
|
|
|
|
audio.o \
|
|
|
|
home.o \
|
|
|
|
main.o \
|
|
|
|
maps.o \
|
|
|
|
pics.o \
|
|
|
|
sprites.o \
|
|
|
|
text.o \
|
|
|
|
tilesets.o \
|
|
|
|
wram.o \
|
|
|
|
|
|
|
|
pokered_obj := $(rom_obj:.o=_red.o)
|
|
|
|
pokeblue_obj := $(rom_obj:.o=_blue.o)
|
2014-07-16 22:28:46 +00:00
|
|
|
|
2018-12-31 23:12:25 +00:00
|
|
|
|
|
|
|
### Build tools
|
|
|
|
|
|
|
|
MD5 := md5sum -c
|
|
|
|
|
|
|
|
RGBDS ?=
|
|
|
|
RGBASM ?= $(RGBDS)rgbasm
|
|
|
|
RGBFIX ?= $(RGBDS)rgbfix
|
|
|
|
RGBGFX ?= $(RGBDS)rgbgfx
|
|
|
|
RGBLINK ?= $(RGBDS)rgblink
|
|
|
|
|
|
|
|
|
|
|
|
### Build targets
|
|
|
|
|
2014-04-05 21:01:56 +00:00
|
|
|
.SUFFIXES:
|
2013-12-06 06:12:02 +00:00
|
|
|
.SECONDEXPANSION:
|
2018-03-10 23:01:54 +00:00
|
|
|
.PRECIOUS:
|
|
|
|
.SECONDARY:
|
2018-12-31 23:12:25 +00:00
|
|
|
.PHONY: all red blue clean tidy compare tools
|
2014-07-11 18:02:04 +00:00
|
|
|
|
2016-02-17 20:33:01 +00:00
|
|
|
all: $(roms)
|
|
|
|
red: pokered.gbc
|
|
|
|
blue: pokeblue.gbc
|
2015-10-25 07:04:52 +00:00
|
|
|
|
|
|
|
# For contributors to make sure a change didn't affect the contents of the rom.
|
2018-12-31 23:12:25 +00:00
|
|
|
compare: $(roms)
|
2015-10-25 07:04:52 +00:00
|
|
|
@$(MD5) roms.md5
|
|
|
|
|
|
|
|
clean:
|
2016-07-01 21:06:55 +00:00
|
|
|
rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.sym)
|
2015-10-25 07:04:52 +00:00
|
|
|
find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} +
|
2018-03-11 00:18:35 +00:00
|
|
|
$(MAKE) clean -C tools/
|
2018-03-10 23:01:54 +00:00
|
|
|
|
2018-12-31 22:39:49 +00:00
|
|
|
tidy:
|
|
|
|
rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.sym)
|
|
|
|
$(MAKE) clean -C tools/
|
|
|
|
|
2018-03-10 23:01:54 +00:00
|
|
|
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
|
|
|
|
|
2015-10-25 07:04:52 +00:00
|
|
|
|
2016-02-17 20:33:01 +00:00
|
|
|
%.asm: ;
|
2015-10-25 07:04:52 +00:00
|
|
|
|
2018-03-10 23:01:54 +00:00
|
|
|
%_red.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
|
2016-07-01 21:06:55 +00:00
|
|
|
$(pokered_obj): %_red.o: %.asm $$(dep)
|
2018-12-31 23:12:25 +00:00
|
|
|
$(RGBASM) -D _RED -h -o $@ $*.asm
|
2016-07-01 21:06:55 +00:00
|
|
|
|
2018-03-10 23:01:54 +00:00
|
|
|
%_blue.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
|
2016-07-01 21:06:55 +00:00
|
|
|
$(pokeblue_obj): %_blue.o: %.asm $$(dep)
|
2018-12-31 23:12:25 +00:00
|
|
|
$(RGBASM) -D _BLUE -h -o $@ $*.asm
|
2016-07-01 21:06:55 +00:00
|
|
|
|
|
|
|
pokered_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED"
|
|
|
|
pokeblue_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON BLUE"
|
2015-10-25 07:04:52 +00:00
|
|
|
|
2016-07-01 21:06:55 +00:00
|
|
|
%.gbc: $$(%_obj)
|
2020-06-27 19:32:24 +00:00
|
|
|
$(RGBLINK) -d -n $*.sym -l layout.link -o $@ $^
|
2018-12-31 23:12:25 +00:00
|
|
|
$(RGBFIX) $($*_opt) $@
|
2017-09-30 02:22:56 +00:00
|
|
|
sort $*.sym -o $*.sym
|
2015-10-25 07:04:52 +00:00
|
|
|
|
2018-12-31 23:12:25 +00:00
|
|
|
|
|
|
|
### Misc file-specific graphics rules
|
|
|
|
|
|
|
|
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
|
2018-03-10 23:01:54 +00:00
|
|
|
|
|
|
|
gfx/game_boy.2bpp: tools/gfx += --remove-duplicates
|
|
|
|
gfx/theend.2bpp: tools/gfx += --interleave --png=$<
|
|
|
|
gfx/tilesets/%.2bpp: tools/gfx += --trim-whitespace
|
|
|
|
|
2018-12-31 23:12:25 +00:00
|
|
|
|
|
|
|
### Catch-all graphics rules
|
|
|
|
|
2018-03-10 23:01:54 +00:00
|
|
|
%.png: ;
|
|
|
|
|
|
|
|
%.2bpp: %.png
|
2018-12-31 23:12:25 +00:00
|
|
|
$(RGBGFX) $(rgbgfx) -o $@ $<
|
2018-03-10 23:01:54 +00:00
|
|
|
$(if $(tools/gfx),\
|
|
|
|
tools/gfx $(tools/gfx) -o $@ $@)
|
2018-12-31 23:12:25 +00:00
|
|
|
|
2018-03-10 23:01:54 +00:00
|
|
|
%.1bpp: %.png
|
2018-12-31 23:12:25 +00:00
|
|
|
$(RGBGFX) -d1 $(rgbgfx) -o $@ $<
|
2018-03-10 23:01:54 +00:00
|
|
|
$(if $(tools/gfx),\
|
|
|
|
tools/gfx $(tools/gfx) -d1 -o $@ $@)
|
2018-12-31 23:12:25 +00:00
|
|
|
|
2018-03-10 23:01:54 +00:00
|
|
|
%.pic: %.2bpp
|
|
|
|
tools/pkmncompress $< $@
|