gba-trycatch

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Thu Jun 12 05:37:18 2014 +0300
     1.3 @@ -0,0 +1,59 @@
     1.4 +src = $(wildcard src/*.c)
     1.5 +obj = $(src:.c=.o)
     1.6 +dep = $(obj:.o=.d)
     1.7 +name = trycatch
     1.8 +elf = $(name).elf
     1.9 +bin = $(name).gba
    1.10 +elf_mb = $(name)_mb.elf
    1.11 +bin_mb = $(name)_mb.gba
    1.12 +
    1.13 +ARCH = arm-none-eabi
    1.14 +
    1.15 +CPP = $(ARCH)-cpp
    1.16 +CC = $(ARCH)-gcc
    1.17 +AS = $(ARCH)-as
    1.18 +OBJCOPY = $(ARCH)-objcopy
    1.19 +
    1.20 +opt = -O3 -fomit-frame-pointer -marm -mcpu=arm7tdmi -mtune=arm7tdmi
    1.21 +
    1.22 +CFLAGS = $(opt) -pedantic -Wall -I../gbasys/src -I.
    1.23 +LDFLAGS = ../gbasys/libgbasys.a -lm
    1.24 +
    1.25 +.PHONY: all
    1.26 +all: $(bin) $(bin_mb)
    1.27 +
    1.28 +
    1.29 +$(bin): $(elf)
    1.30 +	$(OBJCOPY) -O binary $(elf) $(bin)
    1.31 +	gbafix $(bin)
    1.32 +
    1.33 +$(bin_mb): $(elf_mb)
    1.34 +	$(OBJCOPY) -O binary $(elf_mb) $(bin_mb)
    1.35 +	gbafix $(bin_mb)
    1.36 +
    1.37 +$(elf): $(obj) ../gbasys/libgbasys.a
    1.38 +	$(CC) -o $(elf) $(obj) -specs=gba.specs $(LDFLAGS)
    1.39 +
    1.40 +$(elf_mb): $(obj) ../gbasys/libgbasys.a
    1.41 +	$(CC) -o $(elf_mb) $(obj) -specs=gba_mb.specs $(LDFLAGS)
    1.42 +
    1.43 +-include $(dep)
    1.44 +
    1.45 +%.d: %.c
    1.46 +	@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.47 +
    1.48 +.PHONY: clean
    1.49 +clean:
    1.50 +	rm -f $(obj) $(dep) $(bin) $(bin_mb) $(elf) $(elf_mb)
    1.51 +
    1.52 +.PHONY: install
    1.53 +install: $(bin)
    1.54 +	if2a -n -f -W $<
    1.55 +
    1.56 +.PHONY: run
    1.57 +run: $(bin_mb)
    1.58 +	if2a -m $<
    1.59 +
    1.60 +.PHONY: simrun
    1.61 +simrun: $(bin)
    1.62 +	VisualBoyAdvance -T 100 -2 $(bin)