Add lib/ folder.
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 4 Jun 2011 07:27:10 +0000 (10:27 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 4 Jun 2011 07:27:16 +0000 (10:27 +0300)
lib_* source code files go into lib/.

makefile [deleted file]
run.sh [deleted file]
src/lib/.gitignore [new file with mode: 0644]
src/lib/Makefile [new file with mode: 0644]
src/lib/client.c [moved from src/client.c with 100% similarity]
src/lib/lib_swift.c [moved from src/lib_swift.c with 100% similarity]
src/lib/lib_swift.h [moved from src/lib_swift.h with 100% similarity]
src/lib/run_client_server.bash [new file with mode: 0755]
src/lib/server.c [moved from src/server.c with 100% similarity]

diff --git a/makefile b/makefile
deleted file mode 100644 (file)
index 45f76ef..0000000
--- a/makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-CC=gcc
-CFLAGS=-g -Wall -fPIC
-BIN=bin
-SRC=src
-LIB=lib
-
-ALL: directory $(LIB)/libswift.so $(BIN)/server $(BIN)/client
-
-directory:
-       mkdir -p $(BIN)
-       mkdir -p $(LIB)
-
-$(LIB)/libswift.so: $(BIN)/lib_swift.o
-       gcc -shared $(BIN)/lib_swift.o -o $(LIB)/libswift.so
-
-$(BIN)/client: $(SRC)/client.c
-       gcc -Wall $(SRC)/client.c -o $(BIN)/client -lswift -L$(LIB)
-
-$(BIN)/server: $(SRC)/server.c
-       gcc -Wall $(SRC)/server.c -o $(BIN)/server -lswift -L$(LIB)
-
-
-$(BIN)/lib_swift.o: $(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
deleted file mode 100755 (executable)
index 7133f03..0000000
--- a/run.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#/bin/bash
-
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:lib
-
-./bin/server &
-./bin/client &
-
-wait
-
-echo "All done."
-echo ""
diff --git a/src/lib/.gitignore b/src/lib/.gitignore
new file mode 100644 (file)
index 0000000..3d33a15
--- /dev/null
@@ -0,0 +1,2 @@
+/client
+/server
diff --git a/src/lib/Makefile b/src/lib/Makefile
new file mode 100644 (file)
index 0000000..d29c33c
--- /dev/null
@@ -0,0 +1,25 @@
+CFLAGS = -g -Wall -fPIC
+LDFLAGS = -L.
+LDLIBS = -lswift
+
+.PHONY: all clean
+
+all: server client
+
+client: client.o libswift.so
+
+server: server.o libswift.so
+
+client.o: client.c lib_swift.h
+
+server.o: server.c lib_swift.h
+
+libswift.so: lib_swift.o
+       $(CC) -shared -o $@ $^
+
+lib_swift.o: lib_swift.c lib_swift.h
+
+clean:
+       -rm -f server client libswift.so
+       -rm -f *.o
+       -rm -f *~
similarity index 100%
rename from src/client.c
rename to src/lib/client.c
similarity index 100%
rename from src/lib_swift.c
rename to src/lib/lib_swift.c
similarity index 100%
rename from src/lib_swift.h
rename to src/lib/lib_swift.h
diff --git a/src/lib/run_client_server.bash b/src/lib/run_client_server.bash
new file mode 100755 (executable)
index 0000000..e3579e6
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+LD_LIBRARY_PATH=. ./server &
+LD_LIBRARY_PATH=. ./client &
+
+wait
+
+echo -e "All done.\n"
similarity index 100%
rename from src/server.c
rename to src/lib/server.c