nmk: build.mk -- Add @libso-y helper

To link dynamic libs (libcompel for example).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov 2016-03-24 21:25:41 +03:00 committed by Pavel Emelyanov
parent 4a19618ea2
commit 6094b643dc

View file

@ -16,6 +16,7 @@ ld_flags :=
cleanup-y :=
mrproper-y :=
objdirs :=
libso-y :=
MAKECMDGOALS := $(call uniq,$(MAKECMDGOALS))
@ -219,6 +220,17 @@ cleanup-y += $(obj)/$(1)
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