gba-x3dtest

annotate Makefile @ 15:b755fb002f17

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 25 Jun 2014 17:02:48 +0300
parents 850be43b3135
children 02cf4011f566
rev   line source
nuclear@5 1 src = $(filter-out src/main_sdl.c,$(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@1 16 EMU = vbam
nuclear@0 17
nuclear@15 18 opt = -O3 -fomit-frame-pointer -mcpu=arm7tdmi -mtune=arm7tdmi
nuclear@15 19 #dbg = -g
nuclear@0 20
nuclear@5 21 CFLAGS = $(opt) $(dbg) -pedantic -Wall -I../gbasys/src
nuclear@0 22 LDFLAGS = ../gbasys/libgbasys.a -lm
nuclear@1 23 EMUFLAGS = -T 100 -f 1
nuclear@0 24
nuclear@0 25 .PHONY: all
nuclear@0 26 all: $(bin) $(bin_mb)
nuclear@0 27
nuclear@0 28
nuclear@0 29 $(bin): $(elf)
nuclear@0 30 $(OBJCOPY) -O binary $(elf) $(bin)
nuclear@0 31 gbafix $(bin)
nuclear@0 32
nuclear@0 33 $(bin_mb): $(elf_mb)
nuclear@0 34 $(OBJCOPY) -O binary $(elf_mb) $(bin_mb)
nuclear@0 35 gbafix $(bin_mb)
nuclear@0 36
nuclear@0 37 $(elf): $(obj) ../gbasys/libgbasys.a
nuclear@0 38 $(CC) -o $(elf) $(obj) -specs=gba.specs $(LDFLAGS)
nuclear@0 39
nuclear@0 40 $(elf_mb): $(obj) ../gbasys/libgbasys.a
nuclear@0 41 $(CC) -o $(elf_mb) $(obj) -specs=gba_mb.specs $(LDFLAGS)
nuclear@0 42
nuclear@0 43 -include $(dep)
nuclear@0 44
nuclear@0 45 %.d: %.c
nuclear@0 46 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 47
nuclear@0 48 .PHONY: clean
nuclear@0 49 clean:
nuclear@0 50 rm -f $(obj) $(dep) $(bin) $(bin_mb) $(elf) $(elf_mb)
nuclear@0 51
nuclear@0 52 .PHONY: install
nuclear@0 53 install: $(bin)
nuclear@0 54 if2a -n -f -W $<
nuclear@0 55
nuclear@0 56 .PHONY: run
nuclear@0 57 run: $(bin_mb)
nuclear@0 58 if2a -m $<
nuclear@0 59
nuclear@0 60 .PHONY: simrun
nuclear@0 61 simrun: $(bin)
nuclear@1 62 $(EMU) $(EMUFLAGS) $(bin)