Makefile & run script (run main and load swift.so)
authorDrutu Bogdan <bcristia@adobe.com>
Sat, 18 Dec 2010 13:25:46 +0000 (15:25 +0200)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 2 Apr 2011 07:27:22 +0000 (10:27 +0300)
makefile [new file with mode: 0644]
run.sh [new file with mode: 0755]

diff --git a/makefile b/makefile
new file mode 100644 (file)
index 0000000..71982b9
--- /dev/null
+++ b/makefile
@@ -0,0 +1,23 @@
+CC=gcc
+CFLAGS=-g -Wall -fPIC
+BIN=bin
+SRC=src
+LIB=lib
+
+ALL: directory lib main
+
+directory:
+       mkdir $(BIN)
+       mkdir $(LIB)
+
+lib: object
+       gcc -shared $(BIN)/lib_swift.o -o $(LIB)/libswift.so
+
+main:
+       gcc -Wall $(SRC)/main.c -o $(BIN)/main -lswift -L$(LIB)
+
+object: $(SRC)/lib_swift.c
+       $(CC) $(CFLAGS) -o $(BIN)/lib_swift.o -c $(SRC)/lib_swift.c
+       
+clean:
+       rm -fr $(BIN) $(LIB)
diff --git a/run.sh b/run.sh
new file mode 100755 (executable)
index 0000000..e6e7140
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,5 @@
+#/bin/bash
+
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:lib
+
+./bin/main $*