tools: Introduce $(xenlibs-ldlibs, ) macro

This can be used when linking against multiple in-tree Xen libraries,
and avoid duplicated flags. It can be used instead of multiple
$(LDLIBS_libxen*).

For now, replace the open-coding in libs.mk.

The macro $(xenlibs-libs, ) will be useful later when only the path to
the libraries is wanted (e.g. for checking for dependencies).

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
Anthony PERARD authored and Jan Beulich committed 2022-08-22 12:09:07 +02:00
1 parent d2b396d47b
commit 7f2a5e368e
2 files changed
+15 -3

No files matched your search

+14 -2
View File
@@ -93,12 +93,24 @@ define xenlibs-rpath
$(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
endef
# Provide a path for each library in $(1)
define xenlibs-libs
$(foreach lib,$(1), \
$(XEN_ROOT)/tools/libs/$(lib)/lib$(FILENAME_$(lib))$(libextension))
endef
# Flags for linking against all Xen libraries listed in $(1)
define xenlibs-ldlibs
$(call xenlibs-rpath,$(1)) $(call xenlibs-libs,$(1)) \
$(foreach lib,$(1),$(xenlibs-ldlibs-$(lib)))
endef
define LIB_defs
FILENAME_$(1) ?= xen$(1)
XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
SHLIB_libxen$(1) = $$(call xenlibs-rpath,$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
LDLIBS_libxen$(1) = $$(call xenlibs-rpath,$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
LDLIBS_libxen$(1) = $$(call xenlibs-ldlibs,$(1))
endef
$(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
@@ -108,7 +120,7 @@ $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
CFLAGS_libxenctrl += -D__XEN_TOOLS__
ifeq ($(CONFIG_Linux),y)
LDLIBS_libxenstore += -ldl
xenlibs-ldlibs-store := -ldl
endif
CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.