aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 26 insertions, 2 deletions
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