summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile29
-rw-r--r--README1
-rw-r--r--iproxy.c2
-rw-r--r--libusbmuxd.c4
-rw-r--r--main.c2
5 files changed, 23 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 55d396d..e0c8971 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,20 @@
-TARGETS=usbmuxd iproxy
-CFLAGS=-I. -Wall -g -DDEBUG
+TARGETS=usbmuxd iproxy libusbmuxd.so
+CFLAGS=-I. -Wall -g -DDEBUG -fPIC
LIBS=-lpthread -lusb -lrt
-LDFLAGS=
+LDFLAGS=-L.
INSTALL_PREFIX=/usr
all: $(TARGETS)
-main.o: main.c usbmuxd.h sock_stuff.h iphone.h
+main.o: main.c usbmuxd-proto.h sock_stuff.h iphone.h
iphone.o: iphone.c iphone.h usbmuxd.h sock_stuff.h
sock_stuff.o: sock_stuff.c sock_stuff.h
-libusbmuxd.o: libusbmuxd.c libusbmuxd.h usbmuxd.h
+libusbmuxd.o: libusbmuxd.c usbmuxd.h usbmuxd-proto.h
iproxy.o: iproxy.c sock_stuff.h
+libusbmuxd.so: libusbmuxd.o sock_stuff.o
+
+%.so: %.o
+ $(CC) -o $@ -shared -Wl,-soname,$@.1 $^
%.o: %.c
$(CC) -o $@ $(CFLAGS) -c $<
@@ -18,17 +22,22 @@ iproxy.o: iproxy.c sock_stuff.h
usbmuxd: main.o sock_stuff.o iphone.o
$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
-iproxy: iproxy.o libusbmuxd.o sock_stuff.o
- $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
+iproxy: iproxy.o
+ $(CC) -o $@ $(LDFLAGS) $^ $(LIBS) -lusbmuxd
clean:
- rm -f *.o $(TARGETS)
+ rm -f *.o *.so $(TARGETS)
realclean: clean
rm -f *~
install: all
- cp usbmuxd $(INSTALL_PREFIX)/sbin/
- cp usbmuxd.h $(INSTALL_PREFIX)/include/
+ install -m 755 usbmuxd $(INSTALL_PREFIX)/sbin/
+ # protocol
+ install -m 644 usbmuxd-proto.h $(INSTALL_PREFIX)/include/
+ # iproxy
+ install -m 644 libusbmux.so $(INSTALL_PREFIX)/lib/
+ install -m 644 usbmuxd.h $(INSTALL_PREFIX)/include/
+ install -m 755 iproxy $(INSTALL_PREFIX)/bin/
.PHONY: all clean realclean
diff --git a/README b/README
index 5cb74f9..b36c0c0 100644
--- a/README
+++ b/README
@@ -3,7 +3,6 @@ Build
make
-
Use
===
diff --git a/iproxy.c b/iproxy.c
index 56e30ed..527ebf6 100644
--- a/iproxy.c
+++ b/iproxy.c
@@ -32,7 +32,7 @@
#include <arpa/inet.h>
#include <pthread.h>
#include "sock_stuff.h"
-#include "libusbmuxd.h"
+#include "usbmuxd.h"
static uint16_t listen_port = 0;
static uint16_t device_port = 0;
diff --git a/libusbmuxd.c b/libusbmuxd.c
index ed331aa..1a9b4b8 100644
--- a/libusbmuxd.c
+++ b/libusbmuxd.c
@@ -8,9 +8,9 @@
#include <unistd.h>
// usbmuxd public interface
-#include <libusbmuxd.h>
-// usbmuxd protocol
#include <usbmuxd.h>
+// usbmuxd protocol
+#include <usbmuxd-proto.h>
// socket utility functions
#include "sock_stuff.h"
diff --git a/main.c b/main.c
index fc8eef2..832ff7f 100644
--- a/main.c
+++ b/main.c
@@ -34,7 +34,7 @@
#include <stdint.h>
#include <usb.h>
-#include "usbmuxd.h"
+#include "usbmuxd-proto.h"
#include "sock_stuff.h"
#include "iphone.h"