PROG        = rubido
VERS        = 1.0.0
CC          = c++
LD          = c++


OPT_FLAGS   =  -O2

LIBRARIES   =  -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL -lSDL_gfx

CFLAGS      = -I/usr/include -I/usr/include/SDL -W -Wall -Wno-deprecated -Wno-sign-compare -Wno-unused -Wpointer-arith -Wcast-align -Waggregate-return -Wshadow -mfpu=vfp -mfloat-abi=softfp -mcpu=arm1136j-s
LDFLAGS     = -L/usr/lib -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL -lSDL_gfx
RM          = /bin/rm -f
OBJS        = rubido.o

PREFIX	    = $(DESTDIR)/usr
GAMEDIR     = $(PREFIX)/games/rubido
DATADIR	    = $(GAMEDIR)/data
GRAPHICSDIR = $(GAMEDIR)/graphics
MUSICDIR    = $(GAMEDIR)/music
SOUNDDIR    = $(GAMEDIR)/sound
ICONDIR     = $(PREFIX)/share/icons/hicolor/scalable/apps
DESKTOPDIR  = $(PREFIX)/share/applications/hildon


.PHONY: clean distclean
all: $(PROG)
%.o: %.cpp
		$(CC) -c $< -o $@ $(OPT_FLAGS) $(CFLAGS)
$(PROG): $(OBJS)
		$(LD) $^ -o $@ $(LDFLAGS) 
clean:
		$(RM) *~ $(OBJS) $(PROG)
.PHONY:  clean

install: all
	install -d $(GAMEDIR)
	install -d $(DATADIR)
	install -d $(GRAPHICSDIR)
	install -d $(MUSICDIR)
	install -d $(SOUNDDIR)
	install -d $(DESKTOPDIR)
	install -d $(ICONDIR)

	install -m 0755 rubido                                                                              $(GAMEDIR)
	install -m 0644 rubidofs/data/font.ttf                                                              $(DATADIR)
	install -m 0755 rubidofs/data/rubido.desktop                                                        $(DESKTOPDIR) 
	install -m 0755 rubidofs/data/rubido.png							                                              $(ICONDIR)
	install -m 0644 rubidofs/graphics/background.png                                                    $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/credits.png                                                       $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/credits1.png                                                      $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/credits2.png                                                      $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/easy1.png                                                         $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/hard1.png                                                         $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/veryeasy1.png                                                     $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/veryhard1.png                                                     $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/infoeasy.png                                                      $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/infohard.png                                                      $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/infoveryeasy.png                                                  $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/infoveryhard.png                                                  $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/newgame1.png                                                      $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/newgame2.png                                                      $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/peg.png                                                           $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/quit1.png                                                         $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/quit2.png                                                         $(GRAPHICSDIR)
	install -m 0644 rubidofs/graphics/titlescreen.png                                                   $(GRAPHICSDIR)
	install -m 0644 rubidofs/music/rubido.mod                                                           $(MUSICDIR)
	install -m 0644 rubidofs/sound/good.wav                                                             $(SOUNDDIR)
	install -m 0644 rubidofs/sound/wrong.wav                                                            $(SOUNDDIR)
	install -m 0644 rubidofs/sound/loser.wav                                                            $(SOUNDDIR)
	install -m 0644 rubidofs/sound/select.wav                                                           $(SOUNDDIR)
	install -m 0644 rubidofs/sound/start.wav                                                            $(SOUNDDIR)
	install -m 0644 rubidofs/sound/winner.wav                                                           $(SOUNDDIR)
