mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-19 21:44:08 +00:00
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>
This commit is contained in:
parent
48b5ffd126
commit
a9a49c2ad9
7 changed files with 9 additions and 9 deletions
6
Makefile
6
Makefile
|
@ -448,7 +448,7 @@ USERINCLUDE := \
|
||||||
LINUXINCLUDE := \
|
LINUXINCLUDE := \
|
||||||
-I$(srctree)/arch/$(SRCARCH)/include \
|
-I$(srctree)/arch/$(SRCARCH)/include \
|
||||||
-I$(objtree)/arch/$(SRCARCH)/include/generated \
|
-I$(objtree)/arch/$(SRCARCH)/include/generated \
|
||||||
$(if $(KBUILD_SRC), -I$(srctree)/include) \
|
$(if $(filter .,$(srctree)),,-I$(srctree)/include) \
|
||||||
-I$(objtree)/include \
|
-I$(objtree)/include \
|
||||||
$(USERINCLUDE)
|
$(USERINCLUDE)
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ PHONY += outputmakefile
|
||||||
# At the same time when output Makefile generated, generate .gitignore to
|
# At the same time when output Makefile generated, generate .gitignore to
|
||||||
# ignore whole output directory
|
# ignore whole output directory
|
||||||
outputmakefile:
|
outputmakefile:
|
||||||
ifneq ($(KBUILD_SRC),)
|
ifneq ($(srctree),.)
|
||||||
$(Q)ln -fsn $(srctree) source
|
$(Q)ln -fsn $(srctree) source
|
||||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
|
||||||
$(Q)test -e .gitignore || \
|
$(Q)test -e .gitignore || \
|
||||||
|
@ -1089,7 +1089,7 @@ PHONY += prepare archprepare prepare1 prepare3
|
||||||
# and if so do:
|
# and if so do:
|
||||||
# 1) Check that make has not been executed in the kernel src $(srctree)
|
# 1) Check that make has not been executed in the kernel src $(srctree)
|
||||||
prepare3: include/config/kernel.release
|
prepare3: include/config/kernel.release
|
||||||
ifneq ($(KBUILD_SRC),)
|
ifneq ($(srctree),.)
|
||||||
@$(kecho) ' Using $(srctree) as source for kernel'
|
@$(kecho) ' Using $(srctree) as source for kernel'
|
||||||
$(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
|
$(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
|
||||||
echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
|
echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
|
||||||
|
|
|
@ -501,7 +501,7 @@ existing-targets := $(wildcard $(sort $(targets)))
|
||||||
|
|
||||||
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
|
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
|
||||||
|
|
||||||
ifneq ($(KBUILD_SRC),)
|
ifneq ($(srctree),.)
|
||||||
# Create directories for object files if they do not exist
|
# Create directories for object files if they do not exist
|
||||||
obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
|
obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
|
||||||
# If targets exist, their directories apparently exist. Skip mkdir.
|
# If targets exist, their directories apparently exist. Skip mkdir.
|
||||||
|
|
|
@ -71,7 +71,7 @@ __hostc_flags = $(_hostc_flags)
|
||||||
__hostcxx_flags = $(_hostcxx_flags)
|
__hostcxx_flags = $(_hostcxx_flags)
|
||||||
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
ifneq ($(KBUILD_SRC),)
|
ifneq ($(srctree),.)
|
||||||
__hostc_flags = -I$(obj) $(call flags,_hostc_flags)
|
__hostc_flags = -I$(obj) $(call flags,_hostc_flags)
|
||||||
__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
|
__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -144,7 +144,7 @@ __cpp_flags = $(_cpp_flags)
|
||||||
# If building the kernel in a separate objtree expand all occurrences
|
# If building the kernel in a separate objtree expand all occurrences
|
||||||
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
|
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
ifneq ($(KBUILD_SRC),)
|
ifneq ($(srctree),.)
|
||||||
|
|
||||||
# -I$(obj) locates generated .h files
|
# -I$(obj) locates generated .h files
|
||||||
# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
|
# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
|
||||||
|
|
|
@ -15,7 +15,7 @@ include include/config/tristate.conf
|
||||||
|
|
||||||
include scripts/Kbuild.include
|
include scripts/Kbuild.include
|
||||||
|
|
||||||
ifneq ($(KBUILD_SRC),)
|
ifneq ($(srctree),.)
|
||||||
# Create output directory if not already present
|
# Create output directory if not already present
|
||||||
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
|
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
ifneq ($(KBUILD_SRC),)
|
ifneq ($(srctree),.)
|
||||||
|
|
||||||
symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
|
symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ ignore="$ignore ( -name *.mod.c ) -prune -o"
|
||||||
# Do not use full path if we do not use O=.. builds
|
# Do not use full path if we do not use O=.. builds
|
||||||
# Use make O=. {tags|cscope}
|
# Use make O=. {tags|cscope}
|
||||||
# to force full paths for a non-O= build
|
# to force full paths for a non-O= build
|
||||||
if [ "${KBUILD_SRC}" = "" ]; then
|
if [ "${srctree}" = "." ]; then
|
||||||
tree=
|
tree=
|
||||||
else
|
else
|
||||||
tree=${srctree}/
|
tree=${srctree}/
|
||||||
|
|
Loading…
Add table
Reference in a new issue