# This Makefile is very easy to use !
# Only edit PRG and OBJS 
# Dont touch anything else

CC = arm-elf-gcc
LD = arm-elf-gcc
AS = arm-elf-as
AR = arm-elf-ar

PRG  = filetest
OBJS = filetest.o

LIBS      = -L../lib -lmirkoSDK -lm
CRT0      = ../lib/crt0.S
LNKSCRIPT = ../lib/lnkscript
INCLUDES  = -I../lib.src/include
CFLAGS    = $(INCLUDES) -O2 -s -mtune=arm9tdmi

all:	$(OBJS)
	$(CC) -c -o crt0.o $(CRT0)
	$(LD) -nostartfiles -s -Wall -Wl,-Map,Test.map  -T $(LNKSCRIPT) crt0.o -o $(PRG).elf $(OBJS) $(LIBS)
	arm-elf-objcopy -O binary $(PRG).elf $(PRG).bin
	b2fxec -a Mirko_Roller -t SDK_EXAMPLE_$(PRG) $(PRG).bin $(PRG).fxe

install:
	gplink put $(PRG).fxe gpmm
	gplink put filetest.dat gpmm

clean:
	rm -f *.o *~ Test.map *.bin *.elf
