#***********************************************************
#
# 	Standard-Makefile written by Marten Wobst
#
#***********************************************************

ASC	= exec ../../armcc/asmconv.sh
AS	= ../../armcc/bin/arm-elf-as.exe -EL -mthumb-interwork 
LD	= ../../armcc/bin/arm-elf-ld.exe 
OC	= ../../armcc/bin/arm-elf-objcopy.exe
RE	= ../../armcc/bin/arm-elf-readelf.exe
CC	= ../../armcc/bin/arm-elf-gcc.exe  

INC	= -I . -I ../.\
	  -I ../source/sound/\
	  -I ../source/mem/\
	  -I ../source/kollision/\
	  -I ../source/
	    
LDFLG	= --script ../../armcc/system/lnkscript\
	  -L ../../armcc/lib/gcc-lib/arm-elf/3.4.0/interwork/\
	  
	   
CFLAGS  = -mthumb-interwork -mlong-calls -fverbose-asm  -Wall -mcpu=arm7tdmi -O3

EOBJS=	../source/extendedfkt/bresenham.o\
	../source/extendedfkt/fill_rowbyrow.o\
	../source/extendedfkt/spline.o\
	../source/extendedfkt/irq_handler.o\
	../source/kollision/2d_rotation.o\
	../source/kollision/obj_kollision_arm.o\
	../source/kollision/obj_kollision_thumb.o\
	../source/mem/mem.o\
	../source/screen/scroll.o\
	../source/sound/sound_direct.o\
	../source/sound/sound_mix.o\
	../source/sound/sound_mod.o\
	../source/sound/sound_mod_effekts.o\
	../source/sound/sound_mod_effekts_thumb.o\
	../source/sprite/sprite.o\
	../source/stdfkt/simple.o\
	../source/stdmath/fast_div.o\
	../source/stdmath/fast_root.o\
	../source/stdmath/sin.o\
	../source/stdfkt/stdm0io.o\
	../source/anim/lzss_dec.o

	
OBJ 	= game.o\
	  logo.o\
	  drive.o\
	  car_koll.o\
	  car_ki.o\
	  player_koll.o\
	  titel.o

all:    $(OBJ)
	$(LD) $(OBJ) $(EOBJS) $(LDFLG) -o game.elf
	$(OC) -v -O binary game.elf game.gba
	$(RE) -l game.elf
	
%.o:   %.s 
	$(ASC)  $< >temp.s
	$(AS)   temp.s $(INC) -o $@
	
%.o:   %.c 
	$(CC)   $< $(INC) -o $@	
	
clean:
	rm -rf $(OBJ)	
	


	

