2015-11-14 06:57:22 +01:00
|
|
|
AS = ./pokeas
|
|
|
|
ASFLAGS = -mcpu=arm7tdmi
|
|
|
|
|
|
|
|
SHA1 := sha1sum -c
|
|
|
|
|
|
|
|
# Clear the default suffixes.
|
|
|
|
.SUFFIXES:
|
|
|
|
|
|
|
|
# Secondary expansion is required for dependency variables in object rules.
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
|
|
|
.PRECIOUS: %.1bpp %.4bpp %.8bpp %.gbapal %.lz
|
|
|
|
|
2015-11-14 07:20:00 +01:00
|
|
|
.PHONY: rom tools gbagfx scaninc clean compare
|
2015-11-14 06:57:22 +01:00
|
|
|
|
2015-11-24 02:44:06 +01:00
|
|
|
gfx := @tools/gbagfx/gbagfx
|
2015-11-14 06:57:22 +01:00
|
|
|
scaninc := tools/scaninc/scaninc
|
|
|
|
|
|
|
|
objs = asm/emerald.o
|
|
|
|
|
|
|
|
$(foreach obj, $(objs), \
|
|
|
|
$(eval $(obj)_deps := $(shell $(scaninc) $(obj:.o=.s))) \
|
|
|
|
)
|
|
|
|
|
|
|
|
rom := pokeemerald.gba
|
|
|
|
elf := $(rom:.gba=.elf)
|
|
|
|
|
|
|
|
rom: $(rom)
|
|
|
|
|
2015-11-14 07:20:00 +01:00
|
|
|
tools: gbagfx scaninc
|
|
|
|
|
|
|
|
gbagfx:
|
|
|
|
cd tools/gbagfx && make
|
|
|
|
|
|
|
|
scaninc:
|
|
|
|
cd tools/scaninc && make
|
2015-11-14 06:57:22 +01:00
|
|
|
|
|
|
|
# For contributors to make sure a change didn't affect the contents of the ROM.
|
|
|
|
compare: $(rom)
|
|
|
|
@$(SHA1) rom.sha1
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) $(rom) $(elf) $(objs)
|
|
|
|
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' \) -exec rm {} +
|
|
|
|
|
|
|
|
include graphics_file_rules.mk
|
|
|
|
|
|
|
|
%.png: ;
|
|
|
|
%.pal: ;
|
2015-11-24 02:44:06 +01:00
|
|
|
%.1bpp: %.png ; $(gfx) $< $@
|
|
|
|
%.4bpp: %.png ; $(gfx) $< $@
|
|
|
|
%.8bpp: %.png ; $(gfx) $< $@
|
|
|
|
%.gbapal: %.pal ; $(gfx) $< $@
|
|
|
|
%.lz: % ; $(gfx) $< $@
|
2015-11-14 06:57:22 +01:00
|
|
|
|
|
|
|
%.o: %.s $$($$@_deps)
|
|
|
|
$(AS) $(ASFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
# Link objects to produce the ROM.
|
|
|
|
$(rom): $(objs)
|
|
|
|
./pokeld -T ld_script.txt -T wram_syms.txt -o $(elf) $(objs)
|
|
|
|
./pokeobjcopy -O binary $(elf) $(rom)
|