summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile26
-rw-r--r--README.md4
2 files changed, 25 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index ef37426..8926e98 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,9 @@
-.PHONY: server client shared install
+.PHONY: server client shared clean install uninstall cleanall
# > configuration start
+inst_dir = /usr/local/
+
lib_name := som_net
CC = gcc
@@ -17,11 +19,16 @@ SHARED_LD = -shared -fPIC
CLIENT_LD = -l${lib_name}
SERVER_LD = -l${lib_name}
-export LD_LIBRARY_PATH:=`pwd`
+export LD_LIBRARY_PATH=`pwd`
# help text
default:
- @echo " make targets: shared, client, server, [install >WIP<]"
- @echo " *shared is required for all targets!"
+ @echo "targets:"
+ @echo " build: *shared is required for all targets"
+ @echo " > shared, client, server"
+ @echo " delete:"
+ @echo " > clean, uninstall, cleanall"
+ @echo " install:"
+ @echo " > install"
# target: client
client: .client_comp
@@ -41,5 +48,16 @@ shared: .shared_comp
clean:
rm -f $(wildcard ./**/*.o) client_example server_example lib${lib_name}.so
+install:
+ cp "lib${lib_name}.so" "${inst_dir}lib/"
+ mkdir -p "${inst_dir}include/${lib_name}/"
+ cp shared/*.h "${inst_dir}include/${lib_name}/"
+
+uninstall:
+ rm "${inst_dir}lib/lib${lib_name}.so"
+ rm -r "${inst_dir}include/${lib_name}"
+
+cleanall: clean uninstall
+
**/%.o: **/%.c
$(CC) -c -o $@ $<
diff --git a/README.md b/README.md
index f0bcb3d..c4e4771 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,9 @@
- `make shared` (required for all targets, also mentioned when you just do `make`) (shared object)
- `make client` builds the client_example (elf)
- `make server` builds the server_example (elf)
-- `make install` (not implemented, i dont want to install any librarys that are just examples)
+- `sudo make install` installs the library to /usr/local/*
+- `make clean` cleans up all objects and binaries
+- `sudo make cleanall` cleans up objects, binaries and delets it from your /usr/local/*
## Test it
the client needs a running server, so start with it first.\