From: Mike Engel <Mike.Engel@digi.com>
Date: Mon, 28 Jun 2021 18:45:20 +0200
Subject: [PATCH] Makefile: change Makefile to build swupdate library
 statically

Signed-off-by: Mike Engel <Mike.Engel@digi.com>
---
 Makefile                    | 2 ++
 ipc-static/Makefile         | 6 ++++++
 ipc-static/network_ipc-if.c | 1 +
 ipc-static/network_ipc.c    | 1 +
 ipc-static/progress_ipc.c   | 1 +
 5 files changed, 11 insertions(+)
 create mode 100644 ipc-static/Makefile
 create mode 120000 ipc-static/network_ipc-if.c
 create mode 120000 ipc-static/network_ipc.c
 create mode 120000 ipc-static/progress_ipc.c

diff --git a/Makefile b/Makefile
index 09d03a3..f34810b 100644
--- a/Makefile
+++ b/Makefile
@@ -364,6 +364,7 @@ include $(srctree)/Makefile.flags
 
 objs-y		:= core handlers bootloader suricatta
 libs-y		:= corelib mongoose parser fs
+libs-y		+= ipc-static
 bindings-y	:= bindings
 tools-y		:= tools
 
@@ -480,6 +481,7 @@ install: all
 	install -m 0644 $(srctree)/include/progress_ipc.h ${DESTDIR}/${INCLUDEDIR}
 	install -m 0755 $(objtree)/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}
 	ln -sfr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}/libswupdate.so
+	install -m 0755 ipc-static/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
 	if [ $(HAVE_LUA) = y ]; then \
 		install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
 		install -m 0755 ${lua_swupdate} $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
diff --git a/ipc-static/Makefile b/ipc-static/Makefile
new file mode 100644
index 0000000..99cce6c
--- /dev/null
+++ b/ipc-static/Makefile
@@ -0,0 +1,6 @@
+# Copyright (C) 2021 Digi International Inc.
+#
+# SPDX-License-Identifier:     GPL-2.0-only
+lib-y			+= network_ipc.o network_ipc-if.o progress_ipc.o
+
+EXTRA_CFLAGS += -fPIC
diff --git a/ipc-static/network_ipc-if.c b/ipc-static/network_ipc-if.c
new file mode 120000
index 0000000..37894e2
--- /dev/null
+++ b/ipc-static/network_ipc-if.c
@@ -0,0 +1 @@
+../ipc/network_ipc-if.c
\ No newline at end of file
diff --git a/ipc-static/network_ipc.c b/ipc-static/network_ipc.c
new file mode 120000
index 0000000..0640077
--- /dev/null
+++ b/ipc-static/network_ipc.c
@@ -0,0 +1 @@
+../ipc/network_ipc.c
\ No newline at end of file
diff --git a/ipc-static/progress_ipc.c b/ipc-static/progress_ipc.c
new file mode 120000
index 0000000..7c6622c
--- /dev/null
+++ b/ipc-static/progress_ipc.c
@@ -0,0 +1 @@
+../ipc/progress_ipc.c
\ No newline at end of file
