From 9dbf14a2a523722d7225c751f4cf7639829c5b67 Mon Sep 17 00:00:00 2001 From: 0scar Date: Tue, 16 Nov 2021 14:51:12 +0100 Subject: Add library compilation --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- cgit v1.3