[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
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |