Skip to content

Commit 805b2e1

Browse files
committed
kbuild: include Makefile.compiler only when compiler is needed
Since commit f2f02eb ("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 No-build targets such as kernelversion, clean, help, etc. do not need to evaluate $(call cc-option,) or friends. Skip Makefile.compiler so $(call cc-option,) becomes no-op. This not only fixes 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 installation. This is a problem that must be fixed by a separate patch. Reported-by: Israel Tsadok <itsadok@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 57fd251 commit 805b2e1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎Makefile‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,18 @@ no-dot-config-targets := $(clean-targets) \
264264
$(version_h) headers headers_% archheaders archscripts \
265265
%asm-generic kernelversion %src-pkg dt_binding_check \
266266
outputmakefile
267+
# Installation targets should not require compiler. Unfortunately, vdso_install
268+
# is an exception where build artifacts may be updated. This must be fixed.
269+
no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
270+
headers_install modules_install kernelrelease image_name
267271
no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
268272
image_name
269273
single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
270274

271275
config-build :=
272276
mixed-build :=
273277
need-config := 1
278+
need-compiler := 1
274279
may-sync-config := 1
275280
single-build :=
276281

@@ -280,6 +285,12 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
280285
endif
281286
endif
282287

288+
ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),)
289+
ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),)
290+
need-compiler :=
291+
endif
292+
endif
293+
283294
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
284295
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
285296
may-sync-config :=
@@ -586,7 +597,9 @@ endif
586597

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

591604
ifdef config-build
592605
# ===========================================================================

0 commit comments

Comments
 (0)