summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2015-11-13 21:57:22 -0800
committerYamaArashi <shadow962@live.com>2015-11-13 21:57:22 -0800
commit4c733f3811d2b1bd35bf0474a79490706a4cd845 (patch)
tree0eea3502ae34b55611a6920490ed32b479f6b244 /Makefile
parent3d1b6597f3fc22547fe2021275b1818a92093ab8 (diff)
pokemon PNGs and palettes
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile67
1 files changed, 67 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000..0fb91fd7d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,67 @@
+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
+
+.PHONY: rom tools clean compare
+
+gfx := tools/gbagfx/gbagfx
+1bpp := $(gfx) 1bpp
+4bpp := $(gfx) 4bpp
+8bpp := $(gfx) 8bpp
+gbapal := $(gfx) gbapal
+lz := $(gfx) lz
+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)
+
+tools: $(gfx) $(scaninc)
+
+# 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: ;
+%.1bpp: %.png ; @$(1bpp) $<
+%.4bpp: %.png ; @$(4bpp) $<
+%.8bpp: %.png ; @$(8bpp) $<
+%.gbapal: %.pal ; @$(gbapal) $<
+%.lz: % ; @$(lz) $<
+
+%.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)
+
+$(gfx):
+ cd tools/gbagfx && make clean && make
+
+$(scaninc):
+ cd tools/scaninc && make clean && make