tools/libs: Don't recursively expand MAJOR ?= $(shell ...)
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 13 Dec 2021 18:49:17 +0000 (18:49 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 16 Dec 2021 20:27:12 +0000 (20:27 +0000)
?= is a deferred assignment.  Switch to an alternative form which lets us use
an immediate assignment.

Before, version.sh gets run anywhere between 46 and 88 times, with 50 on a
`clean`.  After, between 6 and 12 times.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
tools/libs/libs.mk

index dfbbef4080f6e7c4df62f32c767d171956f0708f..b21e0bf083a0364507e94eab0d63b6da2e90e864 100644 (file)
@@ -6,7 +6,10 @@
 #   MINOR:   minor version of lib (0 if empty)
 
 LIBNAME := $(notdir $(CURDIR))
-MAJOR ?= $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
+
+ifeq ($(origin MAJOR), undefined)
+MAJOR := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
+endif
 MINOR ?= 0
 
 SHLIB_LDFLAGS += -Wl,--version-script=libxen$(LIBNAME).map