lkml.org 
[lkml]   [2021]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/4] kbuild: include Makefile.compiler only when compiler is required
Date
Since commit f2f02ebd8f38 ("kbuild: improve cc-option to clean up all
temporary files"), running 'make kernelversion' in a read-only source
tree emits a bunch of warnings:

mkdir: cannot create directory '.tmp_12345': Permission denied

Non-build targets such as kernelversion, clean, help, etc. do not
need to evaluate $(call cc-option,) and friends. Do not include
Makefile.compiler so $(call cc-option,) becomes no-op.

This not only fix the warnings, but also runs non-build targets much
faster.

Basically, all installation targets should also be non-build targets.
Unfortunately, vdso_install requires the compiler because it builds
vdso before installtion. This is a problem that must be fixed by a
separate patch.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

I am not adding Reported-by for now because a reporter sent me
an email privately.

If he allows me to add Reported-by, I will add it to record
the credit.

(Perhaps, another person might have reported a similar issue
somewhere, but my memory is obsure. I cannot recall it.)


Makefile | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/Makefile b/Makefile
index eec7a94f5c33..20724711dc71 100644
--- a/Makefile
+++ b/Makefile
@@ -263,6 +263,10 @@ no-dot-config-targets := $(clean-targets) \
$(version_h) headers headers_% archheaders archscripts \
%asm-generic kernelversion %src-pkg dt_binding_check \
outputmakefile
+# Installation targets should not require compiler. Unfortunately, vdso_install
+# is an exception where build artifacts may be updated. This must be fixed.
+no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
+ headers_install modules_install kernelrelease image_name
no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
image_name
single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
@@ -270,6 +274,7 @@ single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
config-build :=
mixed-build :=
need-config := 1
+need-compiler := 1
may-sync-config := 1
single-build :=

@@ -279,6 +284,12 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
endif
endif

+ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),)
+ ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),)
+ need-compiler :=
+ endif
+endif
+
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
may-sync-config :=
@@ -584,7 +595,9 @@ endif

# Include this also for config targets because some architectures need
# cc-cross-prefix to determine CROSS_COMPILE.
+ifdef need-compiler
include $(srctree)/scripts/Makefile.compiler
+endif

ifdef config-build
# ===========================================================================
--
2.27.0
\
 
 \ /
  Last update: 2021-02-28 07:13    [W:0.081 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site