
ROOT_PATH = ../..

COMPILE = g++ ${PLATFORM_COMPILE_FLAGS} -Wall -Wwrite-strings -Wchar-subscripts -Wparentheses -g -I${ROOT_PATH} -c
LINK = g++ -I${ROOT_PATH}






MG_PATH = ${ROOT_PATH}/minorGems

MINOR_GEMS_SOURCES = \
${MG_PATH}/io/file/${PLATFORM_PATH}/Path${PLATFORM_NAME}.cpp \
${MG_PATH}/util/stringUtils.cpp \
${MG_PATH}/util/StringBufferOutputStream.cpp \
${MG_PATH}/util/SettingsManager.cpp \
${MG_PATH}/system/${TIME_PLATFORM_PATH}/Time${TIME_PLATFORM_NAME}.cpp \
${MG_PATH}/system/${PLATFORM_PATH}/Thread${PLATFORM_NAME}.cpp \
${MG_PATH}/crypto/hashes/sha1.cpp \
${MG_PATH}/formats/encodingUtils.cpp \


MINOR_GEMS_OBJECTS = ${MINOR_GEMS_SOURCES:.cpp=.o}



GAME_SOURCES = \
game.cpp \
landscape.cpp \
blowUp.cpp \
World.cpp \
map.cpp \
common.cpp \
score.cpp \
musicPlayer.cpp \
Timbre.cpp \
Envelope.cpp \

GAME_GRAPHICS = \
graphics/tileSet.tga \
graphics/characterSprite.tga \
graphics/characterSpriteSad.tga \
graphics/spouseSprite.tga \
graphics/numerals.tga \
graphics/chest.tga \
graphics/chestPrize.tga \
graphics/chestDust.tga \
graphics/heart.tga \
graphics/title.tga \
music/music.tga \



GAME_OBJECTS = ${GAME_SOURCES:.cpp=.o}


all: Passage ${GAME_GRAPHICS}

clean:  
	rm *.o *.tga Passage testMusicPlayer

Passage: ${GAME_OBJECTS} ${MINOR_GEMS_OBJECTS}
	${LINK} -o Passage ${GAME_OBJECTS} ${MINOR_GEMS_OBJECTS} ${PLATFORM_LINK_FLAGS}

testMusicPlayer: ${GAME_OBJECTS} testMusicPlayer.o common.o Timbre.o Envelope.o ${MINOR_GEMS_OBJECTS}
	${LINK} -o testMusicPlayer musicPlayer.o testMusicPlayer.o common.o Timbre.o Envelope.o ${MINOR_GEMS_OBJECTS} ${PLATFORM_LINK_FLAGS}


game.o: game.cpp World.h blowUp.h common.h map.h

landscape.o: landscape.cpp landscape.h
blowUp.o: blowUp.cpp blowUp.h
World.o: World.cpp World.h common.h map.h
common.o: common.cpp common.h 
map.o: map.cpp map.h landscape.h HashTable.h



# 
# Generic:
#
# Map all .cpp C++ and C files into .o object files
#
# $@   represents the name.o file
# $<   represents the name.cpp file
#
.cpp.o:
	${COMPILE} -o $@ $<
.c.o:
	${COMPILE} -o $@ $<
graphics/%.tga: %.png
	convert $< $@
music/%.tga: %.png
	convert $< $@
