#
# Iris sample
# Olivier/Omar for lab-console
# Jully 2002
#

# Files ---------------------------------------------------------------------------
APPLICATION=marble_iris

TARGET 	= $(APPLICATION).elf

SCRIPT_FILES = script/Script.o EntityScript.o

LUA_FILES = lua/lua.o lua/lua_intro.o

UTILS =   util/purupuru.o  util/perfmeter.o util/bsod.o util/avgfps.o util/cache.o 

MINI_LZO = minilzo.o lzo.o lzoloader.o

GZIP=gzip.o gziploader.o

StateMachine=ai/statemch.o

COLLIDE_FILES = collide/PbAABB.o collide/PbBSCT.o
##$(COLLIDE_FILES) 
OBJS 	=	  $(UTILS)\
 				$(GZIP) $(StateMachine)\
 				 				Credits.o intro/CreditsIntro.o\
 				 intro/HiScoreIntro.o intro/DemoIntro.o\
 				 vmu/vmu.o stream/stream.o HiScore.o \
			globals.o sound/ogg.o\
			sprites/EntityCannonSmoke.o sprites/EntityIntroField.o\
			sprites/EntitySun.o sprites/EntityStarfield.o \
			 sprites/fx/FXFireExplosion.o  sprites/EntityFire.o\
		sprites/EntityCannonFire.o sprites/EntityLight.o\
					objekte/Schatten.o objekte/EntityPlayer.o \
			 objekte/EntityRing.o objekte/EntityRings.o \
			 objekte/EntityCannon.o  \
			 main.o  Game.o EntityManager.o  Entity.o EntitySprite.o \
			 EntitySkyBox.o EntityFloor.o\
			 ParticleEmetor.o intro/intro.o\
			 sound/PbSoundClass.o\
		     sound/aica.o \
		     ShowScreen.o EntityIntro.o\
		      intro/VinceIntro.o intro/CannonIntro.o\
		     EntitySolidExplosion.o EntityBlendedExplosion.o\
		     lights/StageLight.o\
		     explosions/CannonExplosion.o  explosions/RingExplosion.o\
		     explosions/WalkerExplosion.o\
		     explosions/WalkerImplusion.o\
		     messages/VinceMsg.o messages/PlayerWins.o\
		     messages/ScoreTime.o messages/AlienBirth.o\
		     messages/Tipp.o messages/Preview.o messages/GetReady.o\
		     messages/GameOver.o messages/UniMsg.o messages/EntityMessage.o messages/LaserMode.o\
		     font.o
		     #line3d.o
		     # render2tex.o 
		   		    		    
		     #EntityLoadingField.o 
		     
#OBS +=  $(LUA_FILES)
		     		    
		    
# nicht USE_OGG macht elf kleiner!!!und linkz den ogg scheiss nicht
# 		-DUSE_LUA
#
# LAUFTEST macht endloss testdurchlauf

FINAL=   -DLAUFTEST  -DUSE_BROADBAND -DFINAL_CD 

DEFINES =    -DUSE_OGG -DUSE_BACKSTREAM 


INCLUDE_PATH4 = -Iboost/ -Iai/ -Ivmu/ -Iutil/ -Istream/ -Ilights/ -Imessages/ -Ilua/ -I. -Icollide/ -Iexplosions/ -Isprites/ -Isound/ -Iintro/ -Iscript/ -Iobjekte/

INCLUDE_PATH = ../../include
INCLUDE_IRIS = $(INCLUDE_PATH)/iris3d
INCLUDE_OPCODE = $(INCLUDE_PATH)/opcode
KOS_CFLAGS +=  $(DEFINES)  -I/usr/local/include/stlport  $(INCLUDE_PATH4) -I$(INCLUDE_IRIS)/ -I$(INCLUDE_OPCODE)/
KOS_LDFLAGS += -L../../lib/   
IRIS_LIBS =  -Wl,-\(,-liris3d,-lk++,-ltremor,-lparallax,-lm,-lz,-lpng,-ljpeg,-lkosutils,-lkmg-\)
# Base ----------------------------------------------------------------------------
all: 		 clean_elf $(TARGET)
images: 	clean_images font.img hiscore.img rings.img smily.img freak.img intro.img level1.img preload.img 
			#musicloop1.img sfx.img
