Makefile: Optimize dirname invocation
Invoking `dirname` for every single source file is slow. This change
switches to the `-exec dirname {} +` variant that passes multiple args
to `dirname`. With this change I no longer see `dirname` in `top` when
watching a build.
BUG=b:392102378
BRANCH=none
TEST=emerge-brya coreboot
Change-Id: I786b91df9516c70b34ff534c4144e228104bea2d
Signed-off-by: Raul E Rangel <[email protected]>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/6198688
Reviewed-by: Julius Werner <[email protected]>
Commit-Queue: Julius Werner <[email protected]>
diff --git a/Makefile b/Makefile
index 5cee47c..e974e2a 100644
--- a/Makefile
+++ b/Makefile
@@ -907,7 +907,7 @@
# so it happens before trying to generate/include dependencies.
SUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite
_dir_create := $(foreach d, \
- $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \
+ $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} + | sort -u), \
$(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d}))
.PHONY: clean