Added header guard to device.h, wrote typedef in a cleaner way
[mtetherd] / Makefile
index fa9330f..b2d6d0a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,39 @@
+PREFIX = /usr
 CC = gcc
 CFLAGS = -Wall -O2 -g -D_GNU_SOURCE
-INCLUDES = $(shell pkg-config dbus-1 --cflags)
+INCLUDES = $(shell pkg-config --cflags dbus-1 libhildondesktop-1)
 LDFLAGS =
-LIBS = $(shell pkg-config dbus-1 --libs)
-PREFIX = /usr
+LIBS_DBUS = $(shell pkg-config --libs dbus-1)
+LIBS_HILDON = $(shell pkg-config --libs libhildondesktop-1)
+HILDON_DESKTOP = $(shell pkg-config --variable=hildonstatusmenudesktopentrydir libhildondesktop-1)
+HILDON_PLUGIN = $(shell pkg-config --variable=hildondesktoplibdir libhildondesktop-1)
+
+all: mtetherd mtetherd-plugin.so
 
 mtetherd: mtetherd.o device.o
-       $(CC) $(LDFLAGS) $(LIBS) -o $@ $^
+       $(CC) $(LDFLAGS) $(LIBS_DBUS) -o $@ $^
+
+mtetherd-plugin.so: status.o
+       $(CC) $(LDFLAGS) $(LIBS_HILDON) -shared -o $@ $^
 
 %PHONY: clean install uninstall
 
 clean:
-       rm -f *.o mtetherd
+       rm -f *.o mtetherd mtetherd-plugin.so
 
-install: mtetherd
+install: mtetherd mtetherd-plugin.so
        install -m 755 -D mtetherd $(DESTDIR)/$(PREFIX)/sbin/mtetherd
        install -m 644 -D event.d-mtetherd $(DESTDIR)/etc/event.d/mtetherd
        install -m 644 -D README $(DESTDIR)/$(PREFIX)/share/doc/mtetherd/README
+       install -m 644 -D mtetherd-plugin.desktop $(DESTDIR)/$(HILDON_DESKTOP)/mtetherd-plugin.desktop
+       install -m 755 -D mtetherd-plugin.so $(DESTDIR)/$(HILDON_PLUGIN)/mtetherd-plugin.so
 
 uninstall:
        rm -f $(DESTDIR)/$(PREFIX)/sbin/mtetherd
        rm -f $(DESTDIR)/etc/event.d/mtetherd
        rm -rf $(DESTDIR)/$(PREFIX)/share/doc/mtetherd
+       rm -f $(DESTDIR)/$(HILDON_DESKTOP)/mtetherd-plugin.desktop
+       rm -f $(DESTDIR)/$(HILDON_PLUGIN)/mtetherd-plugin.so
 
 %.o: %.c
        $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $^