kbuild: use $(src) instead of $(srctree)/$(src) for source directory
authorMasahiro Yamada <masahiroy@kernel.org>
Sat, 27 Apr 2024 14:55:02 +0000 (23:55 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Thu, 9 May 2024 19:34:52 +0000 (04:34 +0900)
commitb1992c3772e69a6fd0e3fc81cd4d2820c8b6eca0
tree60cc6428700d3582666b62d1d9dd741656efe1ee
parent9a0ebe5011f49e932bb0a2cea2034fd65e6e567e
kbuild: use $(src) instead of $(srctree)/$(src) for source directory

Kbuild conventionally uses $(obj)/ for generated files, and $(src)/ for
checked-in source files. It is merely a convention without any functional
difference. In fact, $(obj) and $(src) are exactly the same, as defined
in scripts/Makefile.build:

    src := $(obj)

When the kernel is built in a separate output directory, $(src) does
not accurately reflect the source directory location. While Kbuild
resolves this discrepancy by specifying VPATH=$(srctree) to search for
source files, it does not cover all cases. For example, when adding a
header search path for local headers, -I$(srctree)/$(src) is typically
passed to the compiler.

This introduces inconsistency between upstream and downstream Makefiles
because $(src) is used instead of $(srctree)/$(src) for the latter.

To address this inconsistency, this commit changes the semantics of
$(src) so that it always points to the directory in the source tree.

Going forward, the variables used in Makefiles will have the following
meanings:

  $(obj)     - directory in the object tree
  $(src)     - directory in the source tree  (changed by this commit)
  $(objtree) - the top of the kernel object tree
  $(srctree) - the top of the kernel source tree

Consequently, $(srctree)/$(src) in upstream Makefiles need to be replaced
with $(src).

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
102 files changed:
Documentation/Makefile
Documentation/devicetree/bindings/Makefile
Documentation/kbuild/makefiles.rst
Makefile
arch/arc/boot/dts/Makefile
arch/arm/Kbuild
arch/arm/boot/Makefile
arch/arm/mach-s3c/Makefile
arch/arm/plat-orion/Makefile
arch/arm/tools/Makefile
arch/arm64/kernel/vdso/Makefile
arch/arm64/kvm/Makefile
arch/arm64/kvm/hyp/Makefile
arch/csky/boot/dts/Makefile
arch/csky/kernel/vdso/Makefile
arch/loongarch/kvm/Makefile
arch/loongarch/vdso/Makefile
arch/mips/kernel/syscalls/Makefile
arch/mips/vdso/Makefile
arch/nios2/boot/dts/Makefile
arch/parisc/kernel/vdso32/Makefile
arch/parisc/kernel/vdso64/Makefile
arch/powerpc/boot/Makefile
arch/powerpc/boot/dts/Makefile
arch/powerpc/boot/dts/fsl/Makefile
arch/powerpc/kernel/vdso/Makefile
arch/riscv/kernel/compat_vdso/Makefile
arch/riscv/kernel/vdso/Makefile
arch/riscv/kvm/Makefile
arch/s390/kernel/syscalls/Makefile
arch/s390/kernel/vdso32/Makefile
arch/s390/kernel/vdso64/Makefile
arch/sparc/vdso/Makefile
arch/um/kernel/Makefile
arch/x86/boot/Makefile
arch/x86/entry/vdso/Makefile
arch/x86/kernel/Makefile
arch/x86/kernel/cpu/Makefile
arch/x86/mm/Makefile
arch/x86/um/vdso/Makefile
arch/xtensa/boot/dts/Makefile
certs/Makefile
drivers/Makefile
drivers/crypto/intel/qat/qat_420xx/Makefile
drivers/crypto/intel/qat/qat_4xxx/Makefile
drivers/crypto/intel/qat/qat_c3xxx/Makefile
drivers/crypto/intel/qat/qat_c3xxxvf/Makefile
drivers/crypto/intel/qat/qat_c62x/Makefile
drivers/crypto/intel/qat/qat_c62xvf/Makefile
drivers/crypto/intel/qat/qat_dh895xcc/Makefile
drivers/crypto/intel/qat/qat_dh895xccvf/Makefile
drivers/gpu/drm/amd/amdgpu/Makefile
drivers/gpu/drm/arm/display/komeda/Makefile
drivers/gpu/drm/i915/Makefile
drivers/gpu/drm/imagination/Makefile
drivers/gpu/drm/msm/Makefile
drivers/gpu/drm/nouveau/Kbuild
drivers/gpu/drm/xe/Makefile
drivers/hid/amd-sfh-hid/Makefile
drivers/hid/intel-ish-hid/Makefile
drivers/md/dm-vdo/Makefile
drivers/net/ethernet/aquantia/atlantic/Makefile
drivers/net/ethernet/chelsio/libcxgb/Makefile
drivers/net/ethernet/fungible/funeth/Makefile
drivers/net/ethernet/hisilicon/hns3/Makefile
drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/Makefile
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/Makefile
drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/Makefile
drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile
drivers/net/wireless/broadcom/brcm80211/brcmutil/Makefile
drivers/net/wireless/intel/iwlwifi/dvm/Makefile
drivers/net/wireless/intel/iwlwifi/mei/Makefile
drivers/net/wireless/intel/iwlwifi/mvm/Makefile
drivers/net/wireless/intel/iwlwifi/tests/Makefile
drivers/net/wireless/realtek/rtl818x/rtl8180/Makefile
drivers/net/wireless/realtek/rtl818x/rtl8187/Makefile
drivers/scsi/aic7xxx/Makefile
drivers/staging/rtl8723bs/Makefile
fs/iomap/Makefile
fs/unicode/Makefile
fs/xfs/Makefile
init/Makefile
lib/Makefile
lib/raid6/Makefile
net/wireless/Makefile
rust/Makefile
samples/bpf/Makefile
samples/hid/Makefile
scripts/Kbuild.include
scripts/Makefile.asm-generic
scripts/Makefile.build
scripts/Makefile.clean
scripts/Makefile.lib
scripts/Makefile.modpost
scripts/dtc/Makefile
scripts/gdb/linux/Makefile
scripts/genksyms/Makefile
scripts/kconfig/Makefile
security/tomoyo/Makefile
usr/Makefile
usr/include/Makefile