1 src = $(wildcard src/*.c) $(wildcard src/gba/*.c)
2 ssrc = $(wildcard src/*.s) $(wildcard src/gba/*.s) data/lut.s
3 obj = $(src:.c=.arm.o) $(ssrc:.s=.arm.o)
9 data = data/color.raw data/color.pal data/color.gpal data/height.raw \
10 data/spr_game.raw data/spr_game.pal data/spr_game.gpal \
11 data/spr_logo.raw data/spr_logo.pal \
12 data/menuscr.raw data/menuscr.pal data/menuscr.gpal \
13 data/spr_menu.raw data/spr_menu.pal \
14 data/controls.raw data/controls.pal data/controls.gpal
16 libs = libs/maxmod/libmm.a
18 TCPREFIX = arm-none-eabi-
23 OBJCOPY = $(TCPREFIX)objcopy
24 OBJDUMP = $(TCPREFIX)objdump
27 opt = -O3 -fomit-frame-pointer -mcpu=arm7tdmi -mtune=arm7tdmi -mthumb -mthumb-interwork
29 inc = -I. -Isrc -Isrc/gba -Ilibs/maxmod
30 warn = -pedantic -Wall
32 CFLAGS = $(opt) $(dbg) $(warn) -MMD $(def) $(inc)
33 ASFLAGS = -mthumb-interwork
34 LDFLAGS = -mthumb -mthumb-interwork $(libs) -lm
42 $(OBJCOPY) -O binary $(elf) $(bin)
45 $(elf): $(obj) $(libs)
46 $(CC) -o $(elf) $(obj) -specs=gba.specs -Wl,-Map,link.map $(LDFLAGS)
51 $(CC) -o $@ $(CFLAGS) -c $<
54 $(AS) -o $@ $(ASFLAGS) $<
56 src/data.o: src/data.s $(data)
57 src/data.arm.o: src/data.s $(data)
59 tools/pngdump/pngdump:
60 $(MAKE) -C tools/pngdump
62 tools/meshdump/meshdump:
63 $(MAKE) -C tools/meshdump
65 tools/lutgen: tools/lutgen.c
68 tools/vistab: tools/vistab.c
72 $(MAKE) -C tools/mmutil
74 #data/spr_game.raw: data/spr_ui.png data/spr_hud.png
75 # tools/pngdump/pngdump -o $@ -n $^
77 %.sraw: %.png tools/pngdump/pngdump
78 tools/pngdump/pngdump -o $@ -oc $(subst .sraw,.spal,$@) -os $(subst .sraw,.shade,$@) -s 8 $<
80 %.raw: %.png tools/pngdump/pngdump
81 tools/pngdump/pngdump -o $@ -n $<
83 %.pal: %.png tools/pngdump/pngdump
84 tools/pngdump/pngdump -o $@ -c $<
86 %.gpal: %.png tools/pngdump/pngdump
87 tools/pngdump/pngdump -o $@ -c -g $<
89 %.555: %.png tools/pngdump/pngdump
90 tools/pngdump/pngdump -o $@ -555 $<
92 data/lut.s: tools/lutgen
95 data/snd.bin: $(audata) tools/mmutil/mmutil
96 tools/mmutil/mmutil -o$@ -hdata/snd.h $(audata)
98 data/snd.h: data/snd.bin
102 rm -f $(obj) $(bin) $(bin_mb) $(elf) $(elf_mb)
110 $(MAKE) -C libs/maxmod clean
118 mgba -3 --log-level=16 $(bin)
123 $(TCPREFIX)gdb -x gdbmgba $<
133 $(MAKE) -C libs/maxmod
138 $(MAKE) -f Makefile.pc