#***********************************************************
#
# 	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

INC	= -I ../. -I ../../.	
LDFLG	= --script ../../../../armcc/system/lnkscript -L ../../../../armcc/lib/gcc-lib/arm-agb-elf/3.3.2/interwork/   

EOBJ	= ../../stdfkt/stdm0io.o\
	  ../../stdmath/fast_div.o\
	  ../../stdfkt/simple.o\
	  ../sound_mix.o\
	  ../sound_direct.o\
	  ../sound_mod.o\
	  ../sound_mod_effekts.o\
	  ../sound_mod_effekts_thumb.o 
		
OBJ 	= play_direct.o	title.o

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