diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-03-30 08:04:17 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-04-02 10:28:04 -0400 |
commit | a9a49c2ad9b9b8ee20668c15ca2b806dbed8ea40 (patch) | |
tree | bb1ff85715935f583ef536b2a13a5a5ce9433b44 | |
parent | 48b5ffd1268788afb01525e71e864e901e9aa070 (diff) |
kbuild: use $(srctree) instead of KBUILD_SRC to check out-of-tree build
KBUILD_SRC was conventionally used for some different purposes:
[1] To remember the source tree path
[2] As a flag to check if sub-make is already done
[3] As a flag to check if Kbuild runs out of tree
For [1], we do not need to remember it because the top Makefile
can compute it by $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
[2] has been replaced with self-commenting 'sub_make_done'.
For [3], we can distinguish in-tree/out-of-tree by comparing
$(srctree) and '.'
This commit converts [3] to prepare for the KBUILD_SRC removal.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | scripts/Makefile.build | 2 | ||||
-rw-r--r-- | scripts/Makefile.host | 2 | ||||
-rw-r--r-- | scripts/Makefile.lib | 2 | ||||
-rw-r--r-- | scripts/Makefile.modbuiltin | 2 | ||||
-rw-r--r-- | scripts/gdb/linux/Makefile | 2 | ||||
-rwxr-xr-x | scripts/tags.sh | 2 |
7 files changed, 9 insertions, 9 deletions
@@ -448,7 +448,7 @@ USERINCLUDE := \ | |||
448 | LINUXINCLUDE := \ | 448 | LINUXINCLUDE := \ |
449 | -I$(srctree)/arch/$(SRCARCH)/include \ | 449 | -I$(srctree)/arch/$(SRCARCH)/include \ |
450 | -I$(objtree)/arch/$(SRCARCH)/include/generated \ | 450 | -I$(objtree)/arch/$(SRCARCH)/include/generated \ |
451 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ | 451 | $(if $(filter .,$(srctree)),,-I$(srctree)/include) \ |
452 | -I$(objtree)/include \ | 452 | -I$(objtree)/include \ |
453 | $(USERINCLUDE) | 453 | $(USERINCLUDE) |
454 | 454 | ||
@@ -509,7 +509,7 @@ PHONY += outputmakefile | |||
509 | # At the same time when output Makefile generated, generate .gitignore to | 509 | # At the same time when output Makefile generated, generate .gitignore to |
510 | # ignore whole output directory | 510 | # ignore whole output directory |
511 | outputmakefile: | 511 | outputmakefile: |
512 | ifneq ($(KBUILD_SRC),) | 512 | ifneq ($(srctree),.) |
513 | $(Q)ln -fsn $(srctree) source | 513 | $(Q)ln -fsn $(srctree) source |
514 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) | 514 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) |
515 | $(Q)test -e .gitignore || \ | 515 | $(Q)test -e .gitignore || \ |
@@ -1089,7 +1089,7 @@ PHONY += prepare archprepare prepare1 prepare3 | |||
1089 | # and if so do: | 1089 | # and if so do: |
1090 | # 1) Check that make has not been executed in the kernel src $(srctree) | 1090 | # 1) Check that make has not been executed in the kernel src $(srctree) |
1091 | prepare3: include/config/kernel.release | 1091 | prepare3: include/config/kernel.release |
1092 | ifneq ($(KBUILD_SRC),) | 1092 | ifneq ($(srctree),.) |
1093 | @$(kecho) ' Using $(srctree) as source for kernel' | 1093 | @$(kecho) ' Using $(srctree) as source for kernel' |
1094 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ | 1094 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ |
1095 | echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ | 1095 | echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 76ca30cc4791..9dddfb6f554e 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -501,7 +501,7 @@ existing-targets := $(wildcard $(sort $(targets))) | |||
501 | 501 | ||
502 | -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) | 502 | -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) |
503 | 503 | ||
504 | ifneq ($(KBUILD_SRC),) | 504 | ifneq ($(srctree),.) |
505 | # Create directories for object files if they do not exist | 505 | # Create directories for object files if they do not exist |
506 | obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) | 506 | obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) |
507 | # If targets exist, their directories apparently exist. Skip mkdir. | 507 | # If targets exist, their directories apparently exist. Skip mkdir. |
diff --git a/scripts/Makefile.host b/scripts/Makefile.host index a115259b57e7..73b804197fca 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host | |||
@@ -71,7 +71,7 @@ __hostc_flags = $(_hostc_flags) | |||
71 | __hostcxx_flags = $(_hostcxx_flags) | 71 | __hostcxx_flags = $(_hostcxx_flags) |
72 | 72 | ||
73 | ifeq ($(KBUILD_EXTMOD),) | 73 | ifeq ($(KBUILD_EXTMOD),) |
74 | ifneq ($(KBUILD_SRC),) | 74 | ifneq ($(srctree),.) |
75 | __hostc_flags = -I$(obj) $(call flags,_hostc_flags) | 75 | __hostc_flags = -I$(obj) $(call flags,_hostc_flags) |
76 | __hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) | 76 | __hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) |
77 | endif | 77 | endif |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 8a1f64f17740..41e98fa66b91 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -144,7 +144,7 @@ __cpp_flags = $(_cpp_flags) | |||
144 | # If building the kernel in a separate objtree expand all occurrences | 144 | # If building the kernel in a separate objtree expand all occurrences |
145 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). | 145 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). |
146 | ifeq ($(KBUILD_EXTMOD),) | 146 | ifeq ($(KBUILD_EXTMOD),) |
147 | ifneq ($(KBUILD_SRC),) | 147 | ifneq ($(srctree),.) |
148 | 148 | ||
149 | # -I$(obj) locates generated .h files | 149 | # -I$(obj) locates generated .h files |
150 | # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files | 150 | # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files |
diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin index a072a4267746..ea90a90b41a0 100644 --- a/scripts/Makefile.modbuiltin +++ b/scripts/Makefile.modbuiltin | |||
@@ -15,7 +15,7 @@ include include/config/tristate.conf | |||
15 | 15 | ||
16 | include scripts/Kbuild.include | 16 | include scripts/Kbuild.include |
17 | 17 | ||
18 | ifneq ($(KBUILD_SRC),) | 18 | ifneq ($(srctree),.) |
19 | # Create output directory if not already present | 19 | # Create output directory if not already present |
20 | _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) | 20 | _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) |
21 | endif | 21 | endif |
diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile index 3df395a9c2ce..9fd3d8ed731a 100644 --- a/scripts/gdb/linux/Makefile +++ b/scripts/gdb/linux/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
2 | 2 | ||
3 | ifneq ($(KBUILD_SRC),) | 3 | ifneq ($(srctree),.) |
4 | 4 | ||
5 | symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) | 5 | symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) |
6 | 6 | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh index f470d9919ed7..6a551805db52 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -19,7 +19,7 @@ ignore="$ignore ( -name *.mod.c ) -prune -o" | |||
19 | # Do not use full path if we do not use O=.. builds | 19 | # Do not use full path if we do not use O=.. builds |
20 | # Use make O=. {tags|cscope} | 20 | # Use make O=. {tags|cscope} |
21 | # to force full paths for a non-O= build | 21 | # to force full paths for a non-O= build |
22 | if [ "${KBUILD_SRC}" = "" ]; then | 22 | if [ "${srctree}" = "." ]; then |
23 | tree= | 23 | tree= |
24 | else | 24 | else |
25 | tree=${srctree}/ | 25 | tree=${srctree}/ |