summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)