Made a new makefile for scratchbox builds
[mtetherd] / Makefile
index 663a47d..5cc417f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,29 +1,27 @@
-MAD = mad
 CC = gcc
-CFLAGS = -Wall -O0 -g -D_GNU_SOURCE
-INCLUDES = -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
-LDFLAGS = -g
-LIBS = -ldbus-1 -lpthread
-SSH_ADDRESS = developer@192.168.253.254
-SSH_SCP = scp
-SSH_SSH = ssh
-SSH_PATH = /home/developer
-DATA_FILES = main.c device.c device.h event.d-mtetherd
+CFLAGS = -Wall -O2 -g -D_GNU_SOURCE
+INCLUDES = $(shell pkg-config dbus-1 --cflags)
+LDFLAGS =
+LIBS = $(shell pkg-config dbus-1 --libs)
+PREFIX = /usr
 
 mtetherd: mtetherd.o device.o
-       $(MAD) $(CC) $(LDFLAGS) $(LIBS) -o $@ $^
+       $(CC) $(LDFLAGS) $(LIBS) -o $@ $^
 
-%PHONY: copy run clean
+%PHONY: clean install uninstall
 
-copy: mtetherd $(DATA_FILES)
-       $(SSH_SCP) $^ $(SSH_ADDRESS):$(SSH_PATH)
+clean:
+       rm -f *.o mtetherd
 
-run: copy
-       $(SSH_SSH) $(SSH_ADDRESS) $(SSH_PATH)/maemo-tethering
+install: mtetherd
+       install -m 755 -D mtetherd $(PREFIX)/sbin/mtetherd
+       install -m 644 -D event.d-mtetherd /etc/event.d/mtetherd
+       install -m 644 -D README $(PREFIX)/share/doc/mtetherd/README
 
-clean:
-       rm -f *.o maemo-tethering
+uninstall:
+       rm -f $(PREFIX)/sbin/mtetherd
+       rm -f /etc/event.d/mtetherd
+       rm -rf $(PREFIX)/share/doc/mtetherd
 
 %.o: %.c
-       $(MAD) $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $^
-
+       $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $^