summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2021-11-16 13:51:12 +0000
committer0scar <qgt268@alumni.ku.dk>2021-11-16 13:51:12 +0000
commit9dbf14a2a523722d7225c751f4cf7639829c5b67 (patch)
tree00c179da41a114792ad17ece425985ffb4bf0904
parentaf8e31bc310cba45858e276937fd3e1372d0b11d (diff)
Add library compilation
-rw-r--r--Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 8af9e71..37ab224 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@ CC = gcc
LFLAGS =
FLAGS = -ansi -Wall -Wextra -pedantic
OUT = btree-test
+LIB_OUT = libbtree.so
SRC :=$(wildcard src/*.c)
OBJ :=$(addprefix obj/,$(notdir $(SRC:.c=.o)))
@@ -18,6 +19,12 @@ debug: obj build
build: $(OUT)
+lib: DEFS += -fpic
+lib: $(LIB_OUT)
+
+$(LIB_OUT): $(OBJ)
+ $(CC) $(DEFS) $(FLAGS) $(LFLAGS) -shared -o $(LIB_OUT) $(OBJ)
+
$(OUT): $(OBJ)
$(CC) $(DEFS) $(FLAGS) $(LFLAGS) -o $(OUT) $(OBJ)