From patchwork Thu Jul 27 14:54:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 13330210 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1EE7C04A6A for ; Thu, 27 Jul 2023 14:55:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.571158.894338 (Exim 4.92) (envelope-from ) id 1qP2OH-0003Sh-Vs; Thu, 27 Jul 2023 14:54:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 571158.894338; Thu, 27 Jul 2023 14:54:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qP2OH-0003RY-Px; Thu, 27 Jul 2023 14:54:57 +0000 Received: by outflank-mailman (input) for mailman id 571158; Thu, 27 Jul 2023 14:54:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qP2OG-0003Ok-RC for xen-devel@lists.xenproject.org; Thu, 27 Jul 2023 14:54:56 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8ca5998a-2c8d-11ee-b248-6b7b168915f2; Thu, 27 Jul 2023 16:54:55 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8ca5998a-2c8d-11ee-b248-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1690469696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ohc1iV0GThxiLbuhMafuZPgcgU3YvgSTIZgUQtbNJOA=; b=App6GUa/Xmz82snkjg8mykFveGwhLbPMKDmxNfy0zHkztz+m3GMXfuiQ V1cZl4WKym9oIZTyw3kho1Num+MEc9IYJ0iQe7thZUc82BsO7BAEjCPze en184+FwPOB5mkMg/5ZxVWH98pNZsR8gXVV8+MDm5htzNDeqN91Kdum/E Y=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 118094561 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.123 X-Policy: $RELAYED IronPort-Data: A9a23:Of4ZtaBNa7/YixVW/+3jw5YqxClBgxIJ4kV8jS/XYbTApG5w1mECy GFKDW3VPquKNDT9LdF+Po2zpksGsJSAyYQwQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbCRMsspvlDs15K6p4GxC4QRkDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw6sRbG2131 /YkLxsmNU/SqtLv8rOpY7w57igjBJGD0II3v3hhyXfSDOo8QICFSKLPjTNa9G5u3IYUR6+YP pdHL2M1N3wsYDUWUrsTIJs4gOevgGi5azBCoUiZjaE2/3LS3Ep6172F3N/9I4XaHZQ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01,235,1684814400"; d="scan'208";a="118094561" From: Anthony PERARD To: CC: Anthony PERARD , Jason Andryuk , Andrew Cooper , "George Dunlap" , Jan Beulich , "Julien Grall" , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v3 1/2] build: evaluate XEN_BUILD_* and XEN_DOMAIN immediately Date: Thu, 27 Jul 2023 15:54:46 +0100 Message-ID: <20230727145447.2701-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230727145447.2701-1-anthony.perard@citrix.com> References: <20230727145447.2701-1-anthony.perard@citrix.com> MIME-Version: 1.0 With GNU make 4.4, the number of execution of the command present in these $(shell ) increased greatly. This is probably because as of make 4.4, exported variable are also added to the environment of $(shell ) construct. Also, `make -d` shows a lot of these: Makefile:15: not recursively expanding XEN_BUILD_DATE to export to shell function Makefile:16: not recursively expanding XEN_BUILD_TIME to export to shell function Makefile:17: not recursively expanding XEN_BUILD_HOST to export to shell function Makefile:14: not recursively expanding XEN_DOMAIN to export to shell function So to avoid having these command been run more than necessary, we will replace ?= by an equivalent but with immediate expansion. Reported-by: Jason Andryuk Signed-off-by: Anthony PERARD Reviewed-by: Jan Beulich --- Notes: v3: - replace evaluation on first use construct by immediate expansion which isn't likely to break and is clearer. xen/Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/xen/Makefile b/xen/Makefile index e8aa663781..c1738dbbde 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -11,10 +11,18 @@ export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version export XEN_WHOAMI ?= $(USER) -export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) -export XEN_BUILD_DATE ?= $(shell LC_ALL=C date) -export XEN_BUILD_TIME ?= $(shell LC_ALL=C date +%T) -export XEN_BUILD_HOST ?= $(shell hostname) +ifeq ($(origin XEN_DOMAIN), undefined) +export XEN_DOMAIN := $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) +endif +ifeq ($(origin XEN_BUILD_DATE), undefined) +export XEN_BUILD_DATE := $(shell LC_ALL=C date) +endif +ifeq ($(origin XEN_BUILD_TIME), undefined) +export XEN_BUILD_TIME := $(shell LC_ALL=C date +%T) +endif +ifeq ($(origin XEN_BUILD_HOST), undefined) +export XEN_BUILD_HOST := $(shell hostname) +endif # Best effort attempt to find a python interpreter, defaulting to Python 3 if # available. Fall back to just `python` if `which` is nowhere to be found.