All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>, Wei Liu <wl@xen.org>,
	"Juergen Gross" <jgross@suse.com>
Subject: [XEN PATCH v3 18/25] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
Date: Fri, 24 Jun 2022 17:04:15 +0100	[thread overview]
Message-ID: <20220624160422.53457-19-anthony.perard@citrix.com> (raw)
In-Reply-To: <20220624160422.53457-1-anthony.perard@citrix.com>

This patch introduce a new macro $(xenlibs-dependencies,) to generate
a list of all the xen library that a library is list against, and they
are listed only once. We use the side effect of $(sort ) which remove
duplicates.

This is used by another macro $(xenlibs-rpath,) which is to replace
$(SHDEPS_libxen*).

In libs.mk, we don't need to $(sort ) SHLIB_lib* anymore as this was used
to remove duplicates and they are no more duplicates.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/Rules.mk     | 29 ++++++++++++++++-------------
 tools/libs/libs.mk |  2 +-
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 47424935ba..23979ed254 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -61,13 +61,8 @@ endif
 #           public headers. Users of libfoo are therefore transitively
 #           using libbaz's header but not linking against libbaz.
 #
-# SHDEPS_libfoo: Flags for linking recursive dependencies of
-#                libfoo. Must contain SHLIB for every library which
-#                libfoo links against. So must contain both
-#                $(SHLIB_libbar) and $(SHLIB_libbaz).
-#
 # SHLIB_libfoo: Flags for recursively linking against libfoo. Must
-#               contains SHDEPS_libfoo and:
+#               contains $(call xenlibs-rpath,foo) and:
 #                   -Wl,-rpath-link=<directory containing libfoo.so>
 #
 # CFLAGS_libfoo: Flags for compiling against libfoo. Must add the
@@ -79,23 +74,31 @@ endif
 #                libfoo.
 #
 # LDLIBS_libfoo: Flags for linking against libfoo. Must contain
-#                $(SHDEPS_libfoo) and the path to libfoo.so
+#                $(call xenlibs-rpath,foo) and the path to libfoo.so
 #
 # Consumers of libfoo should include $(CFLAGS_libfoo) and
 # $(LDLIBS_libfoo) in their appropriate directories. They should not
 # include any CFLAGS or LDLIBS relating to libbar or libbaz unless
 # they use those libraries directly (not via libfoo) too.
