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>,
	Henry Wang <Henry.Wang@arm.com>, Wei Liu <wl@xen.org>,
	George Dunlap <george.dunlap@citrix.com>,
	Nick Rosbrook <rosbrookn@gmail.com>
Subject: [XEN PATCH for-4.17 v5 03/17] tools: Introduce $(xenlibs-ldflags, ) macro
Date: Thu, 13 Oct 2022 14:04:59 +0100	[thread overview]
Message-ID: <20221013130513.52440-4-anthony.perard@citrix.com> (raw)
In-Reply-To: <20221013130513.52440-1-anthony.perard@citrix.com>

This avoid the need to open-coding the list of flags needed to link
with an in-tree Xen library when using -lxen*.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---

Notes:
    missing-ack: GOLANG BINDINGS

 tools/golang/xenlight/Makefile | 2 +-
 tools/Rules.mk                 | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
index 64671f246c..00e6d17f2b 100644
--- a/tools/golang/xenlight/Makefile
+++ b/tools/golang/xenlight/Makefile
@@ -27,7 +27,7 @@ GOXL_GEN_FILES = types.gen.go helpers.gen.go
 # so that it can find the actual library.
 .PHONY: build
 build: xenlight.go $(GOXL_GEN_FILES)
-	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog) $(APPEND_LDFLAGS)" $(GO) build -x
+	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(call xenlibs-ldflags,light toollog) $(APPEND_LDFLAGS)" $(GO) build -x
 
 .PHONY: install
 install: build
diff --git a/tools/Rules.mk b/tools/Rules.mk
index ce77dd2eb1..26958b2948 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -105,6 +105,14 @@ define xenlibs-ldlibs
     $(foreach lib,$(1),$(xenlibs-ldlibs-$(lib)))
 endef
 
+# Provide needed flags for linking an in-tree Xen library by an external
+# project (or when it is necessary to link with "-lxen$(1)" instead of using
+# the full path to the library).
+define xenlibs-ldflags
+    $(call xenlibs-rpath,$(1)) \
+    $(foreach lib,$(1),-L$(XEN_ROOT)/tools/libs/$(lib))
+endef
+
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
-- 
Anthony PERARD



  parent reply	other threads:[~2022-10-13 13:05 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 13:04 [XEN PATCH for-4.17 v5 00/17] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
2022-10-13 13:04 ` [XEN PATCH for-4.17 v5 01/17] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
2022-10-13 13:04 ` [XEN PATCH for-4.17 v5 02/17] tools/xentrace: rework Makefile Anthony PERARD
2022-10-13 13:04 ` Anthony PERARD [this message]
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 04/17] tools: Add -Werror by default to all tools/ Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 05/17] tools: Remove -Werror everywhere else Anthony PERARD
2022-10-13 15:13   ` Andrew Cooper
2022-10-14 10:16     ` Anthony PERARD
2022-10-14 15:06   ` Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 06/17] tools/hotplug: Generate "hotplugpath.sh" with configure Anthony PERARD
2022-10-14 18:03   ` Andrew Cooper
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 07/17] libs/light/gentypes.py: allow to generate headers in subdirectory Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 08/17] git-checkout.sh: handle running git-checkout from a different directory Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 09/17] libs: Avoid exposing -Wl,--version-script to other built library Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 10/17] libs: Fix auto-generation of version-script for unstable libs Anthony PERARD
2022-10-14 18:16   ` Andrew Cooper
2022-10-17 14:19     ` Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 11/17] tools/include: Rework Makefile Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 12/17] libs/light: Rework acpi table build targets Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 13/17] libs/light: Rework generation of include/_libxl_*.h Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 14/17] libs/light: Rework targets prerequisites Anthony PERARD
2022-10-14 19:35   ` Andrew Cooper
2022-10-17 14:39     ` Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 15/17] libs/light: Makefile cleanup Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 16/17] tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go Anthony PERARD
2022-10-13 15:00   ` Andrew Cooper
2022-10-14 11:24     ` George Dunlap
2022-10-14 11:37       ` Andrew Cooper
2022-10-14 11:42         ` George Dunlap
2022-10-14 11:51           ` Andrew Cooper
2022-10-14 11:25   ` George Dunlap
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 17/17] tools: Rework linking options for ocaml binding libraries Anthony PERARD
2022-10-13 18:02 ` [XEN PATCH for-4.17 v5 00/17] Toolstack build system improvement, toward non-recursive makefiles Andrew Cooper
2022-10-14  6:26   ` Henry Wang
2022-10-14 10:14     ` Anthony PERARD
2022-10-14 10:28       ` Henry Wang
2022-10-14 10:31       ` Andrew Cooper
2022-10-14 10:39         ` Henry Wang
2022-10-14 12:55 ` 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=20221013130513.52440-4-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=Henry.Wang@arm.com \
    --cc=george.dunlap@citrix.com \
    --cc=rosbrookn@gmail.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.