include 	$(KOS_BASE)/Makefile.rules

# Link ----------------------------------------------------------------------------
$(TARGET): 	clean_elf $(OBJS) romdisk.o
			$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) $(OBJS) romdisk.o $(OBJEXTRA) 	 $(IRIS_LIBS) $(KOS_LIBS)

# PAK romdiskimages creation

font.img:
		$(KOS_GENROMFS) -f data/font.img -d data/font -v

smily.img:
		$(KOS_GENROMFS) -f data/smily.img -d data/smily -v

freak.img:
		$(KOS_GENROMFS) -f data/freak.img -d data/freak -v

intro.img:
		$(KOS_GENROMFS) -f data/intro.img -d data/intro -v

level1.img:
		$(KOS_GENROMFS) -f data/level1.img -d data/level1 -v

preload.img:
		$(KOS_GENROMFS) -f data/preload.img -d data/preload -v
		
sfx.img:
		$(KOS_GENROMFS) -f data/sfx.img -d data/sfx -v

rings.img:
		$(KOS_GENROMFS) -f data/rings.img -d data/rings -v

hiscore.img:
		$(KOS_GENROMFS) -f data/hiscore.img -d data/hiscore -v

walker.img:
		$(KOS_GENROMFS) -f data/walker.img -d data/walker -v


					
# ROM Disk Creation ---------------------------------------------------------------
rd :
			$(KOS_GENROMFS) -f romdisk.img -d romdisk -v

romdisk.img :
			$(KOS_GENROMFS) -f romdisk.img -d romdisk -v

romdisk.o :	romdisk.img
			$(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o


	
# Upload program on Dreamcast using $KOS_LOADER -----------------------------------
run: 		$(TARGET)
			$(KOS_LOADER) $(TARGET)

# Miscellaneous -------------------------------------------------------------------
dist:
			rm -f $(OBJS)
			$(KOS_STRIP) $(TARGET)

clean:		clean_images clean_elf
			-rm -f $(OBJS) libtremor/kos/*.o
			
		
clean_images:
				-rm -f data/*.img 

clean_elf:	
			-rm -f $(TARGET) romdisk.* 
		
SUBDIRS = libtremor

libtremorhack: libtremor
			
final: 
	$(KOS_OBJCOPY) -O binary $(APPLICATION).elf $(APPLICATION).bin
	scramble $(APPLICATION).bin 1ST_READ.BIN
bin: 
	$(KOS_OBJCOPY) -O binary $(APPLICATION).elf 1ST_READ.BIN
	
	
			
format_src: 
	astyle *.cpp
	astyle *.h
	astyle vmu/*.cpp
	astyle vmu/*.h
	astyle util/*.cpp
	astyle util/*.h
	astyle sprites/*.cpp
	astyle sprites/*.h
	astyle intro/*.cpp
	astyle sprites/fx/*.cpp
	astyle sprites/fx/*.h
	astyle objekte/*.cpp
	astyle objekte/*.h
	astyle sound/*.h
	astyle sound/*.hpp
	astyle sound/*.cpp
	astyle messages/*.cpp
	astyle lights/*.cpp
	astyle lights/*.h
	astyle messages/*.h
	astyle explosions/*.cpp
	astyle explosions/*.h
	astyle stream/*.cpp
	astyle stream/*.h
	astyle ai/*.cpp
	astyle ai/*.h
	-rm *orig ai/*orig vmu/*orig util/*orig stream/*orig lights/*orig messages/*orig explosions/*orig   sound/*orig intro/*orig objekte/*orig sprites/*orig sprites/fx/*orig
	
	

#----------------------------------------------------------------------------------

	
Game.o: Game.cpp Game.h 
