]> git.baikalelectronics.ru Git - kernel.git/commit
kbuild: create directory for make cache only when necessary
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 13 Nov 2017 10:29:34 +0000 (19:29 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 16 Nov 2017 00:07:32 +0000 (09:07 +0900)
commit843622e8d1755da228912a3f3def5c1af295a8a6
tree43d0b8a9ca7c6aa953a0bf849e457813e3892108
parent4982aed92c3ac7f84c11c487f8f0cd0ebb673ff9
kbuild: create directory for make cache only when necessary

Currently, the existence of $(dir $(make-cache)) is always checked,
and created if it is missing.

We can avoid unnecessary system calls by some tricks.

[1] If KBUILD_SRC is unset, we are building in the source tree.
    The output directory checks can be entirely skipped.
[2] If at least one cache data is found, it means the cache file
    was included.  Obviously its directory exists.  Skip "mkdir -p".
[3] If Makefile does not contain any call of __run-and-store, it will
    not create a cache file.  No need to create its directory.
[4] The "mkdir -p" should be only invoked by the first call of
    __run-and-store

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
scripts/Kbuild.include