[CRIU] [PATCH 09/10] nmk: build.mk -- Add @libso-y helper

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 24 11:25:41 PDT 2016


To link dynamic libs (libcompel for example).

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 scripts/nmk/scripts/build.mk | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index fa5203981063..bd409441293e 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -16,6 +16,7 @@ ld_flags	:=
 cleanup-y	:=
 mrproper-y	:=
 objdirs		:=
+libso-y	        :=
 
 MAKECMDGOALS := $(call uniq,$(MAKECMDGOALS))
 
@@ -220,6 +221,17 @@ endef
 $(foreach t,$(hostprogs-y),$(eval $(call gen-host-rules,$(t))))
 
 #
+# Dynamic library linking.
+define gen-so-link-rules
+$(call objectify,$(1)).so:  $(call objectify,$($(1)-objs)) $(src-makefile)
+	$$(call msg-link, $$@)
+	$$(Q) $$(CC) -shared $$(ldflags-so) $$(LDFLAGS) $$(LDFLAGS_$$(@F)) -o $$@ $(call objectify,$($(1)-objs))
+all-y += $(call objectify,$(1)).so
+cleanup-y += $(call objectify,$(1)).so
+endef
+$(foreach t,$(libso-y),$(eval $(call gen-so-link-rules,$(t))))
+
+#
 # Figure out if the target we're building needs deps to include.
 define collect-deps
         ifneq ($(filter-out %.d,$(1)),)
-- 
2.5.5



More information about the CRIU mailing list