summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjak1 <jak1@themanaworld.org>2023-01-11 13:10:56 +0100
committerjak1 <jak1@themanaworld.org>2023-01-11 13:10:56 +0100
commit0e13836fdf348e59a52835a0b2a2a41ba8292e06 (patch)
tree240ab7f711070b1b7015c5f54e6e393a97114108
parent99f8d7d20cf419edc0bf77d18252adcdcfbdb7e4 (diff)
downloadsimple_library_example-0e13836fdf348e59a52835a0b2a2a41ba8292e06.tar.gz
simple_library_example-0e13836fdf348e59a52835a0b2a2a41ba8292e06.tar.bz2
simple_library_example-0e13836fdf348e59a52835a0b2a2a41ba8292e06.tar.xz
simple_library_example-0e13836fdf348e59a52835a0b2a2a41ba8292e06.zip
added make targets: install, uninstall, cleanallmaster
-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.\