From 62454373db4cd2add82ded0cf7b21f7d69ade597 Mon Sep 17 00:00:00 2001 From: spl3g Date: Sat, 22 Mar 2025 21:41:16 +0300 Subject: Reorganize the lib --- Makefile | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 000af46..543ef5d 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,26 @@ -main: main.c lib - cc -Wall -Wextra -ggdb -o main main.c lib/arena_strings.c lib/http.c lib/arena.c lib/const_strings.c +CC = gcc +AR = ar +CFLAGS = -Wall -Wextra -fPIC -Iinclude/ + +LIBNAME = chttp +SOURCES = $(wildcard src/*.c) +OBJECTS = $(SOURCES:.c=.o) + +all: static + +static: $(OBJECTS) + $(AR) rcs $(LIBNAME).a $(OBJECTS) + +shared: $(OBJECTS) + $(CC) -shared -o $(LIBNAME).so $(OBJECTS) + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +install: all + install -d /usr/local/include/yourlib/ + install include/yourlib/*.h /usr/local/include/yourlib/ + install $(LIBNAME) /usr/local/lib/ + +clean: + rm -f src/*.o *.a *.so -- cgit v1.2.3