From 9cc1a2c0e62c75dc7afd20d5e337953f44693b70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Iva=C8=99cu?= <givascu@bitdefender.com>
Date: Tue, 9 Apr 2019 16:07:39 +0300
Subject: [PATCH] Build static library too

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index d6ff1b0..d81153c 100644
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,14 @@ LIBUCONTEXT_S_SRC = $(wildcard arch/${ARCH}/*.S)
 LIBUCONTEXT_OBJ = ${LIBUCONTEXT_C_SRC:.c=.o} ${LIBUCONTEXT_S_SRC:.S=.o}
 LIBUCONTEXT_SOVERSION = 0
 LIBUCONTEXT_NAME = libucontext.so
+LIBUCONTEXT_STATIC_NAME = libucontext.a
 LIBUCONTEXT_SONAME = libucontext.so.${LIBUCONTEXT_SOVERSION}
 LIBUCONTEXT_PATH = /lib/${LIBUCONTEXT_SONAME}
 
-all: ${LIBUCONTEXT_SONAME}
+all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME}
+
+${LIBUCONTEXT_STATIC_NAME}: ${LIBUCONTEXT_OBJ}
+	$(AR) rcs ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_OBJ}
 
 ${LIBUCONTEXT_NAME}: ${LIBUCONTEXT_OBJ}
 	$(CC) -o ${LIBUCONTEXT_NAME} -Wl,-soname,${LIBUCONTEXT_SONAME} \
From 2e15b383272fafbbb92882990b8f339e2c6888d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Iva=C8=99cu?= <givascu@bitdefender.com>
Date: Fri, 12 Apr 2019 10:48:24 +0300
Subject: [PATCH] Makefile: Handle static library at clean/install

---
 .gitignore | 1 +
 Makefile   | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 4fb95ca..d2e350f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,5 +34,6 @@ Makefile.in
 
 *.o
 test_libucontext
+libucontext.a
 libucontext.so
 libucontext.so.*
diff --git a/Makefile b/Makefile
index d81153c..8a605fd 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@ LIBUCONTEXT_NAME = libucontext.so
 LIBUCONTEXT_STATIC_NAME = libucontext.a
 LIBUCONTEXT_SONAME = libucontext.so.${LIBUCONTEXT_SOVERSION}
 LIBUCONTEXT_PATH = /lib/${LIBUCONTEXT_SONAME}
+LIBUCONTEXT_STATIC_PATH = /lib/${LIBUCONTEXT_STATIC_NAME}
 
 all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME}
 
@@ -31,10 +32,12 @@ ${LIBUCONTEXT_SONAME}: ${LIBUCONTEXT_NAME}
 	$(CC) -fPIC -DPIC ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
 
 clean:
-	rm -f ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_OBJ} test_libucontext
+	rm -f ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME} \
+		${LIBUCONTEXT_OBJ} test_libucontext
 
 install: all
 	install -D -m755 ${LIBUCONTEXT_NAME} ${DESTDIR}/${LIBUCONTEXT_PATH}
+	install -D -m664 ${LIBUCONTEXT_STATIC_NAME} ${DESTDIR}/${LIBUCONTEXT_STATIC_PATH}
 	ln -sf ${LIBUCONTEXT_SONAME} ${DESTDIR}/lib/${LIBUCONTEXT_NAME}
 
 check: test_libucontext ${LIBUCONTEXT_SONAME}