gba-x3dtest

view Makefile @ 0:0d2602a1b851

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 12 Jun 2014 05:37:18 +0300
parents
children b7130fe3f073
line source
1 src = $(wildcard src/*.c)
2 obj = $(src:.c=.o)
3 dep = $(obj:.o=.d)
4 name = trycatch
5 elf = $(name).elf
6 bin = $(name).gba
7 elf_mb = $(name)_mb.elf
8 bin_mb = $(name)_mb.gba
10 ARCH = arm-none-eabi
12 CPP = $(ARCH)-cpp
13 CC = $(ARCH)-gcc
14 AS = $(ARCH)-as
15 OBJCOPY = $(ARCH)-objcopy
17 opt = -O3 -fomit-frame-pointer -marm -mcpu=arm7tdmi -mtune=arm7tdmi
19 CFLAGS = $(opt) -pedantic -Wall -I../gbasys/src -I.
20 LDFLAGS = ../gbasys/libgbasys.a -lm
22 .PHONY: all
23 all: $(bin) $(bin_mb)
26 $(bin): $(elf)
27 $(OBJCOPY) -O binary $(elf) $(bin)
28 gbafix $(bin)
30 $(bin_mb): $(elf_mb)
31 $(OBJCOPY) -O binary $(elf_mb) $(bin_mb)
32 gbafix $(bin_mb)
34 $(elf): $(obj) ../gbasys/libgbasys.a
35 $(CC) -o $(elf) $(obj) -specs=gba.specs $(LDFLAGS)
37 $(elf_mb): $(obj) ../gbasys/libgbasys.a
38 $(CC) -o $(elf_mb) $(obj) -specs=gba_mb.specs $(LDFLAGS)
40 -include $(dep)
42 %.d: %.c
43 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
45 .PHONY: clean
46 clean:
47 rm -f $(obj) $(dep) $(bin) $(bin_mb) $(elf) $(elf_mb)
49 .PHONY: install
50 install: $(bin)
51 if2a -n -f -W $<
53 .PHONY: run
54 run: $(bin_mb)
55 if2a -m $<
57 .PHONY: simrun
58 simrun: $(bin)
59 VisualBoyAdvance -T 100 -2 $(bin)