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 necessery, we
will use a construct to evaluate on first use.

Reported-by: Jason Andryuk <jandr...@gmail.com>
Signed-off-by: Anthony PERARD <anthony.per...@citrix.com>
---
 xen/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 9631e45cfb9b..b58c2a7f4539 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -11,10 +11,10 @@ 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)
+export XEN_DOMAIN      ?= $(eval XEN_DOMAIN := $(shell ([ -x 
/bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && 
/bin/domainname || echo [unknown])))$(XEN_DOMAIN)
+export XEN_BUILD_DATE  ?= $(eval XEN_BUILD_DATE := $(shell LC_ALL=C 
date))$(XEN_BUILD_DATE)
+export XEN_BUILD_TIME  ?= $(eval XEN_BUILD_TIME := $(shell LC_ALL=C date 
+%T))$(XEN_BUILD_TIME)
+export XEN_BUILD_HOST  ?= $(eval XEN_BUILD_HOST := $(shell 
hostname))$(XEN_BUILD_HOST)
 
 # 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.
-- 
Anthony PERARD


Reply via email to