-#
-# Consumers of libfoo should not directly use $(SHDEPS_libfoo) or
-# $(SHLIB_libfoo)
+
+# Give the list of Xen library that the libraries in $(1) are linked against,
+# directly or indirectly.
+define xenlibs-dependencies
+    $(sort $(foreach lib,$(1), \
+        $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
+endef
+
+# Flags for linking recursive dependencies of Xen libraries in $(1)
+define xenlibs-rpath
+    $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
+endef
 
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
  CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
- SHDEPS_libxen$(1) = $$(foreach use,$$(USELIBS_$(1)),$$(SHLIB_libxen$$(use)))
- LDLIBS_libxen$(1) = $$(SHDEPS_libxen$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
- SHLIB_libxen$(1) = $$(SHDEPS_libxen$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
+ 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)
 endef
 
 $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index f778a7df82..d7e1274249 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -32,7 +32,7 @@ PKG_CONFIG ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-PKG_CONFIG_USELIBS := $(sort $(SHLIB_libxen$(LIBNAME)))
+PKG_CONFIG_USELIBS := $(SHLIB_libxen$(LIBNAME))
 PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
-- 
Anthony PERARD



  parent reply	other threads:[~2022-06-24 16:08 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 16:03 [XEN PATCH v3 00/25] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
2022-06-24 16:03 ` [XEN PATCH v3 01/25] tools/console: have one Makefile per program/directory Anthony PERARD
2022-07-08 15:08   ` Luca Fancellu
2022-06-24 16:03 ` [XEN PATCH v3 02/25] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
2022-07-08 15:23   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 03/25] tools/examples: cleanup Makefile Anthony PERARD
2022-07-08 15:31   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 04/25] tools/firmware/hvmloader: rework Makefile Anthony PERARD
2022-07-08 15:39   ` Luca Fancellu
2022-07-11 13:38     ` Anthony PERARD
2022-07-11 13:40       ` Luca Fancellu
2022-07-11 13:41     ` Jan Beulich
2022-07-11 13:52   ` Jan Beulich
2022-07-11 17:01     ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 05/25] tools/fuzz/libelf: rework makefile Anthony PERARD
2022-07-11 11:23   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 06/25] tools/fuzz/x86_instruction_emulator: " Anthony PERARD
2022-07-11 13:16   ` Luca Fancellu
2022-07-11 14:08   ` Jan Beulich
2022-08-02 17:09     ` Anthony PERARD
2022-08-03  5:56       ` Jan Beulich
2022-08-03 10:15         ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 07/25] tools/hotplug: cleanup Makefiles Anthony PERARD
2022-07-22 11:02   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 08/25] tools/libfsimage: Cleanup makefiles Anthony PERARD
2022-07-22 12:07   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 09/25] tools/xenpaging: Rework makefile Anthony PERARD
2022-07-22 12:17   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 10/25] tools/xentop: rework makefile Anthony PERARD
2022-07-22 13:13   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 11/25] tools/xentrace: rework Makefile Anthony PERARD
2022-07-22 13:30   ` Luca Fancellu
2022-08-08 15:35     ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 12/25] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc} Anthony PERARD
2022-06-29 10:15   ` Juergen Gross
2022-07-05 13:17   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 13/25] tools/libs/util: cleanup Makefile Anthony PERARD
2022-06-29 10:18   ` Juergen Gross
2022-07-05 13:20   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 14/25] tools/flask/utils: list build targets in $(TARGETS) Anthony PERARD
2022-07-12  1:30   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 15/25] libs/libs.mk: Rename $(LIB) to $(TARGETS) Anthony PERARD
2022-06-29 10:19   ` Juergen Gross
2022-07-05 13:21   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 16/25] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST) Anthony PERARD
2022-06-29 10:22   ` Juergen Gross
2022-07-05 13:27   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 17/25] libs/libs.mk: Rework target headers.chk dependencies Anthony PERARD
2022-06-29 10:23   ` Juergen Gross
2022-07-05 13:29   ` Bertrand Marquis
2022-06-24 16:04 ` Anthony PERARD [this message]
2022-06-29 10:26   ` [XEN PATCH v3 18/25] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*) Juergen Gross
2022-06-24 16:04 ` [XEN PATCH v3 19/25] tools: Introduce $(xenlibs-ldlibs, ) macro Anthony PERARD
2022-06-29 10:29   ` Juergen Gross
2022-06-24 16:04 ` [XEN PATCH v3 20/25] tools: Introduce $(xenlibs-ldflags, " Anthony PERARD
2022-07-12  1:40   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 21/25] tools/helper: Cleanup Makefile Anthony PERARD
2022-07-22 14:06   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 22/25] tools/console: Use $(xenlibs-ldlibs,) Anthony PERARD
2022-07-22 14:15   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 23/25] tools/helpers: Fix build of xen-init-dom0 with -Werror Anthony PERARD
2022-07-12  1:31   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 24/25] tools: Add -Werror by default to all tools/ Anthony PERARD
2022-07-22 14:31   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 25/25] tools: Remove -Werror everywhere else Anthony PERARD
2022-06-29  8:59   ` Luca Fancellu
2022-06-29 17:22     ` Stefano Stabellini
2022-06-30  7:33       ` Bertrand Marquis
2022-06-30 21:03         ` Stefano Stabellini
2022-07-01 13:26           ` Bertrand Marquis
2022-07-01 17:47             ` Stefano Stabellini
2022-06-29 10:31   ` Juergen Gross
2022-06-27  7:25 ` [XEN PATCH v3 00/25] Toolstack build system improvement, toward non-recursive makefiles Christian Lindig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220624160422.53457-19-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=jgross@suse.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.