From 113d719547cf292212b9e7029b612a9b9308dd05 Mon Sep 17 00:00:00 2001 From: Maxim Kochetkov Date: Thu, 24 Sep 2026 09:01:33 +0300 Subject: [PATCH] Makefile: Speed up parallel build Parallel build is extremely slow when using vars (O, I, PLATFORM_DIR+PLATFORM). And all this is because the variables are calculated continuously, with the simultaneous invocation of the $(shell ...). So use "Simply expanded variables" to calculate value and call $(shell ...) just once. Signed-off-by: Maxim Kochetkov Reviewed-by: Anup Patel Link: https://lore.kernel.org/r/20260924060133.294142-1-fido_max@inbox.ru Signed-off-by: Anup Patel --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 90bf7d5d..c05414a8 100644 --- a/Makefile +++ b/Makefile @@ -22,18 +22,18 @@ endif # Find out source, build, and install directories src_dir=$(CURDIR) ifdef O - build_dir=$(shell $(READLINK) -f $(O)) + build_dir:=$(shell $(READLINK) -f $(O)) else - build_dir=$(CURDIR)/build + build_dir:=$(CURDIR)/build endif ifeq ($(build_dir),$(CURDIR)) $(error Build directory is same as source directory.) endif install_root_dir_default=$(CURDIR)/install ifdef I - install_root_dir=$(shell $(READLINK) -f $(I)) + install_root_dir:=$(shell $(READLINK) -f $(I)) else - install_root_dir=$(install_root_dir_default)/usr + install_root_dir:=$(install_root_dir_default)/usr endif ifeq ($(install_root_dir),$(CURDIR)) $(error Install root directory is same as source directory.) @@ -42,12 +42,12 @@ ifeq ($(install_root_dir),$(build_dir)) $(error Install root directory is same as build directory.) endif ifdef PLATFORM_DIR - platform_dir_path=$(shell $(READLINK) -f $(PLATFORM_DIR)) + platform_dir_path:=$(shell $(READLINK) -f $(PLATFORM_DIR)) ifdef PLATFORM platform_parent_dir=$(platform_dir_path) else - PLATFORM=$(shell basename $(platform_dir_path)) - platform_parent_dir=$(shell realpath ${platform_dir_path}/..) + PLATFORM:=$(shell basename $(platform_dir_path)) + platform_parent_dir:=$(shell realpath ${platform_dir_path}/..) endif else platform_parent_dir=$(src_dir)/platform