APP=cloudgps

CC = gcc

CFLAGS = -g -O2  `sdl-config --cflags --libs` `pkg-config --cflags --libs liblocation hal x11 xtst`
PKGCFLAGS = -Wall

LIBS = `sdl-config --cflags --libs` `pkg-config --cflags --libs liblocation hal x11 xtst` -lSDL_gles -lEGL -lGLES_CM -lm -lSDL_image -lcurl

TARGET = cloudgps

SOURCES = src/main.c

OBJS = $(SOURCES:%.c=%.o)

all:	$(TARGET)

$(TARGET): $(OBJS)
	$(CC) -o $(TARGET) $(OBJS) $(LIBS)

%.o: %.c
	$(CC) -o $@ -c $^ $(CFLAGS) $(PKGCFLAGS)

clean:
	rm -f $(TARGET) $(OBJS)

install:
	@echo You must be root to install
	install -d $(DESTDIR)/opt/cloudgps/res/
	install cloudgps $(DESTDIR)/opt/cloudgps/
	install res/*.png $(DESTDIR)/opt/cloudgps/res/
	install -d $(DESTDIR)/usr/share/applications/hildon/
	install res/*.desktop $(DESTDIR)/usr/share/applications/hildon/
	for s in 40 26; do \
	  install -d $(DESTDIR)$(prefix)/usr/share/icons/hicolor/$${s}x$${s}/hildon ;\
	  install -m 644 res/$(APP).$$s.png $(DESTDIR)$(prefix)/usr/share/icons/hicolor/$${s}x$${s}/hildon/$(APP).png ;\
	done
	install -d $(DESTDIR)$(prefix)/usr/share/icons/hicolor/scalable/hildon
	install -m 644 res/$(APP).64.png $(DESTDIR)$(prefix)/usr/share/icons/hicolor/scalable/hildon/$(APP).png
	

