diff mbox series

[v2] build: always use BASEDIR for xen sub-directory

Message ID df2fc83d3a84dd3fc2e58101ded22847fdbaa862.1602082503.git.bertrand.marquis@arm.com (mailing list archive)
State New, archived
Headers show
Series [v2] build: always use BASEDIR for xen sub-directory | expand

Commit Message

Bertrand Marquis Oct. 7, 2020, 2:57 p.m. UTC
Modify Makefiles using $(XEN_ROOT)/xen to use $(BASEDIR) instead.

This is removing the dependency to xen subdirectory preventing using a
wrong configuration file when xen subdirectory is duplicated for
compilation tests.

BASEDIR is set in xen/lib/x86/Makefile as this Makefile is directly
called from the tools build and install process and BASEDIR is not set
there.

Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
Changes in v2:
 Fix tools installation by setting BASEDIR in lib/x86 Makefile.
---
 xen/common/Makefile                | 6 +++---
 xen/include/xen/lib/x86/Makefile   | 6 ++++--
 xen/tools/kconfig/Makefile.kconfig | 2 +-
 xen/xsm/flask/Makefile             | 4 ++--
 4 files changed, 10 insertions(+), 8 deletions(-)

Comments

Jan Beulich Oct. 13, 2020, 2:04 p.m. UTC | #1
On 07.10.2020 16:57, Bertrand Marquis wrote:
> Modify Makefiles using $(XEN_ROOT)/xen to use $(BASEDIR) instead.
> 
> This is removing the dependency to xen subdirectory preventing using a
> wrong configuration file when xen subdirectory is duplicated for
> compilation tests.
> 
> BASEDIR is set in xen/lib/x86/Makefile as this Makefile is directly
> called from the tools build and install process and BASEDIR is not set
> there.
> 
> Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>

And once again
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Bertrand Marquis Oct. 13, 2020, 3:04 p.m. UTC | #2
> On 13 Oct 2020, at 15:04, Jan Beulich <jbeulich@suse.com> wrote:
> 
> On 07.10.2020 16:57, Bertrand Marquis wrote:
>> Modify Makefiles using $(XEN_ROOT)/xen to use $(BASEDIR) instead.
>> 
>> This is removing the dependency to xen subdirectory preventing using a
>> wrong configuration file when xen subdirectory is duplicated for
>> compilation tests.
>> 
>> BASEDIR is set in xen/lib/x86/Makefile as this Makefile is directly
>> called from the tools build and install process and BASEDIR is not set
>> there.
>> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
> 
> And once again
> Acked-by: Jan Beulich <jbeulich@suse.com>
> 

And thanks :-)

Bertrand
diff mbox series

Patch

diff --git a/xen/common/Makefile b/xen/common/Makefile
index b3b60a1ba2..083f62acb6 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -78,14 +78,14 @@  obj-$(CONFIG_UBSAN) += ubsan/
 obj-$(CONFIG_NEEDS_LIBELF) += libelf/
 obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
 
-CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(XEN_ROOT)/xen/)$(KCONFIG_CONFIG)
+CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFIG_CONFIG)
 config.gz: $(CONF_FILE)
 	gzip -c $< >$@
 
 config_data.o: config.gz
 
-config_data.S: $(XEN_ROOT)/xen/tools/binfile
-	$(SHELL) $(XEN_ROOT)/xen/tools/binfile $@ config.gz xen_config_data
+config_data.S: $(BASEDIR)/tools/binfile
+	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
 
 clean::
 	rm -f config_data.S config.gz 2>/dev/null
diff --git a/xen/include/xen/lib/x86/Makefile b/xen/include/xen/lib/x86/Makefile
index 408d69c99e..c3b9ebe961 100644
--- a/xen/include/xen/lib/x86/Makefile
+++ b/xen/include/xen/lib/x86/Makefile
@@ -1,8 +1,10 @@ 
 include $(XEN_ROOT)/Config.mk
 
+BASEDIR = $(XEN_ROOT)/xen
+
 .PHONY: all
 all: cpuid-autogen.h
 
-cpuid-autogen.h: $(XEN_ROOT)/xen/include/public/arch-x86/cpufeatureset.h $(XEN_ROOT)/xen/tools/gen-cpuid.py
-	$(PYTHON) $(XEN_ROOT)/xen/tools/gen-cpuid.py -i $< -o $@.new
+cpuid-autogen.h: $(BASEDIR)/include/public/arch-x86/cpufeatureset.h $(BASEDIR)/tools/gen-cpuid.py
+	$(PYTHON) $(BASEDIR)/tools/gen-cpuid.py -i $< -o $@.new
 	$(call move-if-changed,$@.new,$@)
diff --git a/xen/tools/kconfig/Makefile.kconfig b/xen/tools/kconfig/Makefile.kconfig
index 065f4b8471..799321ec4d 100644
--- a/xen/tools/kconfig/Makefile.kconfig
+++ b/xen/tools/kconfig/Makefile.kconfig
@@ -9,7 +9,7 @@  Q :=
 kecho := :
 
 # eventually you'll want to do out of tree builds
-srctree := $(XEN_ROOT)/xen
+srctree := $(BASEDIR)
 objtree := $(srctree)
 src := tools/kconfig
 obj := $(src)
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 50bec20a1e..637159ad82 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -35,8 +35,8 @@  $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE
 obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
 flask-policy.o: policy.bin
 
-flask-policy.S: $(XEN_ROOT)/xen/tools/binfile
-	$(SHELL) $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policy
+flask-policy.S: $(BASEDIR)/tools/binfile
+	$(SHELL) $(BASEDIR)/tools/binfile -i $@ policy.bin xsm_flask_init_policy
 
 FLASK_BUILD_DIR := $(CURDIR)
 POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)