[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH for-4.17 v6 4/5] tools: Introduce macro $(xenlibs-cflags,) and introduce $(USELIBS) in subdirs


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Fri, 20 Jan 2023 19:44:30 +0000
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 20 Jan 2023 19:45:09 +0000
  • Ironport-data: A9a23:SxzEw6OQwPfn1tDvrR2gl8FynXyQoLVcMsEvi/4bfWQNrUonhGFWn 2AbWmCPPfbcZmT3e9BzYdvg80JTvZ6HxoRrHQto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQA+KmU4YoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9Suv3rRC9H5qyo42tB5ARmPpingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0ux8AiZD+ tlCETQiMzre29qr3pOeWsA506zPLOGzVG8eknRpzDWfBvc6W5HTBa7N4Le03h9p2JoIR6yHI ZNEN3w2Nk+ojx5nYz/7DLo3mvuogX/uNSVVsluPqYI84nTJzRw327/oWDbQUo3RHZ8NwhjBz o7A10DoIzsxJO2Y9X2q83aJp9eXlyb2Y41HQdVU8dY12QbOlwT/EiY+RVa95PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yFabujYMVtwWFPc1gDxh0YKNvVzfXDJdCGccNpp/7pReqSEWO kGhldjqQjFgleesTV3A3O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QI/tlltdEk6y5QKCuPTyISVgoncflq/IDAtfDU/ L2PJ5NGffsIWbnBI4MhmTFKtlvAGhbVNdQtscwWlqIrM6OIor2tvbDePKWILb2Cz4rVm72H3 NGVjnuI8dL6FytRxbD8VnscmKofla68YN7EaDc8eRWwI8RNpdUugxQkli97tHjE0wOjkX3Rj o1HFrKqNLxmYDtxxeA04xAAGsUMnpo
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Introduce $(xenlibs-cflags,) to get the CFLAGS needed to build with
the xen library listed as argument. This mainly give the ability to
use the same list of xen libs as we can use with the other macro
$(xenlibs-ldlibs,). Also, we can avoid listing $(CFLAGS_xeninclude)
more than once.

We will use $(USELIBS) to list the xen libraries been used by a
subdirectory or a binary. Since we usually want the CFLAGS, LDFLAGS
and LDLIBS of possibly several xen libs, we don't need to duplicate
the list for each flags. This change to use $(USELIBS) is only done in
console/ and helpers/ for now as those already use the
$(xenlibs-ldlibs,) macro

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---

Notes:
    v6:
    - new patch

 tools/console/client/Makefile |  7 ++++---
 tools/console/daemon/Makefile | 10 ++++------
 tools/helpers/Makefile        | 26 +++++++++-----------------
 tools/Rules.mk                |  6 ++++++
 4 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/tools/console/client/Makefile b/tools/console/client/Makefile
index 62d89fdeb9..071262c9ae 100644
--- a/tools/console/client/Makefile
+++ b/tools/console/client/Makefile
@@ -1,11 +1,12 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += $(CFLAGS_libxenstore)
+USELIBS := ctrl store
+
+CFLAGS += $(call xenlibs-cflags,$(USELIBS))
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-LDLIBS += $(call xenlibs-ldlibs,ctrl store)
+LDLIBS += $(call xenlibs-ldlibs,$(USELIBS))
 LDLIBS += $(SOCKET_LIBS)
 
 OBJS-y := main.o
diff --git a/tools/console/daemon/Makefile b/tools/console/daemon/Makefile
index 9fc3b6711f..e53c874eee 100644
--- a/tools/console/daemon/Makefile
+++ b/tools/console/daemon/Makefile
@@ -1,15 +1,13 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += $(CFLAGS_libxenstore)
-CFLAGS += $(CFLAGS_libxenevtchn)
-CFLAGS += $(CFLAGS_libxengnttab)
-CFLAGS += $(CFLAGS_libxenforeignmemory)
+USELIBS := ctrl store evtchn gnttab foreignmemory
+
+CFLAGS += $(call xenlibs-cflags,$(USELIBS))
 CFLAGS-$(CONFIG_ARM) += -DCONFIG_ARM
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-LDLIBS += $(call xenlibs-ldlibs,ctrl store evtchn gnttab foreignmemory)
+LDLIBS += $(call xenlibs-ldlibs,$(USELIBS))
 LDLIBS += $(SOCKET_LIBS)
 LDLIBS += $(UTIL_LIBS)
 LDLIBS += -lrt
diff --git a/tools/helpers/Makefile b/tools/helpers/Makefile
index 09590eb5b6..0d4df01365 100644
--- a/tools/helpers/Makefile
+++ b/tools/helpers/Makefile
@@ -15,29 +15,21 @@ TARGETS += init-dom0less
 endif
 endif
 
+XEN_INIT_DOM0_USELIBS := ctrl toollog store light
 XEN_INIT_DOM0_OBJS = xen-init-dom0.o init-dom-json.o
-$(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
-$(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenstore)
-$(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenlight)
-$(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
-xen-init-dom0: LDLIBS += $(call xenlibs-ldlibs,ctrl toollog store light)
+$(XEN_INIT_DOM0_OBJS): CFLAGS += $(call 
xenlibs-cflags,$(XEN_INIT_DOM0_USELIBS))
+xen-init-dom0: LDLIBS += $(call xenlibs-ldlibs,$(XEN_INIT_DOM0_USELIBS))
 
+INIT_XENSTORE_DOMAIN_USELIBS := toollog store ctrl guest light
 INIT_XENSTORE_DOMAIN_OBJS = init-xenstore-domain.o init-dom-json.o
-$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
-$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenguest)
-$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
-$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenstore)
-$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenlight)
+$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(call 
xenlibs-cflags,$(INIT_XENSTORE_DOMAIN_USELIBS))
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h
-init-xenstore-domain: LDLIBS += $(call xenlibs-ldlibs,toollog store ctrl guest 
light)
+init-xenstore-domain: LDLIBS += $(call 
xenlibs-ldlibs,$(INIT_XENSTORE_DOMAIN_USELIBS))
 
+INIT_DOM0LESS_USELIBS := ctrl evtchn toollog store light guest foreignmemory
 INIT_DOM0LESS_OBJS = init-dom0less.o init-dom-json.o
-$(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
-$(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenstore)
-$(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenlight)
-$(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
-$(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenevtchn)
-init-dom0less: LDLIBS += $(call xenlibs-ldlibs,ctrl evtchn toollog store light 
guest foreignmemory)
+$(INIT_DOM0LESS_OBJS): CFLAGS += $(call 
xenlibs-cflags,$(INIT_DOM0LESS_USELIBS))
+init-dom0less: LDLIBS += $(call xenlibs-ldlibs,$(INIT_DOM0LESS_USELIBS))
 
 .PHONY: all
 all: $(TARGETS)
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 6e135387bd..d7c1f61cdf 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -88,6 +88,12 @@ define xenlibs-dependencies
         $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
 endef
 
+define xenlibs-cflags
+    $(CFLAGS_xeninclude) \
+    $(foreach lib,$(1), \
+       $(filter-out $(CFLAGS_xeninclude),$(CFLAGS_libxen$(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)))
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.