From bc96efb443fd683e02e2c3fc625f72ed55ecb8b0 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 19 Sep 2026 10:01:33 +0200 Subject: [PATCH] build: find the alias of a build directory with notdir subdir calls diralias twice for every target of every build directory, and diralias splits the path into words twice to find its last component. This takes a quarter of the parse time of the main Makefile. Use notdir, which returns the same last component. The rules do not change. Signed-off-by: John Crispin --- include/subdir.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/subdir.mk b/include/subdir.mk index 262ff670e72..42db2231bf5 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -26,8 +26,7 @@ define ERROR ($(call MESSAGE, $(2)); $(if $(BUILD_LOG), echo "$(2)" >> $(BUILD_LOG_DIR)/$(1)/error.txt;) $(if $(3),, exit 1;)) endef -lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1))) -diralias=$(if $(findstring $(1),$(call lastdir,$(1))),,$(call lastdir,$(1))) +diralias=$(if $(findstring /,$(1)),$(notdir $(1))) subdir_make_opts = \ $(if $(SUBDIR_MAKE_DEBUG),-d) -r -C $(1) \