From nobody Mon Feb 9 16:02:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1597496668; cv=none; d=zohomail.com; s=zohoarc; b=Ikal3CTWCyxUO3NTZjWqnJPn/amhfLKFWHJ/2TMtnGjcKuy7wtwssIGKe3FEurWnc1gvaOGClBzWcVuG95i4dFkLbpWo3kvKUXos/q+zBsJBFg9jabWVb8N3QVD3ZgnH8UVGB1HTsykUws2dJcshgemAWnGZ1a/lDBAJxyai/6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597496668; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Cb/91x2qmXDogvL7WrAGNZgREGg15vQJJswZ+hM4jCM=; b=N38O6kSo2uekeFV9jOUwzi5OzYomR3Suy7Yi1CkiXqYo7CwiJnY+9RKC2rhq77uTl+N+/m2oVA66ouHCQElkfVa/ky9gErTI7llORsEmZ3F8a1zP/Qlp4khwQZuJAOYqGM6O17V+yPrB3CI81mHRE46BmPa3FptyGX5HcS2/PXo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 15974966682331004.9543371899122; Sat, 15 Aug 2020 06:04:28 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k6vqz-0006V7-Co; Sat, 15 Aug 2020 13:04:09 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k6vqy-0006R1-64 for xen-devel@lists.xenproject.org; Sat, 15 Aug 2020 13:04:08 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 36133b7e-3190-42d0-857b-32e0418b48e3; Sat, 15 Aug 2020 13:03:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8A595B584; Sat, 15 Aug 2020 13:04:14 +0000 (UTC) X-Inumbo-ID: 36133b7e-3190-42d0-857b-32e0418b48e3 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu Subject: [PATCH I v2 6/6] tools: generate most contents of library make variables Date: Sat, 15 Aug 2020 15:03:41 +0200 Message-Id: <20200815130341.27147-7-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200815130341.27147-1-jgross@suse.com> References: <20200815130341.27147-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Type: text/plain; charset="utf-8" Library related make variables (CFLAGS_lib*, SHDEPS_lib*, LDLIBS_lib* and SHLIB_lib*) mostly have a common pattern for their values. Generate most of this content automatically by adding a new per-library variable defining on which other libraries a lib is depending. This in turn makes it possible to drop the USELIB variable from each library Makefile. The LIBNAME variable can be dropped, too, as it can be derived from the directory name the library is residing in. Signed-off-by: Juergen Gross --- tools/Rules.mk | 70 ++++++++++--------------------- tools/libs/call/Makefile | 2 - tools/libs/devicemodel/Makefile | 2 - tools/libs/evtchn/Makefile | 2 - tools/libs/foreignmemory/Makefile | 2 - tools/libs/gnttab/Makefile | 2 - tools/libs/hypfs/Makefile | 2 - tools/libs/libs.mk | 8 ++-- tools/libs/toolcore/Makefile | 1 - tools/libs/toollog/Makefile | 1 - 10 files changed, 27 insertions(+), 65 deletions(-) diff --git a/tools/Rules.mk b/tools/Rules.mk index 5d699cfd39..06827ad1d8 100644 --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -12,14 +12,24 @@ INSTALL =3D $(XEN_ROOT)/tools/cross-install LDFLAGS +=3D $(PREPEND_LDFLAGS_XEN_TOOLS) =20 XEN_INCLUDE =3D $(XEN_ROOT)/tools/include -XEN_libxentoolcore =3D $(XEN_ROOT)/tools/libs/toolcore -XEN_libxentoollog =3D $(XEN_ROOT)/tools/libs/toollog -XEN_libxenevtchn =3D $(XEN_ROOT)/tools/libs/evtchn -XEN_libxengnttab =3D $(XEN_ROOT)/tools/libs/gnttab -XEN_libxencall =3D $(XEN_ROOT)/tools/libs/call -XEN_libxenforeignmemory =3D $(XEN_ROOT)/tools/libs/foreignmemory -XEN_libxendevicemodel =3D $(XEN_ROOT)/tools/libs/devicemodel -XEN_libxenhypfs =3D $(XEN_ROOT)/tools/libs/hypfs + +LIBS_LIBS +=3D toolcore +USELIBS_toolcore :=3D +LIBS_LIBS +=3D toollog +USELIBS_toollog :=3D +LIBS_LIBS +=3D evtchn +USELIBS_evtchn :=3D toollog toolcore +LIBS_LIBS +=3D gnttab +USELIBS_gnttab :=3D toollog toolcore +LIBS_LIBS +=3D call +USELIBS_call :=3D toollog toolcore +LIBS_LIBS +=3D foreignmemory +USELIBS_foreignmemory :=3D toollog toolcore +LIBS_LIBS +=3D devicemodel +USELIBS_devicemodel :=3D toollog toolcore call +LIBS_LIBS +=3D hypfs +USELIBS_hypfs :=3D toollog toolcore call + XEN_libxenctrl =3D $(XEN_ROOT)/tools/libxc # Currently libxenguest lives in the same directory as libxenctrl XEN_libxenguest =3D $(XEN_libxenctrl) @@ -99,45 +109,11 @@ endif # Consumers of libfoo should not directly use $(SHDEPS_libfoo) or # $(SHLIB_libfoo) =20 -CFLAGS_libxentoollog =3D -I$(XEN_libxentoollog)/include $(CFLAGS_xeninclud= e) -SHDEPS_libxentoollog =3D -LDLIBS_libxentoollog =3D $(SHDEPS_libxentoollog) $(XEN_libxentoollog)/libx= entoollog$(libextension) -SHLIB_libxentoollog =3D $(SHDEPS_libxentoollog) -Wl,-rpath-link=3D$(XEN_l= ibxentoollog) - -CFLAGS_libxentoolcore =3D -I$(XEN_libxentoolcore)/include $(CFLAGS_xenincl= ude) -SHDEPS_libxentoolcore =3D -LDLIBS_libxentoolcore =3D $(SHDEPS_libxentoolcore) $(XEN_libxentoolcore)/l= ibxentoolcore$(libextension) -SHLIB_libxentoolcore =3D $(SHDEPS_libxentoolcore) -Wl,-rpath-link=3D$(XEN= _libxentoolcore) - -CFLAGS_libxenevtchn =3D -I$(XEN_libxenevtchn)/include $(CFLAGS_xeninclude) -SHDEPS_libxenevtchn =3D $(SHLIB_libxentoolcore) -LDLIBS_libxenevtchn =3D $(SHDEPS_libxenevtchn) $(XEN_libxenevtchn)/libxene= vtchn$(libextension) -SHLIB_libxenevtchn =3D $(SHDEPS_libxenevtchn) -Wl,-rpath-link=3D$(XEN_lib= xenevtchn) - -CFLAGS_libxengnttab =3D -I$(XEN_libxengnttab)/include $(CFLAGS_xeninclude) -SHDEPS_libxengnttab =3D $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) -LDLIBS_libxengnttab =3D $(SHDEPS_libxengnttab) $(XEN_libxengnttab)/libxeng= nttab$(libextension) -SHLIB_libxengnttab =3D $(SHDEPS_libxengnttab) -Wl,-rpath-link=3D$(XEN_lib= xengnttab) - -CFLAGS_libxencall =3D -I$(XEN_libxencall)/include $(CFLAGS_xeninclude) -SHDEPS_libxencall =3D $(SHLIB_libxentoolcore) -LDLIBS_libxencall =3D $(SHDEPS_libxencall) $(XEN_libxencall)/libxencall$(l= ibextension) -SHLIB_libxencall =3D $(SHDEPS_libxencall) -Wl,-rpath-link=3D$(XEN_libxenc= all) - -CFLAGS_libxenforeignmemory =3D -I$(XEN_libxenforeignmemory)/include $(CFLA= GS_xeninclude) -SHDEPS_libxenforeignmemory =3D $(SHLIB_libxentoolcore) -LDLIBS_libxenforeignmemory =3D $(SHDEPS_libxenforeignmemory) $(XEN_libxenf= oreignmemory)/libxenforeignmemory$(libextension) -SHLIB_libxenforeignmemory =3D $(SHDEPS_libxenforeignmemory) -Wl,-rpath-li= nk=3D$(XEN_libxenforeignmemory) - -CFLAGS_libxendevicemodel =3D -I$(XEN_libxendevicemodel)/include $(CFLAGS_x= eninclude) -SHDEPS_libxendevicemodel =3D $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore= ) $(SHLIB_libxencall) -LDLIBS_libxendevicemodel =3D $(SHDEPS_libxendevicemodel) $(XEN_libxendevic= emodel)/libxendevicemodel$(libextension) -SHLIB_libxendevicemodel =3D $(SHDEPS_libxendevicemodel) -Wl,-rpath-link= =3D$(XEN_libxendevicemodel) - -CFLAGS_libxenhypfs =3D -I$(XEN_libxenhypfs)/include $(CFLAGS_xeninclude) -SHDEPS_libxenhypfs =3D $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SH= LIB_libxencall) -LDLIBS_libxenhypfs =3D $(SHDEPS_libxenhypfs) $(XEN_libxenhypfs)/libxenhypf= s$(libextension) -SHLIB_libxenhypfs =3D $(SHDEPS_libxenhypfs) -Wl,-rpath-link=3D$(XEN_libxe= nhypfs) +$(foreach lib,$(LIBS_LIBS),$(eval XEN_libxen$(lib) =3D $(XEN_ROOT)/tools/l= ibs/$(lib))) +$(foreach lib,$(LIBS_LIBS),$(eval CFLAGS_libxen$(lib) =3D -I$(XEN_libxen$(= lib))/include $(CFLAGS_xeninclude))) +$(foreach lib,$(LIBS_LIBS),$(eval SHDEPS_libxen$(lib) =3D $(foreach use,$(= USELIBS_$(lib)),$(SHLIB_libxen$(use))))) +$(foreach lib,$(LIBS_LIBS),$(eval LDLIBS_libxen$(lib) =3D $(SHDEPS_libxen$= (lib)) $(XEN_libxen$(lib))/libxen$(lib)$(libextension))) +$(foreach lib,$(LIBS_LIBS),$(eval SHLIB_libxen$(lib) =3D $(SHDEPS_libxen$(= lib)) -Wl,-rpath-link=3D$(XEN_libxen$(lib)))) =20 # code which compiles against libxenctrl get __XEN_TOOLS__ and # therefore sees the unstable hypercall interfaces. diff --git a/tools/libs/call/Makefile b/tools/libs/call/Makefile index 7994b411fa..81c7478efd 100644 --- a/tools/libs/call/Makefile +++ b/tools/libs/call/Makefile @@ -3,8 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 1 MINOR =3D 2 -LIBNAME :=3D call -USELIBS :=3D toollog toolcore =20 SRCS-y +=3D core.c buffer.c SRCS-$(CONFIG_Linux) +=3D linux.c diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makef= ile index d9d1d1b850..42417958f2 100644 --- a/tools/libs/devicemodel/Makefile +++ b/tools/libs/devicemodel/Makefile @@ -3,8 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 1 MINOR =3D 3 -LIBNAME :=3D devicemodel -USELIBS :=3D toollog toolcore call =20 SRCS-y +=3D core.c SRCS-$(CONFIG_Linux) +=3D linux.c diff --git a/tools/libs/evtchn/Makefile b/tools/libs/evtchn/Makefile index d7aa4d402f..aec76641e8 100644 --- a/tools/libs/evtchn/Makefile +++ b/tools/libs/evtchn/Makefile @@ -3,8 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 1 MINOR =3D 1 -LIBNAME :=3D evtchn -USELIBS :=3D toollog toolcore =20 SRCS-y +=3D core.c SRCS-$(CONFIG_Linux) +=3D linux.c diff --git a/tools/libs/foreignmemory/Makefile b/tools/libs/foreignmemory/M= akefile index 823989681d..cf444d3c1a 100644 --- a/tools/libs/foreignmemory/Makefile +++ b/tools/libs/foreignmemory/Makefile @@ -3,8 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 1 MINOR =3D 3 -LIBNAME :=3D foreignmemory -USELIBS :=3D toollog toolcore =20 SRCS-y +=3D core.c SRCS-$(CONFIG_Linux) +=3D linux.c diff --git a/tools/libs/gnttab/Makefile b/tools/libs/gnttab/Makefile index c0fffdac71..d8d4d55e27 100644 --- a/tools/libs/gnttab/Makefile +++ b/tools/libs/gnttab/Makefile @@ -3,8 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 1 MINOR =3D 2 -LIBNAME :=3D gnttab -USELIBS :=3D toollog toolcore =20 SRCS-GNTTAB +=3D gnttab_core.c SRCS-GNTSHR +=3D gntshr_core.c diff --git a/tools/libs/hypfs/Makefile b/tools/libs/hypfs/Makefile index b4c41f6189..668d68853f 100644 --- a/tools/libs/hypfs/Makefile +++ b/tools/libs/hypfs/Makefile @@ -3,8 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 1 MINOR =3D 0 -LIBNAME :=3D hypfs -USELIBS :=3D toollog toolcore call =20 APPEND_LDFLAGS +=3D -lz =20 diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk index 764f5441e2..19efc5e743 100644 --- a/tools/libs/libs.mk +++ b/tools/libs/libs.mk @@ -1,18 +1,18 @@ # Common Makefile for building a lib. # # Variables taken as input: -# LIBNAME: name of lib to build, will be prepended with "libxen" # MAJOR: major version of lib # MINOR: minor version of lib -# USELIBS: xen libs to use (e.g. "toolcore toollog") + +LIBNAME :=3D $(notdir $(CURDIR)) =20 SHLIB_LDFLAGS +=3D -Wl,--version-script=3Dlibxen$(LIBNAME).map =20 CFLAGS +=3D -Werror -Wmissing-prototypes CFLAGS +=3D -I./include $(CFLAGS_xeninclude) -CFLAGS +=3D $(foreach lib, $(USELIBS), $(CFLAGS_libxen$(lib))) +CFLAGS +=3D $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib))) =20 -LDUSELIBS =3D $(foreach lib, $(USELIBS), $(LDLIBS_libxen$(lib))) +LDUSELIBS =3D $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib))) =20 LIB_OBJS :=3D $(SRCS-y:.c=3D.o) PIC_OBJS :=3D $(SRCS-y:.c=3D.opic) diff --git a/tools/libs/toolcore/Makefile b/tools/libs/toolcore/Makefile index 85ff2b26fd..34b08a4236 100644 --- a/tools/libs/toolcore/Makefile +++ b/tools/libs/toolcore/Makefile @@ -3,7 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 1 MINOR =3D 0 -LIBNAME :=3D toolcore AUTOINCS :=3D include/_xentoolcore_list.h =20 SRCS-y +=3D handlereg.c diff --git a/tools/libs/toollog/Makefile b/tools/libs/toollog/Makefile index 2d3ae4e627..3f986835d6 100644 --- a/tools/libs/toollog/Makefile +++ b/tools/libs/toollog/Makefile @@ -3,7 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 1 MINOR =3D 0 -LIBNAME :=3D toollog =20 SRCS-y +=3D xtl_core.c SRCS-y +=3D xtl_logger_stdio.c --=20 2.26.2