From patchwork Tue Jan 25 11:01:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 12723663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D42BCC433FE for ; Tue, 25 Jan 2022 11:07:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.260106.449326 (Exim 4.92) (envelope-from ) id 1nCJft-0000fo-P9; Tue, 25 Jan 2022 11:07:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 260106.449326; Tue, 25 Jan 2022 11:07:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nCJfs-0000ZJ-Ai; Tue, 25 Jan 2022 11:07:44 +0000 Received: by outflank-mailman (input) for mailman id 260106; Tue, 25 Jan 2022 11:07:38 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nCJaj-0006Mn-J5 for xen-devel@lists.xenproject.org; Tue, 25 Jan 2022 11:02:25 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 45dd9e5b-7dce-11ec-8fa7-f31e035a9116; Tue, 25 Jan 2022 12:02:24 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 45dd9e5b-7dce-11ec-8fa7-f31e035a9116 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1643108544; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7Qro/yaNm//kAbsXtl6h430tMQIH8P57DTIHDTlToVE=; b=Ov5l6Uu0ihTQBSevPbYWBzZQMW9UyWDP6dm1vGBW43L/cA4eFq4n3BCn SFccgZih2i1liNOSd7XjXwJOvP7sB6DpV3M+sqsABHV1AS2ThwP2lcuZn A8B4uEd81WBlC46Dq/s4UVEMrOBJ5lsqJJPUMWFJWjbQjuHm9Fe2uQoyz A=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: GfGsplmdULk3yuLHXRLvR/WC56go2Hm23nz1NA5CSJxTBKxyfx+P74uZPkisnyUb1uO7eOQs9c Ha/8jKd5eJZqnwc5x+uhGnk2C/Zl1eeVV3fmFMXBRNAdFMy/4vY1ye3VI+gLkk2BnA8YwZ8av4 By+DdncgLeeoZvjJy/Lw1/9d/GVIHWZSMzuInzipr+tQdl1iYPsjpNU9WSDMef9xh2GJtlmIWA o1Uw3/8TVlszzjV2tALXRH4vxff+E31wpnzIPrd1f2RhQib5EGo6ygG4mYNfO4vWzsErwKcyzg B+XJzFWg4aSdHPUVnRzvr33I X-SBRS: 5.2 X-MesageID: 62699926 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:BeBE0KxaGDo4JBzFvi16t+fLwSrEfRIJ4+MujC+fZmUNrF6WrkVRm DQeDT/TPPaLM2Gje99+bIS/oRgCvsDUmt9gTgtorCAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAhLeNYYH1500g7wrRk2tcAbeWRWGthh /uj+6UzB3f9s9JEGjp8B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KZav3nU+xp3UUhMl7Q1DMfotIYEzp/YUzc37xg/Y7LtsiMxLGwjfGh Q+aDQ1B/bvGopMv8cmPjqeB9t/7H+x7F0tcPm/a8bfpanWKojv9mddNCb/acyrcWWX4/LSZS d9Ul/ysYucamFtqspZnF+o5x6wJ+Nay9aRRyR5pHSuXYg3zWK9gOHSPweJGqrZJmu1CoQKzV 0+CpotaNLGONJ+3GVIdPlN4POGK1PVSkTjO9/UlZk794XYvrraAVExTOTiKiTBcc+QpYN90n 795tZ5E8RG7hzorLs2C33Jd+Gm7J3AdV7kq68MBC4jxhwt3klxPbPQw0MMtDE1jvzmUDnQXH w== IronPort-HdrOrdr: A9a23:Xjk10q9B3A4rROifnqtuk+DeI+orL9Y04lQ7vn2YSXRuHfBw8P re+8jztCWE8Qr5N0tApTntAsS9qDbnhPxICOoqTNOftWvd2FdARbsKheCJ/9SjIVyaygc079 YHT0EUMrPN5DZB4foSmDPIcOod/A== X-IronPort-AV: E=Sophos;i="5.88,314,1635220800"; d="scan'208";a="62699926" From: Anthony PERARD To: CC: Anthony PERARD , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" , Wei Liu Subject: [XEN PATCH v9 29/30] build: shuffle main Makefile Date: Tue, 25 Jan 2022 11:01:02 +0000 Message-ID: <20220125110103.3527686-30-anthony.perard@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125110103.3527686-1-anthony.perard@citrix.com> References: <20220125110103.3527686-1-anthony.perard@citrix.com> MIME-Version: 1.0 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 Acked-by: Jan Beulich --- Notes: v9: - add some explanation in the commit message about why the code movement is needed. v8: - new patch xen/Makefile | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/xen/Makefile b/xen/Makefile index c39c1699966f..08114b3fef1e 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -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)