mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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:
1 parent
d2b396d47b
commit
7f2a5e368e
2 files changed
+15
-3
No files matched your search
+14
-2
@@ -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)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ CFLAGS += -Werror -Wmissing-prototypes
|
||||
CFLAGS += $(CFLAGS_xeninclude)
|
||||
CFLAGS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
|
||||
|
||||
LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
|
||||
LDLIBS += $(call xenlibs-ldlibs,$(USELIBS_$(LIBNAME)))
|
||||
|
||||
PIC_OBJS := $(OBJS-y:.o=.opic)
|
||||
|
||||
|
||||