From 40b2b829bc26583cc091fdca064004cfdebc10c5 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jeremy@system76.com>
Date: Thu, 11 Apr 2019 20:09:38 -0600
Subject: [PATCH] Add support for building .so

---
 Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Makefile b/Makefile
index 63e56d8..eb45ad2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,17 @@
 SRC=$(wildcard *.c)
 OBJ=$(patsubst %.c,%.o,$(SRC))
+LOBJ=$(patsubst %.c,%.lo,$(SRC))
 
 all: libpthread.a
 
 libpthread.a: $(OBJ)
 	$(AR) -rcs $@ $(OBJ)
 
+libpthread.so: $(LOBJ)
+	$(CC) $(CFLAGS) -nostdlib -shared -o $@ $(LOBJ)
+
 %.o: %.c
 	$(CC) $(CFLAGS) -I . -c $< -o $@
+
+%.lo: %.c
+	$(CC) $(CFLAGS) -fPIC -I . -c $< -o $@
-- 
GitLab