gba-trycatch

annotate Makefile @ 0:0d2602a1b851

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