build: shuffle main Makefile

Reorganize a bit the Makefile ahead of patch
"build: adding out-of-tree support to the xen build"

We are going to want to calculate all the $(*srctree) and $(*objtree)
once, when we can calculate them. This can happen within the
"$(root-make-done)" guard, in an out-of-tree build scenario, so move
those variable there.

$(XEN_ROOT) is going to depends on the value of $(abs_srctree) so
needs to move as well. "Kbuild.include" also depends on $(srctree).

Next, "Config.mk" depends on $(XEN_ROOT) and $(TARGET_*ARCH) depends
on "Config.mk" so those needs to move as well.

This should only be code movement without functional changes.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Anthony PERARD authored and Jan Beulich committed 2022-04-07 17:58:44 +02:00
1 parent 1188c24ef7
commit 15a0578ca4
1 file changed
+23 -23
+23 -23
View File
@@ -19,17 +19,6 @@ export PYTHON ?= $(PYTHON_INTERPRETER)
export CHECKPOLICY ?= checkpolicy
export XEN_ROOT := $(CURDIR)/..
abs_objtree := $(CURDIR)
abs_srctree := $(CURDIR)
export abs_srctree abs_objtree
srctree := .
objtree := .
export srctree objtree
# Do not use make's built-in rules and variables
MAKEFLAGS += -rR
@@ -41,16 +30,6 @@ SRCARCH=$(shell echo $(ARCH) | \
-e s'/riscv.*/riscv/g')
export ARCH SRCARCH
# Don't break if the build process wasn't called from the top level
# we need XEN_TARGET_ARCH to generate the proper config
include $(XEN_ROOT)/Config.mk
# Set ARCH/SUBARCH appropriately.
export TARGET_SUBARCH := $(XEN_TARGET_ARCH)
export TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \
sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
-e s'/riscv.*/riscv/g')
# Allow someone to change their config file
export KCONFIG_CONFIG ?= .config
@@ -64,8 +43,6 @@ default: build
.PHONY: dist
dist: install
include scripts/Kbuild.include
ifneq ($(root-make-done),y)
# section to run before calling Rules.mk, but only once.
@@ -141,6 +118,17 @@ endif
export quiet Q KBUILD_VERBOSE
abs_objtree := $(CURDIR)
abs_srctree := $(CURDIR)
export abs_srctree abs_objtree
srctree := .
objtree := .
export srctree objtree
export XEN_ROOT := $(CURDIR)/..
# To make sure we do not include .config for any of the *config targets
# catch them early, and hand them over to tools/kconfig/Makefile
@@ -163,6 +151,18 @@ ifneq ($(filter %config,$(MAKECMDGOALS)),)
config-build := y
endif
include scripts/Kbuild.include
# Don't break if the build process wasn't called from the top level
# we need XEN_TARGET_ARCH to generate the proper config
include $(XEN_ROOT)/Config.mk
# Set ARCH/SUBARCH appropriately.
export TARGET_SUBARCH := $(XEN_TARGET_ARCH)
export TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \
sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
-e s'/riscv.*/riscv/g')
export CONFIG_SHELL := $(SHELL)
export YACC = $(if $(BISON),$(BISON),bison)
export LEX = $(if $(FLEX),$(FLEX),flex)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.