diff mbox series

Create a shared library for IPC

Message ID 20201029161657.1153978-1-sbabic@denx.de
State Changes Requested
Headers show
Series Create a shared library for IPC | expand

Commit Message

Stefano Babic Oct. 29, 2020, 4:16 p.m. UTC
Generate the IPC library asshared library, too, to be better used by
multiple processes.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 Makefile     | 10 ++++++++--
 lib/Makefile |  7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 lib/Makefile
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index a94c50d..3db7e25 100644
--- a/Makefile
+++ b/Makefile
@@ -358,7 +358,7 @@  include $(srctree)/Makefile.flags
 
 objs-y		:= core handlers
 libs-y		:= corelib ipc mongoose parser suricatta bootloader
-shareds-y	:= bindings
+shareds-y	:= bindings lib
 tools-y		:= tools
 
 swupdate-dirs	:= $(objs-y) $(libs-y)
@@ -372,6 +372,8 @@  tools-bins	:= $(patsubst $(srctree)/$(tools-y)/%.c,$(tools-y)/%,$(wildcard $(src
 tools-bins-unstr:= $(patsubst %,%_unstripped,$(tools-bins))
 tools-all	:= $(tools-objs)
 
+libs 		:= libswupdate.so.0.1
+
 ifeq ($(HAVE_LUA),y)
 lua_swupdate	:= lua_swupdate.so.0.1
 endif
@@ -391,7 +393,7 @@  cfg-sanity-check:
 		exit 1; \
 	fi
 
-all: swupdate ${tools-bins} ${lua_swupdate}
+all: swupdate ${tools-bins} ${lua_swupdate} ${libs}
 
 # Do modpost on a prelinked vmlinux. The finally linked vmlinux has
 # relevant sections renamed as per the linker script.
@@ -431,6 +433,9 @@  quiet_cmd_shared = LD      $@
 lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
 	$(call if_changed,shared)
 
+libswupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
+	$(call if_changed,shared)
+
 ifeq ($(SKIP_STRIP),y)
 quiet_cmd_strip = echo $@
 cmd_strip = cp $@_unstripped $@
@@ -460,6 +465,7 @@  install: all
 	install -m 0644 $(srctree)/include/swupdate_status.h ${DESTDIR}/${INCLUDEDIR}
 	install -m 0644 $(srctree)/include/progress_ipc.h ${DESTDIR}/${INCLUDEDIR}
 	install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
+	install -m 0755 ${libs} ${DESTDIR}/${LIBDIR}
 	if [ $(HAVE_LUA) = y ]; then \
 		install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
 		install -m 0755 ${lua_swupdate} $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
diff --git a/lib/Makefile b/lib/Makefile
new file mode 100644
index 0000000..b6454ee
--- /dev/null
+++ b/lib/Makefile
@@ -0,0 +1,7 @@ 
+# Copyright (C) 2020 Stefano Babic <sbabic@denx.de>
+#
+# SPDX-License-Identifier:     GPL-2.0-or-later
+
+obj-y	+= ../ipc/network_ipc.o ../ipc/network_ipc-if.o ../ipc/progress_ipc.o
+
+EXTRA_CFLAGS += -fPIC