diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-07-05 23:07:12 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-07-10 11:05:09 -0400 |
commit | 051f278e9d81bed253bf89c66c80b8b921aafa8a (patch) | |
tree | 188b90e6cd434ca30972e6166bfbc88e273d9474 /Makefile | |
parent | 75dd47472b92c320304436c9e38638bc04ae7a4a (diff) |
kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree
Commit 25b146c5b8ce ("kbuild: allow Kbuild to start from any directory")
deprecated KBUILD_SRCTREE.
It is only used in tools/testing/selftest/ to distinguish out-of-tree
build. Replace it with a new boolean flag, building_out_of_srctree.
I also replaced the conditional ($(srctree),.) because the next commit
will allow an absolute path to be used for $(srctree) even when building
in the source tree.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -228,9 +228,12 @@ ifeq ("$(origin M)", "command line") | |||
228 | KBUILD_EXTMOD := $(M) | 228 | KBUILD_EXTMOD := $(M) |
229 | endif | 229 | endif |
230 | 230 | ||
231 | export KBUILD_CHECKSRC KBUILD_EXTMOD | ||
232 | |||
231 | ifeq ($(abs_srctree),$(abs_objtree)) | 233 | ifeq ($(abs_srctree),$(abs_objtree)) |
232 | # building in the source tree | 234 | # building in the source tree |
233 | srctree := . | 235 | srctree := . |
236 | building_out_of_srctree := | ||
234 | else | 237 | else |
235 | ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) | 238 | ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) |
236 | # building in a subdirectory of the source tree | 239 | # building in a subdirectory of the source tree |
@@ -238,19 +241,13 @@ else | |||
238 | else | 241 | else |
239 | srctree := $(abs_srctree) | 242 | srctree := $(abs_srctree) |
240 | endif | 243 | endif |
241 | 244 | building_out_of_srctree := 1 | |
242 | # TODO: | ||
243 | # KBUILD_SRC is only used to distinguish in-tree/out-of-tree build. | ||
244 | # Replace it with $(srctree) or something. | ||
245 | KBUILD_SRC := $(abs_srctree) | ||
246 | endif | 245 | endif |
247 | 246 | ||
248 | export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC | ||
249 | |||
250 | objtree := . | 247 | objtree := . |
251 | VPATH := $(srctree) | 248 | VPATH := $(srctree) |
252 | 249 | ||
253 | export srctree objtree VPATH | 250 | export building_out_of_srctree srctree objtree VPATH |
254 | 251 | ||
255 | # To make sure we do not include .config for any of the *config targets | 252 | # To make sure we do not include .config for any of the *config targets |
256 | # catch them early, and hand them over to scripts/kconfig/Makefile | 253 | # catch them early, and hand them over to scripts/kconfig/Makefile |
@@ -453,7 +450,7 @@ USERINCLUDE := \ | |||
453 | LINUXINCLUDE := \ | 450 | LINUXINCLUDE := \ |
454 | -I$(srctree)/arch/$(SRCARCH)/include \ | 451 | -I$(srctree)/arch/$(SRCARCH)/include \ |
455 | -I$(objtree)/arch/$(SRCARCH)/include/generated \ | 452 | -I$(objtree)/arch/$(SRCARCH)/include/generated \ |
456 | $(if $(filter .,$(srctree)),,-I$(srctree)/include) \ | 453 | $(if $(building_out_of_srctree),-I$(srctree)/include) \ |
457 | -I$(objtree)/include \ | 454 | -I$(objtree)/include \ |
458 | $(USERINCLUDE) | 455 | $(USERINCLUDE) |
459 | 456 | ||
@@ -514,7 +511,7 @@ PHONY += outputmakefile | |||
514 | # At the same time when output Makefile generated, generate .gitignore to | 511 | # At the same time when output Makefile generated, generate .gitignore to |
515 | # ignore whole output directory | 512 | # ignore whole output directory |
516 | outputmakefile: | 513 | outputmakefile: |
517 | ifneq ($(srctree),.) | 514 | ifdef building_out_of_srctree |
518 | $(Q)ln -fsn $(srctree) source | 515 | $(Q)ln -fsn $(srctree) source |
519 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) | 516 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) |
520 | $(Q)test -e .gitignore || \ | 517 | $(Q)test -e .gitignore || \ |
@@ -1101,7 +1098,7 @@ PHONY += prepare archprepare prepare1 prepare3 | |||
1101 | # and if so do: | 1098 | # and if so do: |
1102 | # 1) Check that make has not been executed in the kernel src $(srctree) | 1099 | # 1) Check that make has not been executed in the kernel src $(srctree) |
1103 | prepare3: include/config/kernel.release | 1100 | prepare3: include/config/kernel.release |
1104 | ifneq ($(srctree),.) | 1101 | ifdef building_out_of_srctree |
1105 | @$(kecho) ' Using $(srctree) as source for kernel' | 1102 | @$(kecho) ' Using $(srctree) as source for kernel' |
1106 | $(Q)if [ -f $(srctree)/.config -o \ | 1103 | $(Q)if [ -f $(srctree)/.config -o \ |
1107 | -d $(srctree)/include/config -o \ | 1104 | -d $(srctree)/include/config -o \ |