all: shortcutd panelplugin/libshortcutdplugin.so
	cd usermenu; qmake;	$(MAKE)	

CFLAGS=`pkg-config --cflags dbus-glib-1 glib-2.0 hal x11 xtst xi`
LIBS=`pkg-config --libs dbus-glib-1 glib-2.0 hal x11 xtst xi`
PANEL_DEPS=`pkg-config --libs --cflags gtk+-2.0 hildon-control-panel libosso hildon-1 hal dbus-glib-1 glib-2.0`


shortcutd: shortcutd.o proximity.o camkey.o config.o json/JSON_parser.o launcher.o
	g++ -o shortcutd -Wall $(LIBS) shortcutd.o proximity.o camkey.o config.o json/JSON_parser.o launcher.o

shortcutd.o: shortcutd.cpp shortcutd.h proximity.h camkey.h config.h
	g++ -o shortcutd.o -Wall $(CFLAGS) -c shortcutd.cpp

proximity.o: proximity.cpp proximity.h
	g++ -o proximity.o -Wall $(CFLAGS) -c proximity.cpp

camkey.o: camkey.cpp camkey.h shortcutd.h
	g++ -o camkey.o -Wall $(CFLAGS) -c camkey.cpp

config.o: config.cpp config.h shortcutd.h camkey.h proximity.h
	g++ -o config.o -Wall $(CFLAGS) -c config.cpp

json/JSON_parser.o: json/JSON_parser.c json/JSON_parser.h
	g++ -o json/JSON_parser.o -Wall $(CFLAGS) -c json/JSON_parser.c

launcher.o: launcher.cpp launcher.h shortcutd.h
	g++ -o launcher.o -Wall $(CFLAGS) -c launcher.cpp


panelplugin/libshortcutdplugin.so: panelplugin/shortcutdplugin.cpp shortcutd.h config.cpp config.h json/JSON_parser.c json/JSON_parser.h
	g++ -shared -Wall $(PANEL_DEPS) panelplugin/shortcutdplugin.cpp config.cpp json/JSON_parser.c -o panelplugin/libshortcutdplugin.so


clean:
	rm -f *.o *~ shortcutd json/*.o panelplugin/*.o panelplugin/*.so build-stamp configure-stamp
	$(MAKE) -C usermenu clean
	rm -f usermenu/scd-usermenu
