$(srctree) is a better description for the source directory than
$(BASEDIR) that has been used for both source and build directory
(which where the same).
This adds $(srctree) to a few path where make's VPATH=$(srctree) won't
apply. And replace $(BASEDIR) by $(srctree).
Introduce "$(srcdir)" as a shortcut for "$(srctree)/$(src)" as the
later is used often enough.
Signed-off-by: Anthony PERARD
Acked-by: Jan Beulich
---
Notes:
v9:
- acked
- reword "# shortcut for $(srctree)/$(src)" into "# shortcuts" in both
places.
v8:
- merge of two patchs from v7:
build: add $(srctree) in few key places
build: replace $(BASEDIR) by $(srctree)
both patch were acked
- introduce $(srcdir) as a shortcut for $(srctree)/$(src)
xen/Kconfig | 4 ++--
xen/Makefile| 7 +++
xen/Rules.mk| 9 ++---
xen/arch/x86/arch.mk| 2 +-
xen/build.mk| 4 ++--
xen/common/Makefile | 2 +-
xen/common/libfdt/Makefile | 2 +-
xen/include/Makefile| 14 +++---
xen/scripts/Kconfig.include | 2 +-
xen/scripts/Makefile.clean | 5 -
xen/xsm/flask/Makefile | 10 +-
11 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/xen/Kconfig b/xen/Kconfig
index bcbd2758e5d3..ac9a638d372e 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -14,14 +14,14 @@ config CC_IS_GCC
config GCC_VERSION
int
- default $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC))
+ default $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
config CC_IS_CLANG
def_bool $(success,$(CC) --version | head -n 1 | grep -q clang)
config CLANG_VERSION
int
- default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC))
+ default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
# -fvisibility=hidden reduces -fpic cost, if it's available
config CC_HAS_VISIBILITY_ATTRIBUTE
diff --git a/xen/Makefile b/xen/Makefile
index 443784dfce80..c39c1699966f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -19,8 +19,7 @@ export PYTHON ?= $(PYTHON_INTERPRETER)
export CHECKPOLICY ?= checkpolicy
-export BASEDIR := $(CURDIR)
-export XEN_ROOT := $(BASEDIR)/..
+export XEN_ROOT := $(CURDIR)/..
abs_objtree := $(CURDIR)
abs_srctree := $(CURDIR)
@@ -189,7 +188,7 @@ ifeq ($(TARGET_ARCH),x86)
t1 = $(call as-insn,$(CC),".L0: .L1: .skip (.L1 - .L0)",,-no-integrated-as)
# Check whether clang asm()-s support .include.
-t2 = $(call as-insn,$(CC) -I$(BASEDIR)/arch/x86/include,".include
\"asm/asm-defns.h\"",,-no-integrated-as)
+t2 = $(call as-insn,$(CC) -I$(srctree)/arch/x86/include,".include
\"asm/asm-defns.h\"",,-no-integrated-as)
# Check whether clang keeps .macro-s between asm()-s:
# https://bugs.llvm.org/show_bug.cgi?id=36110
@@ -329,7 +328,7 @@ ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
ALL_LIBS-y:= lib/lib.a
-include $(BASEDIR)/arch/$(TARGET_ARCH)/arch.mk
+include $(srctree)/arch/$(TARGET_ARCH)/arch.mk
# define new variables to avoid the ones defined in Config.mk
export XEN_CFLAGS := $(CFLAGS)
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 7712bfa063e0..57a029455586 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -9,13 +9,16 @@ endif
src := $(obj)
+# shortcuts
+srcdir := $(srctree)/$(src)
+
PHONY := __build
__build:
-include $(objtree)/include/config/auto.conf
include $(XEN_ROOT)/Config.mk
-include $(BASEDIR)/scripts/Kbuild.include
+include $(srctree)/scripts/Kbuild.include
# Initialise some variables
obj-y :=
@@ -58,7 +61,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
# binfile
# use e.g. $(call if_changed,binfile,binary-file varname)
quiet_cmd_binfile = BINFILE $@
-cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
+cmd_binfile = $(SHELL) $(srctree)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
# Figure out what we need to build from the various variables
# ===
@@ -177,7 +180,7 @@ cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))
c_flags = -MMD -MP -MF $(depfile) $(XEN_CFLAGS)
a_flags = -MMD -MP -MF $(depfile) $(XEN_AFLAGS)
-include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
+include $(srctree)/arch/$(TARGET_ARCH)/Rules.mk
c_flags += $(_c_flags)
a_flags += $(_c_flags)
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 8bc0e01ceb2b..2fcb6271faf7 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -63,7 +63,7 @@ ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
efi-check := arch/x86/efi/check
# Check if the compiler supports the MS ABI.
-XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(efi-check).c -o
$(efi-check).o,y)
+XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c
$(srctree)/$(efi-check).c -o $(efi-check).o,y)
# Check if the linker supports PE.
EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
diff --git a/xen/build.mk b/xen/build.mk
index