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 <john@phrozen.org>
This commit is contained in:
John Crispin committed 2026-09-22 18:18:58 +02:00
1 parent 407e833140
commit bc96efb443
1 file changed
+1 -2
+1 -2
View File
@@ -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) \