pokeemerald/Makefile

68 lines
1.4 KiB
Makefile
Raw Normal View History

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
gfx := tools/gbagfx/gbagfx
2015-11-23 00:29:11 +01:00
1bpp := @$(gfx) 1bpp
4bpp := @$(gfx) 4bpp
8bpp := @$(gfx) 8bpp
gbapal := @$(gfx) gbapal
lz := @$(gfx) lz
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-23 00:29:11 +01:00
%.1bpp: %.png ; $(1bpp) $<
%.4bpp: %.png ; $(4bpp) $<
%.8bpp: %.png ; $(8bpp) $<
%.gbapal: %.pal ; $(gbapal) $<
%.lz: % ; $(lz) $<
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)