summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-10-13 13:25:29 +0200
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-11-13 14:54:24 +0100
commite17c400ae194945eef9d9cae38a321c92c1986fb (patch)
tree9de564f8ab166f9c638558e4f5487fc84d3ebe98 /scripts
parentkbuild: do not call cc-option before KBUILD_CFLAGS initialization (diff)
downloadlinux-e17c400ae194945eef9d9cae38a321c92c1986fb.tar.xz
linux-e17c400ae194945eef9d9cae38a321c92c1986fb.zip
kbuild: shrink .cache.mk when it exceeds 1000 lines
The cache files are only cleaned away by "make clean". If you continue incremental builds, the cache files will grow up little by little. It is not a big deal in general use cases because compiler flags do not change quite often. However, if you do build-test for various architectures, compilers, and kernel configurations, you will end up with huge cache files soon. When the cache file exceeds 1000 lines, shrink it down to 500 by "tail". The Least Recently Added lines are cut. (not Least Recently Used) I hope it will work well enough. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Douglas Anderson <dianders@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index dfadb1c94368..064f477dfdca 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -105,6 +105,12 @@ endif
$(make-cache): ;
-include $(make-cache)
+# If cache exceeds 1000 lines, shrink it down to 500.
+ifneq ($(word 1000,$(filter __cached_%, $(.VARIABLES))),)
+$(shell tail -n 500 $(make-cache) > $(make-cache).tmp; \
+ mv $(make-cache).tmp $(make-cache))
+endif
+
# Usage: $(call __sanitize-opt,Hello=Hola$(comma)Goodbye Adios)
#
# Convert all '$', ')', '(', '\', '=', ' ', ',', ':' to '_'