From 74eda8f70e0442728bde017276205481bdece4b3 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Sat, 4 Jun 2011 10:27:10 +0300 Subject: [PATCH] Add lib/ folder. lib_* source code files go into lib/. --- makefile | 27 --------------------------- run.sh | 11 ----------- src/lib/.gitignore | 2 ++ src/lib/Makefile | 25 +++++++++++++++++++++++++ src/{ => lib}/client.c | 0 src/{ => lib}/lib_swift.c | 0 src/{ => lib}/lib_swift.h | 0 src/lib/run_client_server.bash | 8 ++++++++ src/{ => lib}/server.c | 0 9 files changed, 35 insertions(+), 38 deletions(-) delete mode 100644 makefile delete mode 100755 run.sh create mode 100644 src/lib/.gitignore create mode 100644 src/lib/Makefile rename src/{ => lib}/client.c (100%) rename src/{ => lib}/lib_swift.c (100%) rename src/{ => lib}/lib_swift.h (100%) create mode 100755 src/lib/run_client_server.bash rename src/{ => lib}/server.c (100%) diff --git a/makefile b/makefile deleted file mode 100644 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 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 index 0000000..3d33a15 --- /dev/null +++ b/src/lib/.gitignore @@ -0,0 +1,2 @@ +/client +/server diff --git a/src/lib/Makefile b/src/lib/Makefile new file mode 100644 index 0000000..d29c33c --- /dev/null +++ b/src/lib/Makefile @@ -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 *~ diff --git a/src/client.c b/src/lib/client.c similarity index 100% rename from src/client.c rename to src/lib/client.c diff --git a/src/lib_swift.c b/src/lib/lib_swift.c similarity index 100% rename from src/lib_swift.c rename to src/lib/lib_swift.c diff --git a/src/lib_swift.h b/src/lib/lib_swift.h 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 index 0000000..e3579e6 --- /dev/null +++ b/src/lib/run_client_server.bash @@ -0,0 +1,8 @@ +#!/bin/bash + +LD_LIBRARY_PATH=. ./server & +LD_LIBRARY_PATH=. ./client & + +wait + +echo -e "All done.\n" diff --git a/src/server.c b/src/lib/server.c similarity index 100% rename from src/server.c rename to src/lib/server.c -- 2.20.1