From nobody Wed May 15 23:20:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1647948198; cv=none; d=zohomail.com; s=zohoarc; b=kJyS61miqw9+7PcZ06PPx3SEkoTED/VxVsvP/OwVcoGgn2np+ZnZEr5UH0rXgiVIPs282JCgHnJS2i/kt4CqO3Bmg/iWtaxn5Fxlfrzi0fRXylAgLXChF018S7ivpN8iNxLf0/iKhz/v2WJg/q2Odm5lhO2mZYJXUYIhU1cyPTs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647948198; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PXu18mrIZ9sR44ngZfPfm2WfBEb734F3LSsPYsqPHSA=; b=YxkbuAU32vnMJn3WihZuU1IVkeQkc3n+lZ/flQNitO1bUhXIqA2WSJ9iiLrrmhTCz8RztOjk4J5JjwTYtpP71FkUjOIkmJrHPjdyzvKtAqG8knxA+M2JksRtEoThDtw+EvaBgo79VvT9nfBrDg1ibGP0o1t7oRd7HdJd1ErmXkE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1647948198378321.4118957412303; Tue, 22 Mar 2022 04:23:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.293376.498386 (Exim 4.92) (envelope-from ) id 1nWcbC-00026i-Vp; Tue, 22 Mar 2022 11:22:50 +0000 Received: by outflank-mailman (output) from mailman id 293376.498386; Tue, 22 Mar 2022 11:22:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbC-00026Z-SM; Tue, 22 Mar 2022 11:22:50 +0000 Received: by outflank-mailman (input) for mailman id 293376; Tue, 22 Mar 2022 11:22:49 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbB-0001wJ-EA for xen-devel@lists.xenproject.org; Tue, 22 Mar 2022 11:22:49 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 66106b03-a9d2-11ec-8fbc-03012f2f19d4; Tue, 22 Mar 2022 12:22:47 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 66106b03-a9d2-11ec-8fbc-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1647948167; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CTFDMVJ9UQNI3tpTHwdI+DnHPvju2Tgd9bnCsFPvWRo=; b=WrnEp+u/M+gs3w/mV+a/0LMx20rQ7P9s1kgG8roCpY/RKM/iO5n4Od5M 0UM9kjL/RPOaRLRuc2LQsYSpdkGLoBQl0S04ZjnI3tkdLxzAFEypvDxz5 kJ5q+Sq+X0Bn/6YOgrI2rnyABipWB+3Ai1i+EwIeRtwwqzwgFbviVQshv U=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 69219496 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:SCGlsK4/KuIB993FtBwsNAxRtOPHchMFZxGqfqrLsTDasY5as4F+v jFOWG2GafeKYGfyft5waYrn/EIC7MfRy9UyTQc6ryo9Hi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuVGuG96yE6j8lkf5KkYAL+EnkZqTRMFWFw0XqPp8Zj2tQy2YPjWVvX0 T/Pi5a31GGNimYc3l08s8pvmDs31BglkGpF1rCWTakjUG72zxH5PrpGTU2CByKQrr1vNvy7X 47+IISRpQs1yfuP5uSNyd4XemVSKlLb0JPnZnB+A8BOiTAazsA+PzpS2FPxpi67hh3Q9+2dx umhurTrWToSEYTAhtgcXgt6GBNUBYRt0r3YdC3XXcy7lyUqclPpyvRqSko3IZcZ6qB8BmQmG f4wcW5XKErZ3qTvnez9GrIEascLdaEHOKsWvG1gyjfIS+4rW5nZT43B5MNC3Sd2jcdLdRrbT 5RIM2M+MEWeC/FJElg5C7Qdrc75vFviWjhKknisrvEl4UGGmWSd15CyaYGIK7RmX/59gUKwt m/AuWPjDXkyPtGF1SCM9H7qg+bVhD76Q6obDrj+/flv6HWtwWgUBAwTREGMi/CzgU6jWPpSM 0URvCEpqMAa71e3R9PwWxm5pn+svRMGXddUVeog52ml2qfSpgqUGGUAZjpAc8A98t87QyQw0 V2ElM+vAiZg2JWXQ3+A8rafrRupJDMYa2QFYEcsTxYB4tTliJE+iFTIVNkLLUKupoSrQ3eqm WnM9XVgweVI5SIW60ml1QvXvgmDj5TXcg849CfcbEidxyhTZpHwMuRE9mPnxfpHKY+YSHyIs 34Fh9WS4YgyMH2dqMCeaL5TRe/0vp5pJBWZ2AcyRMd5q1xB7lb5JehtDCdCyFCF2yruURvge wfttAxY//e/11P6PPYsM+pd5ynHpJUM9OgJtNiJN7KigbArLWdrGR2Cg2bKhAgBd2B2zckC1 W+zK5rEMJrjIf0PIMCKb+kcy6Q34Ss12HneQ5v2pzz+j+bBNC7KFOhUagXTBgzc0E9iiF+Jm zq4H5HXoyizrcWkOnWHmWLtBQ5iwYcH6WDe9JUMK7/rzvtOE2A9Ef7BqY7NiKQ+95m5Ytzgp ynnMmcBkQKXrSSedW2iNyAyAJuyDM0XhS9qYkQR0aOAhiFLjXCHt/xEKfPavNAPqYRe8BKDZ 6JcKpvaXagXFGivFvZ0RcCVkbGOvS+D3WqmVxdJqhBmF3K8b2QlIuPZQzY= IronPort-HdrOrdr: A9a23:553kS6zma+xs4wBx6yPBKrPwFL1zdoMgy1knxilNoRw8SKKlfq eV7ZImPH7P+U4ssR4b+exoVJPtfZqYz+8R3WBzB8bEYOCFghrKEGgK1+KLqFeMJ8S9zJ846U 4JSdkGNDSaNzlHZKjBjzVQa+xQouW6zA== X-IronPort-AV: E=Sophos;i="5.90,201,1643691600"; d="scan'208";a="69219496" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu , Bertrand Marquis , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [XEN PATCH v10 1/7] build: grab common EFI source files in arch specific dir Date: Tue, 22 Mar 2022 11:22:32 +0000 Message-ID: <20220322112238.1117737-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322112238.1117737-1-anthony.perard@citrix.com> References: <20220322112238.1117737-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1647948200504100001 Content-Type: text/plain; charset="utf-8" Rather than preparing the efi source file, we will make the symbolic link as needed from the build location. The `ln` command is run every time to allow to update the link in case the source tree change location. This patch also introduce "efi-common.mk" which allow to reuse the common make instructions without having to duplicate them into each arch. And now that we have a list of common source file, we can start to remove the links to the source files on clean. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich Acked-by: Julien Grall --- Notes: v10: - acked - small change to comment in efi_common.mk - rebased, removed change "subdir- +=3D efi" in xen/arch/x86/Makefile as it isn't needed anymore. =20 v9: - rename efi_common.mk to efi-common.mk - generalize comment about cleaning "efi" and "boot" subdir in x86. - add a space after the other comma of $(patsubst ) - create a relative symlink instead of an absolute one - with the above, we don't need to use $(abs_srctree) anymore in the prerequisite of the link to the efi source file, use $(srctree). =20 v8: - use symbolic link instead of making a copy of the source - introduce efi_common.mk - remove links to source file on clean - use -iquote for "efi.h" headers in common/efi xen/Makefile | 5 ----- xen/arch/arm/efi/Makefile | 4 ++-- xen/arch/x86/efi/Makefile | 5 +---- xen/common/efi/efi-common.mk | 15 +++++++++++++++ 4 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 xen/common/efi/efi-common.mk diff --git a/xen/Makefile b/xen/Makefile index 18a4f7e1015a..dec489f2a909 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -441,11 +441,6 @@ $(TARGET).gz: $(TARGET) $(TARGET): FORCE $(Q)$(MAKE) $(build)=3Dtools $(Q)$(MAKE) $(build)=3D. include/xen/compile.h - [ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch])= ; \ - do test -r arch/$(TARGET_ARCH)/efi/$$f || \ - ln -nsf ../../../common/efi/$$f arch/$(TARGET_ARCH)/efi/; \ - done; \ - true $(Q)$(MAKE) $(build)=3Dinclude all $(Q)$(MAKE) $(build)=3Darch/$(TARGET_ARCH) include $(Q)$(MAKE) $(build)=3D. arch/$(TARGET_ARCH)/include/asm/asm-offsets.h diff --git a/xen/arch/arm/efi/Makefile b/xen/arch/arm/efi/Makefile index 1b1ed06feddc..4313c390665f 100644 --- a/xen/arch/arm/efi/Makefile +++ b/xen/arch/arm/efi/Makefile @@ -1,4 +1,4 @@ -CFLAGS-y +=3D -fshort-wchar +include $(srctree)/common/efi/efi-common.mk =20 -obj-y +=3D boot.init.o pe.init.o ebmalloc.o runtime.o +obj-y +=3D $(EFIOBJ-y) obj-$(CONFIG_ACPI) +=3D efi-dom0.init.o diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index e08b4d8e4808..034ec87895df 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -1,4 +1,4 @@ -CFLAGS-y +=3D -fshort-wchar +include $(srctree)/common/efi/efi-common.mk =20 quiet_cmd_objcopy_o_ihex =3D OBJCOPY $@ cmd_objcopy_o_ihex =3D $(OBJCOPY) -I ihex -O binary $< $@ @@ -8,9 +8,6 @@ $(obj)/%.o: $(src)/%.ihex FORCE =20 $(obj)/boot.init.o: $(obj)/buildid.o =20 -EFIOBJ-y :=3D boot.init.o pe.init.o ebmalloc.o runtime.o -EFIOBJ-$(CONFIG_COMPAT) +=3D compat.o - $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary= =3D4) $(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary :=3D $(cflags-stac= k-boundary) =20 diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk new file mode 100644 index 000000000000..960d44a6d55b --- /dev/null +++ b/xen/common/efi/efi-common.mk @@ -0,0 +1,15 @@ +EFIOBJ-y :=3D boot.init.o pe.init.o ebmalloc.o runtime.o +EFIOBJ-$(CONFIG_COMPAT) +=3D compat.o + +CFLAGS-y +=3D -fshort-wchar +CFLAGS-y +=3D -iquote $(srctree)/common/efi + +# Part of the command line transforms $(obj) +# e.g.: It transforms "dir/foo/bar" into successively +# "dir foo bar", ".. .. ..", "../../.." +$(obj)/%.c: $(srctree)/common/efi/%.c FORCE + $(Q)ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))/comm= on/efi/$( (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1647948196849859.4392773683887; Tue, 22 Mar 2022 04:23:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.293377.498397 (Exim 4.92) (envelope-from ) id 1nWcbE-0002Nd-7v; Tue, 22 Mar 2022 11:22:52 +0000 Received: by outflank-mailman (output) from mailman id 293377.498397; Tue, 22 Mar 2022 11:22:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbE-0002NQ-3t; Tue, 22 Mar 2022 11:22:52 +0000 Received: by outflank-mailman (input) for mailman id 293377; Tue, 22 Mar 2022 11:22:51 +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 1nWcbC-0001pm-RB for xen-devel@lists.xenproject.org; Tue, 22 Mar 2022 11:22:51 +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 67a30a1c-a9d2-11ec-a405-831a346695d4; Tue, 22 Mar 2022 12:22:49 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 67a30a1c-a9d2-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1647948169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=me6cYbyjxTaz58GzY4A+RYvN1kF6kozo10n0R4eb5yI=; b=JOp0xW9GIavx2jrWE6OKq7JOqjegrN0DztPHigeFk+876ungG0LDdT2e FQgqzvY+qb0P6Sg3k1BELgnzHGJxC6ITRWm5MVKWlNb8KSDV2yNSwZh02 wdv41jueiS1H79esM3V4mDaZMz/A/ASVbvY3pUWUuyw7zHNGS/Q45/Wv3 M=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 66847200 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:ZNz+v6tfiBodvmGImFpRualVUufnVKVeMUV32f8akzHdYApBsoF/q tZmKWCAaauNNjOgfYskaoq39EoEuJPVyIdhSgto/iw0HilD+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/nOHNIQMcacUsxLbVYMpBwJ1FQyw4bVvqYy2YLjW1jX4 4uoyyHiEATNNwBcYzp8B52r8HuDjNyq0N/PlgVjDRzjlAa2e0g9VPrzF4noR5fLatA88tqBb /TC1NmEElbxpH/BPD8HfoHTKSXmSpaKVeSHZ+E/t6KK2nCurQRquko32WZ1he66RFxlkvgoo Oihu6BcRi8RGKP9xeYBayUAUAhiF59Ppb2aC2mW5Jn7I03uKxMAwt1rBUAye4YZ5vx2ESdF8 vlwxDIlN07ZwbjsmfTiF7cq1p9LwMrDZevzvllpyy3ZCvA3B4jOWazQ6fdT3Ssqh9AIFvHbD yYcQWQxPEifOUUXUrsRIL8s3+v5j0fbTx4b9m6Z/Idr5VbezQMkhdABN/KKI4fXFK25hH2wr G/c437wBB1cMdWF0CeE6VqlnOqJliT+MKoNEJWo+/gsh0ecrkQQDxsMXFf9vvi9iWa5QdtUL 0FS8S0rxYAM80isQsj4TgePineOtR4BWPJdC+Q/rgqKz8L84QyUG2wFRT5pc8E9uYk9QjlC/ k+EmZblCCJitJWRSGmB7fGEoDWqIy8XIGQeIygeQmMt+ML/qYs+ihbOSNdLE6OviNDxXzbqz FiirjU6hrgVpd4G0eO851+vvt63jsGXFEhvvFyRBz/7qFMiDGK4W2C2wWD948cdLpqhcgHCl WQuqcHD7r0kHLjYwURhX94xNL2u4v+ENhjVjlhuA4Qt+lyRxpKzQWxDyGogfRk0a67obResO RaO4l0JuPe/KVPwNcdKj5SN59PGJEQKPfDsTbjqY9VHefCdnyfXrXg1NSZ8M40A+XXAcJ3T2 7/GKK5A7l5AUMyLKQZaoc9HitfHIQhkmQvuqWjTlUjP7FZnTCf9pU05GFWPdPsly6iPvR/Y9 d1SX+PTlUkAAL2hP3aGq9BORbzvEZTdLcqqwyCwXrTeSjeK5Ul7U6OBqV/fU9INc1tpehfgo SjmBx4wJKvXjnzbMwSaAk2Pm5u0NauTWUkTZHR2VX7xgiBLSd/2sM83KstmFZF6pbcL5aMlE JE4lzCoX60npsLvoG9GM/EQbeVKKXyWuO55F3H8MWZlIMI4GVChFx2NVlKHyRTixxGf7aMWy 4BMHCuAKXbfb2yO1PrrVc8= IronPort-HdrOrdr: A9a23:R9tuA6BV382/h9DlHemq55DYdb4zR+YMi2TC1yhKJiC9Ffbo8P xG/c5rrCMc5wxxZJhNo7290ey7MBHhHP1OkO0s1NWZPDUO0VHAROoJ0WKh+UyEJ8SXzJ866U 4KScZD4bPLYWSS9fyKgzWFLw== X-IronPort-AV: E=Sophos;i="5.90,201,1643691600"; d="scan'208";a="66847200" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu , Bertrand Marquis , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Konrad Rzeszutek Wilk" , Ross Lagerwall Subject: [XEN PATCH v10 2/7] build: replace $(BASEDIR) by $(objtree) Date: Tue, 22 Mar 2022 11:22:33 +0000 Message-ID: <20220322112238.1117737-3-anthony.perard@citrix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322112238.1117737-1-anthony.perard@citrix.com> References: <20220322112238.1117737-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1647948198266100005 Content-Type: text/plain; charset="utf-8" We need to differentiate between source files and generated/built files. We will be replacing $(BASEDIR) by $(objtree) for files that are generated. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich Acked-by: Julien Grall Acked-by: Ross Lagerwall --- Notes: v9: - acked =20 v8: - rebased xen/Rules.mk | 2 +- xen/arch/arm/Makefile | 10 +++++----- xen/arch/x86/Makefile | 28 ++++++++++++++-------------- xen/common/Makefile | 2 +- xen/test/livepatch/Makefile | 12 ++++++------ 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index abeba1ab7494..7712bfa063e0 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -12,7 +12,7 @@ src :=3D $(obj) PHONY :=3D __build __build: =20 --include $(BASEDIR)/include/config/auto.conf +-include $(objtree)/include/config/auto.conf =20 include $(XEN_ROOT)/Config.mk include $(BASEDIR)/scripts/Kbuild.include diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 51ec2ba928e3..1d862351d111 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -90,21 +90,21 @@ ifeq ($(CONFIG_ARM_64),y) ln -sf $(@F) $@.efi endif =20 -$(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds +$(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ - $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 + $(objtree)/common/symbols-dummy.o -o $(@D)/.$(@F).0 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).0 \ - | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S $(MAKE) $(build)=3D$(@D) $(@D)/.$(@F).0.o $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).1 \ - | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S $(MAKE) $(build)=3D$(@D) $(@D)/.$(@F).1.o $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ $(@D)/.$(@F).1.o -o $@ $(NM) -pa --format=3Dsysv $(@D)/$(@F) \ - | $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \ + | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \ >$(@D)/$(@F).map rm -f $(@D)/.$(@F).[0-9]* =20 diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index b6b082ee1d14..7cea79ed2f8a 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -92,8 +92,8 @@ ifneq ($(CONFIG_HVM),y) $(obj)/x86_emulate.o: CFLAGS-y +=3D -Wno-unused-label endif =20 -efi-y :=3D $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \ - -O $(BASEDIR)/include/xen/compile.h ]; then \ +efi-y :=3D $(shell if [ ! -r $(objtree)/include/xen/compile.h -o \ + -O $(objtree)/include/xen/compile.h ]; then \ echo '$(TARGET).efi'; fi) \ $(space) efi-$(CONFIG_PV_SHIM_EXCLUSIVE) :=3D @@ -133,23 +133,23 @@ $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32 =20 CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI =20 -$(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds +$(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ - $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 + $(objtree)/common/symbols-dummy.o -o $(@D)/.$(@F).0 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).0 \ - | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \ + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ >$(@D)/.$(@F).0.S $(MAKE) $(build)=3D$(@D) $(@D)/.$(@F).0.o $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).1 \ - | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-= y) \ + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-= y) \ >$(@D)/.$(@F).1.S $(MAKE) $(build)=3D$(@D) $(@D)/.$(@F).1.o $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ $(orphan-handling-y) $(@D)/.$(@F).1.o -o $@ $(NM) -pa --format=3Dsysv $(@D)/$(@F) \ - | $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \ + | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \ >$(@D)/$(@F).map rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]* ifeq ($(CONFIG_XEN_IBT),y) @@ -202,28 +202,28 @@ note_file_option ?=3D $(note_file) =20 extra-$(XEN_BUILD_PE) +=3D efi.lds ifeq ($(XEN_BUILD_PE),y) -$(TARGET).efi: $(BASEDIR)/prelink.o $(note_file) $(obj)/efi.lds $(obj)/efi= /relocs-dummy.o $(obj)/efi/mkreloc +$(TARGET).efi: $(objtree)/prelink.o $(note_file) $(obj)/efi.lds $(obj)/efi= /relocs-dummy.o $(obj)/efi/mkreloc ifeq ($(CONFIG_DEBUG_INFO),y) $(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug inf= o from $(@F)" endif $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< $(rel= ocs-dummy) \ - $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o = $(@D)/.$(@F).$(base).0 &&) : + $(objtree)/common/symbols-dummy.o $(note_file_option) -o = $(@D)/.$(@F).$(base).0 &&) : $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0= ) >$(@D)/.$(@F).0r.S $(NM) -pa --format=3Dsysv $(@D)/.$(@F).$(VIRT_BASE).0 \ - | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s= .S + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s= .S $(MAKE) $(build)=3D$(@D) .$(@F).0r.o .$(@F).0s.o $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< \ $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -= o $(@D)/.$(@F).$(base).1 &&) : $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1= ) >$(@D)/.$(@F).1r.S $(NM) -pa --format=3Dsysv $(@D)/.$(@F).$(VIRT_BASE).1 \ - | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s= .S + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s= .S $(MAKE) $(build)=3D$(@D) .$(@F).1r.o .$(@F).1s.o $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \ $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(orphan-handling-y) $(note_fil= e_option) -o $@ $(NM) -pa --format=3Dsysv $(@D)/$(@F) \ - | $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/= $(@F).map + | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/= $(@F).map rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]* ifeq ($(CONFIG_XEN_IBT),y) $(SHELL) $(BASEDIR)/tools/check-endbr.sh $@ @@ -238,11 +238,11 @@ endif $(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ; =20 .PHONY: include -include: $(BASEDIR)/arch/x86/include/asm/asm-macros.h +include: $(objtree)/arch/x86/include/asm/asm-macros.h =20 $(obj)/asm-macros.i: CFLAGS-y +=3D -D__ASSEMBLY__ -P =20 -$(BASEDIR)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/M= akefile +$(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/M= akefile $(call filechk,asm-macros.h) =20 define filechk_asm-macros.h diff --git a/xen/common/Makefile b/xen/common/Makefile index dc8d3a13f5b8..30641a737231 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -74,7 +74,7 @@ obj-$(CONFIG_UBSAN) +=3D ubsan/ obj-$(CONFIG_NEEDS_LIBELF) +=3D libelf/ obj-$(CONFIG_HAS_DEVICE_TREE) +=3D libfdt/ =20 -CONF_FILE :=3D $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFI= G_CONFIG) +CONF_FILE :=3D $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(objtree)/)$(KCONFI= G_CONFIG) $(obj)/config.gz: $(CONF_FILE) gzip -n -c $< >$@ =20 diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile index e6fee84b69da..ddb07371315e 100644 --- a/xen/test/livepatch/Makefile +++ b/xen/test/livepatch/Makefile @@ -22,9 +22,9 @@ $(obj)/xen_hello_world.o: $(obj)/config.h $(obj)/config.h: $(obj)/xen_hello_world_func.o (set -e; \ echo "#define NEW_CODE_SZ $(call CODE_SZ,$<,xen_hello_world)"; \ - echo "#define MINOR_VERSION_SZ $(call CODE_SZ,$(BASEDIR)/xen-syms,xen_mi= nor_version)"; \ - echo "#define MINOR_VERSION_ADDR $(call CODE_ADDR,$(BASEDIR)/xen-syms,xe= n_minor_version)"; \ - echo "#define OLD_CODE_SZ $(call CODE_SZ,$(BASEDIR)/xen-syms,xen_extra_v= ersion)") > $@ + echo "#define MINOR_VERSION_SZ $(call CODE_SZ,$(objtree)/xen-syms,xen_mi= nor_version)"; \ + echo "#define MINOR_VERSION_ADDR $(call CODE_ADDR,$(objtree)/xen-syms,xe= n_minor_version)"; \ + echo "#define OLD_CODE_SZ $(call CODE_SZ,$(objtree)/xen-syms,xen_extra_v= ersion)") > $@ =20 $(obj)/modinfo.o: (set -e; \ @@ -42,7 +42,7 @@ $(obj)/modinfo.o: # not be built (it is for EFI builds), and that we do not have # the note.o.bin to muck with (as it gets deleted) # -$(obj)/note.o: $(BASEDIR)/xen-syms +$(obj)/note.o: $(objtree)/xen-syms $(OBJCOPY) -O binary --only-section=3D.note.gnu.build-id $< $@.bin $(OBJCOPY) $(OBJCOPY_MAGIC) \ --rename-section=3D.data=3D.livepatch.depends,alloc,load,readonly,dat= a,contents -S $@.bin $@ @@ -52,7 +52,7 @@ $(obj)/note.o: $(BASEDIR)/xen-syms # Append .livepatch.xen_depends section # with Xen build-id derived from xen-syms. # -$(obj)/xen_note.o: $(BASEDIR)/xen-syms +$(obj)/xen_note.o: $(objtree)/xen-syms $(OBJCOPY) -O binary --only-section=3D.note.gnu.build-id $< $@.bin $(OBJCOPY) $(OBJCOPY_MAGIC) \ --rename-section=3D.data=3D.livepatch.xen_depends,alloc,load,readonly= ,data,contents -S $@.bin $@ @@ -125,7 +125,7 @@ xen_action_hooks_norevert-objs :=3D xen_action_hooks_ma= rker.o xen_hello_world_func =20 EXPECT_BYTES_COUNT :=3D 8 CODE_GET_EXPECT=3D$(shell $(OBJDUMP) -d --insn-width=3D1 $(1) | sed -n -e = '/<'$(2)'>:$$/,/^$$/ p' | tail -n +2 | head -n $(EXPECT_BYTES_COUNT) | awk = '{$$0=3D$$2; printf "%s", substr($$0,length-1)}' | sed 's/.\{2\}/0x&,/g' | = sed 's/^/{/;s/,$$/}/g') -$(obj)/expect_config.h: $(BASEDIR)/xen-syms +$(obj)/expect_config.h: $(objtree)/xen-syms (set -e; \ echo "#define EXPECT_BYTES $(call CODE_GET_EXPECT,$<,xen_extra_version)"= ; \ echo "#define EXPECT_BYTES_COUNT $(EXPECT_BYTES_COUNT)") > $@ --=20 Anthony PERARD From nobody Wed May 15 23:20:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1647948204; cv=none; d=zohomail.com; s=zohoarc; b=K37gOvn4PIcq7Fo1OqVeX2dgYceH/+In59sQ8LjR0n/MHzYygGUho5NE24HiEdIbdkUowh53BEWrQlTb40awZlR32QwaDfE8ohcGNe97oGjs7yCCOTmmzAIeSZ6p2AdASbR7L1+/qrrbKOl0yKcPTiphbvVgcIOqyU5f6SWrwHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647948204; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ADUR7OWaB10aK34x1nZCPMKD1/q87eidy4o14E0hmhw=; b=anBLU9ACt01QL9+38gS6sUNOwN2Q+ZVJgw8Q+4RqnNaq8gVfiQbKsxohtUs438ZaF87KneZ3AlaYNnnISRqls3XyQs9zON9d6aiGsV+DrOxOEx6w7+XuVbfb+5uPpF8tbOgD9/Kxg1Zj3vMqEBdQqajPpr0SVV20ZewRgsfKCHA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 164794820402798.53197616231171; Tue, 22 Mar 2022 04:23:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.293378.498408 (Exim 4.92) (envelope-from ) id 1nWcbI-0002l4-ND; Tue, 22 Mar 2022 11:22:56 +0000 Received: by outflank-mailman (output) from mailman id 293378.498408; Tue, 22 Mar 2022 11:22:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbI-0002kr-HT; Tue, 22 Mar 2022 11:22:56 +0000 Received: by outflank-mailman (input) for mailman id 293378; Tue, 22 Mar 2022 11:22:55 +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 1nWcbG-0001pm-OC for xen-devel@lists.xenproject.org; Tue, 22 Mar 2022 11:22:54 +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 69ec4df0-a9d2-11ec-a405-831a346695d4; Tue, 22 Mar 2022 12:22:53 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 69ec4df0-a9d2-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1647948173; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b8QJw/R+95kdQ8nhsS0sB38nPXZyrRBhXuNV+PLsfNw=; b=SSWeHwBAekoRIp9lmx79YfTsZW8bn8elVO4OJ4sluc0YhF5DbnNUKOm3 RS3efiylicmjRNNwUudrg8y+Oup66Xr+iAjNej4ryYSWz9WCckTnzjKIw fPObDq8R2LrNkAowJgETk2D5dByxgrrFRbXHSWVEml5AhBK7d2TReXl2I g=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 66847210 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:lYgdha2+shXEJwawxPbD5Qtxkn2cJEfYwER7XKvMYLTBsI5bp2YFy jYfXGqDOqmOZDChfth+aYyy9BtXv5fdmIA3HAVrpC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkjk7xdOCn9xGQ7InQLlbGILes1htZGEk1EE/NtTo5w7Rj2tUy24Dja++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1B7LmJYDkSMZTPwuQBahoHFSZ5JoFvreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHiOp8fvXdxiynUF/88TbjIQrnQ5M8e1zA17ixLNaiAN 5ZGM2M3BPjGSwVAIXMnVdEspcC5pCnbVxR7ggufn4NitgA/yyQuieOwYbI5YOeiXt5Jl0yVo mbH+WXRARwAMtGbjz2f/RqEmevnjS79HoUIG9WQ+vFmjVKJz0QPGRYWUh29uvD/hUmgM/pdN kgV9ywGvaU0skuxQbHVTxC+5XKJoBMYc95RCPEhrhGAzLLO5ASUDXRCSSROAPQkvsIrQT0h1 neSgsjkQzdotdW9RWqG87aIrRu7ISUPMXIZfigAUBcE5N/45oo0i3ryos1LSfDvyIevQHepn m7M/HNWa6gvYdAj2/yexHn5uD2VpcLJUjc2uQPQWXmJx1YsDGK6XLCA5V/e5PdGCY+WSFido XQJ8/SjAPAy4YKlz3LUHrhUdF29z7PcaWCH3wYzd3U03271k0NPa7y8992XyK1BFs8fMQHkb 0bI0e+6zM8CZSD6BUObjm/YNijL8UQCPYm8Phw3RoAXCnSUSONh1Hs1DaJ39zqx+HXAaYllZ f+mnT+EVB7285hPwjusXPs62rQ23C04zm67bcmlk0v3geXDOy/PF+pt3L6yggYRtv/sTOL9q Ys3Cid3408HDL2Wjtf/r+b/0mzm3VBkXMur+qS7h8aIIxZ8GXFJNhMi6ehJRmCRpIwMzr2g1 ijkAidwkQOj7VWaeVTiQi0yM9vHAMcgxU/XyARxZD5ELVB4Ot3xhEreHrNqFYQaGBtLlqclE aNaJ53eXpyiiF3volwgUHU0l6Q6HDzDuO5EF3fNjOQXF3K4ezH0xw== IronPort-HdrOrdr: A9a23:C3cf0K1HhrTSpAsxtZPqXwqjBIokLtp133Aq2lEZdPRUGvb3qy nIpoV86faUskdoZJhOo7C90cW7LU80sKQFhLX5Xo3SOzUO2lHYT72KhLGKq1aLdhEWtNQtsZ uIG5IOceEYZmIasS+V2maF+q4bsbu6zJw= X-IronPort-AV: E=Sophos;i="5.90,201,1643691600"; d="scan'208";a="66847210" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , "Daniel P . Smith" , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Daniel De Graaf Subject: [XEN PATCH v10 3/7] build: replace $(BASEDIR) and use $(srctree) Date: Tue, 22 Mar 2022 11:22:34 +0000 Message-ID: <20220322112238.1117737-4-anthony.perard@citrix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322112238.1117737-1-anthony.perard@citrix.com> References: <20220322112238.1117737-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1647948204352100001 Content-Type: text/plain; charset="utf-8" $(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=3D$(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 Reviewed-by: Daniel P. Smith # XSM --- Notes: v10: - rebased: use $(srctree) for ./tools/check-endbr.sh =20 v9: - acked - reword "# shortcut for $(srctree)/$(src)" into "# shortcuts" in both places. =20 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/Makefile | 4 ++-- 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 +++++----- 12 files changed, 35 insertions(+), 30 deletions(-) diff --git a/xen/Kconfig b/xen/Kconfig index d134397a0ba6..ec2bd9fbcfaa 100644 --- a/xen/Kconfig +++ b/xen/Kconfig @@ -14,14 +14,14 @@ config CC_IS_GCC =20 config GCC_VERSION int - default $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC)) + default $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) =20 config CC_IS_CLANG def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) =20 config CLANG_VERSION int - default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC)) + default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) =20 # -fvisibility=3Dhidden reduces -fpic cost, if it's available config CC_HAS_VISIBILITY_ATTRIBUTE diff --git a/xen/Makefile b/xen/Makefile index dec489f2a909..b89db5e8ab37 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -19,8 +19,7 @@ export PYTHON ?=3D $(PYTHON_INTERPRETER) =20 export CHECKPOLICY ?=3D checkpolicy =20 -export BASEDIR :=3D $(CURDIR) -export XEN_ROOT :=3D $(BASEDIR)/.. +export XEN_ROOT :=3D $(CURDIR)/.. =20 abs_objtree :=3D $(CURDIR) abs_srctree :=3D $(CURDIR) @@ -189,7 +188,7 @@ ifeq ($(TARGET_ARCH),x86) t1 =3D $(call as-insn,$(CC),".L0: .L1: .skip (.L1 - .L0)",,-no-integrated-= as) =20 # Check whether clang asm()-s support .include. -t2 =3D $(call as-insn,$(CC) -I$(BASEDIR)/arch/x86/include,".include \"asm/= asm-defns.h\"",,-no-integrated-as) +t2 =3D $(call as-insn,$(CC) -I$(srctree)/arch/x86/include,".include \"asm/= asm-defns.h\"",,-no-integrated-as) =20 # Check whether clang keeps .macro-s between asm()-s: # https://bugs.llvm.org/show_bug.cgi?id=3D36110 @@ -326,7 +325,7 @@ ALL_OBJS-$(CONFIG_CRYPTO) +=3D crypto/built_in.o =20 ALL_LIBS-y :=3D lib/lib.a =20 -include $(BASEDIR)/arch/$(TARGET_ARCH)/arch.mk +include $(srctree)/arch/$(TARGET_ARCH)/arch.mk =20 # define new variables to avoid the ones defined in Config.mk export XEN_CFLAGS :=3D $(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 =20 src :=3D $(obj) =20 +# shortcuts +srcdir :=3D $(srctree)/$(src) + PHONY :=3D __build __build: =20 -include $(objtree)/include/config/auto.conf =20 include $(XEN_ROOT)/Config.mk -include $(BASEDIR)/scripts/Kbuild.include +include $(srctree)/scripts/Kbuild.include =20 # Initialise some variables obj-y :=3D @@ -58,7 +61,7 @@ cmd_objcopy =3D $(OBJCOPY) $(OBJCOPYFLAGS) $< $@ # binfile # use e.g. $(call if_changed,binfile,binary-file varname) quiet_cmd_binfile =3D BINFILE $@ -cmd_binfile =3D $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2) +cmd_binfile =3D $(SHELL) $(srctree)/tools/binfile $(BINFILE_FLAGS) $@ $(2) =20 # Figure out what we need to build from the various variables # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D @@ -177,7 +180,7 @@ cpp_flags =3D $(filter-out -Wa$(comma)% -flto,$(1)) c_flags =3D -MMD -MP -MF $(depfile) $(XEN_CFLAGS) a_flags =3D -MMD -MP -MF $(depfile) $(XEN_AFLAGS) =20 -include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk +include $(srctree)/arch/$(TARGET_ARCH)/Rules.mk =20 c_flags +=3D $(_c_flags) a_flags +=3D $(_c_flags) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 7cea79ed2f8a..717bcbcac7a0 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -153,7 +153,7 @@ $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds >$(@D)/$(@F).map rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]* ifeq ($(CONFIG_XEN_IBT),y) - $(SHELL) $(BASEDIR)/tools/check-endbr.sh $@ + $(SHELL) $(srctree)/tools/check-endbr.sh $@ endif =20 $(obj)/note.o: $(TARGET)-syms @@ -226,7 +226,7 @@ endif | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/= $(@F).map rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]* ifeq ($(CONFIG_XEN_IBT),y) - $(SHELL) $(BASEDIR)/tools/check-endbr.sh $@ + $(SHELL) $(srctree)/tools/check-endbr.sh $@ endif else $(TARGET).efi: FORCE diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index c90e56aeab87..cfde143053fc 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -78,7 +78,7 @@ ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) efi-check :=3D arch/x86/efi/check =20 # Check if the compiler supports the MS ABI. -XEN_BUILD_EFI :=3D $(call if-success,$(CC) $(CFLAGS) -c $(efi-check).c -o = $(efi-check).o,y) +XEN_BUILD_EFI :=3D $(call if-success,$(CC) $(CFLAGS) -c $(srctree)/$(efi-c= heck).c -o $(efi-check).o,y) =20 # Check if the linker supports PE. EFI_LDFLAGS :=3D $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=3D10 diff --git a/xen/build.mk b/xen/build.mk index e718743ef772..758590c68eab 100644 --- a/xen/build.mk +++ b/xen/build.mk @@ -27,9 +27,9 @@ define cmd_compile.h -e 's/@@version@@/$(XEN_VERSION)/g' \ -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \ -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \ - -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "una= vailable")!g' \ + -e 's!@@changeset@@!$(shell $(srctree)/tools/scmversion $(XEN_ROOT) |= | echo "unavailable")!g' \ < $< > $(dot-target).tmp; \ - sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \ + sed -rf $(srctree)/tools/process-banner.sed < .banner >> $(dot-target).tm= p; \ mv -f $(dot-target).tmp $@; \ fi endef diff --git a/xen/common/Makefile b/xen/common/Makefile index 30641a737231..b1e076c30b81 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -80,7 +80,7 @@ $(obj)/config.gz: $(CONF_FILE) =20 $(obj)/config_data.o: $(obj)/config.gz =20 -$(obj)/config_data.S: $(BASEDIR)/tools/binfile FORCE +$(obj)/config_data.S: $(srctree)/tools/binfile FORCE $(call if_changed,binfile,$(obj)/config.gz xen_config_data) targets +=3D config_data.S =20 diff --git a/xen/common/libfdt/Makefile b/xen/common/libfdt/Makefile index 6708af12e583..75aaefa2e37f 100644 --- a/xen/common/libfdt/Makefile +++ b/xen/common/libfdt/Makefile @@ -6,7 +6,7 @@ OBJCOPYFLAGS :=3D $(foreach s,$(SECTIONS),--rename-section = .$(s)=3D.init.$(s)) obj-y +=3D libfdt.o nocov-y +=3D libfdt.o =20 -CFLAGS-y +=3D -I$(BASEDIR)/include/xen/libfdt/ +CFLAGS-y +=3D -I$(srctree)/include/xen/libfdt/ =20 $(obj)/libfdt.o: $(obj)/libfdt-temp.o FORCE $(call if_changed,objcopy) diff --git a/xen/include/Makefile b/xen/include/Makefile index a3c2511f5f60..5a2b4c9f65fa 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -45,22 +45,22 @@ public-$(CONFIG_ARM) :=3D $(wildcard $(src)/public/arch= -arm/*.h $(src)/public/arch .PHONY: all all: $(addprefix $(obj)/,$(headers-y)) =20 -$(obj)/compat/%.h: $(obj)/compat/%.i $(src)/Makefile $(BASEDIR)/tools/comp= at-build-header.py - $(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $(patsubst $(obj)/%= ,%,$@) >>$@.new; \ +$(obj)/compat/%.h: $(obj)/compat/%.i $(src)/Makefile $(srctree)/tools/comp= at-build-header.py + $(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst $(obj)/%= ,%,$@) >>$@.new; \ mv -f $@.new $@ =20 $(obj)/compat/%.i: $(obj)/compat/%.c $(src)/Makefile $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CF= LAGS)) $(cppflags-y) -o $@ $< =20 -$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(BAS= EDIR)/tools/compat-build-source.py +$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(src= tree)/tools/compat-build-source.py mkdir -p $(@D) - $(PYTHON) $(BASEDIR)/tools/compat-build-source.py $(src)/xlat.lst <$< >$@= .new + $(PYTHON) $(srctree)/tools/compat-build-source.py $(srcdir)/xlat.lst <$< = >$@.new mv -f $@.new $@ =20 -$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(BAS= EDIR)/tools/get-fields.sh $(src)/Makefile +$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(src= tree)/tools/get-fields.sh $(src)/Makefile export PYTHON=3D$(PYTHON); \ while read what name; do \ - $(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $< || exi= t $$?; \ + $(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name $< || exi= t $$?; \ done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename $<)).ls= t >$@.new mv -f $@.new $@ =20 @@ -70,7 +70,7 @@ $(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/Makefile grep -v '^[[:blank:]]*#' $< | sed -ne 's,@arch@,$(compat-arch-y),g' -re '= s,[[:blank:]]+$*\.h[[:blank:]]*$$,,p' >$@.new $(call move-if-changed,$@.new,$@) =20 -xlat-y :=3D $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:b= lank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(src)/xlat.lst | uniq) +xlat-y :=3D $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:b= lank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(srcdir)/xlat.lst | uniq) xlat-y :=3D $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y)) =20 $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/c= onfig/auto.conf $(src)/Makefile diff --git a/xen/scripts/Kconfig.include b/xen/scripts/Kconfig.include index e1f13e17207e..389a690a127a 100644 --- a/xen/scripts/Kconfig.include +++ b/xen/scripts/Kconfig.include @@ -40,4 +40,4 @@ $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' n= ot found) $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) =20 # gcc version including patch level -gcc-version :=3D $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC)) +gcc-version :=3D $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) diff --git a/xen/scripts/Makefile.clean b/xen/scripts/Makefile.clean index 4eed31974509..f97ecd3b8eee 100644 --- a/xen/scripts/Makefile.clean +++ b/xen/scripts/Makefile.clean @@ -5,9 +5,12 @@ =20 src :=3D $(obj) =20 +# shortcuts +srcdir :=3D $(srctree)/$(src) + clean:: =20 -include $(BASEDIR)/scripts/Kbuild.include +include $(srctree)/scripts/Kbuild.include =20 include $(src)/Makefile =20 diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile index 4ac6fb8778ae..a99038cb5722 100644 --- a/xen/xsm/flask/Makefile +++ b/xen/xsm/flask/Makefile @@ -8,8 +8,8 @@ CFLAGS-y +=3D -I$(obj)/include =20 AWK =3D awk =20 -FLASK_H_DEPEND :=3D $(addprefix $(src)/policy/,security_classes initial_si= ds) -AV_H_DEPEND =3D $(src)/policy/access_vectors +FLASK_H_DEPEND :=3D $(addprefix $(srcdir)/policy/,security_classes initial= _sids) +AV_H_DEPEND :=3D $(srcdir)/policy/access_vectors =20 FLASK_H_FILES :=3D flask.h class_to_string.h initial_sid_to_string.h AV_H_FILES :=3D av_perm_to_string.h av_permissions.h @@ -18,14 +18,14 @@ ALL_H_FILES :=3D $(addprefix include/,$(FLASK_H_FILES) = $(AV_H_FILES)) $(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(= ALL_H_FILES)) extra-y +=3D $(ALL_H_FILES) =20 -mkflask :=3D $(src)/policy/mkflask.sh +mkflask :=3D $(srcdir)/policy/mkflask.sh quiet_cmd_mkflask =3D MKFLASK $@ cmd_mkflask =3D $(SHELL) $(mkflask) $(AWK) $(obj)/include $(FLASK_H_DEPEND) =20 $(addprefix $(obj)/%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE $(call if_changed,mkflask) =20 -mkaccess :=3D $(src)/policy/mkaccess_vector.sh +mkaccess :=3D $(srcdir)/policy/mkaccess_vector.sh quiet_cmd_mkaccess =3D MKACCESS VECTOR $@ cmd_mkaccess =3D $(SHELL) $(mkaccess) $(AWK) $(obj)/include $(AV_H_DEPEND) =20 @@ -36,7 +36,7 @@ obj-bin-$(CONFIG_XSM_FLASK_POLICY) +=3D flask-policy.o $(obj)/flask-policy.o: $(obj)/policy.bin =20 $(obj)/flask-policy.S: BINFILE_FLAGS :=3D -i -$(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE +$(obj)/flask-policy.S: $(srctree)/tools/binfile FORCE $(call if_changed,binfile,$(obj)/policy.bin xsm_flask_init_policy) targets +=3D flask-policy.S =20 --=20 Anthony PERARD From nobody Wed May 15 23:20:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1647948195; cv=none; d=zohomail.com; s=zohoarc; b=VETo5iCfe/lQ+dTKJhD4vUiJQ3SqGBTMcTzk0siaz79Eal7PTzyQQ5sPUuo+ZVLEiPOdSNwsd+oFZUKjkiP3TtBhn9mxr07Vbya219sahYOmkED8NeRIXjb8xZ65lfwNovyJmPUOHowyF2rnUTIGOkB88G/DHKtcDknnIRg0fJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647948195; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RaJF/ik8UkWGPTkscbEmAgmt1RSXpW73wbZUf68Dtks=; b=BJVpQbjR/dxzaLLadvtf2quVi+V7Z0/G0/XwIaHWN3B9hiFg/tHqa5EqteA5CU2tCqKUCyaIJSOPjRsVmWCefMTd47l+RtFO04bR5BUEAUwn62wuSUMRrhIImOBYqRjPZP35s8tBFSnZwM3r9m6tvHwEbmB9kkO4D9p8Ltffpu0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1647948195638375.0930231279681; Tue, 22 Mar 2022 04:23:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.293379.498414 (Exim 4.92) (envelope-from ) id 1nWcbJ-0002pN-52; Tue, 22 Mar 2022 11:22:57 +0000 Received: by outflank-mailman (output) from mailman id 293379.498414; Tue, 22 Mar 2022 11:22:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbI-0002oJ-Sw; Tue, 22 Mar 2022 11:22:56 +0000 Received: by outflank-mailman (input) for mailman id 293379; Tue, 22 Mar 2022 11:22:56 +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 1nWcbI-0001pm-0C for xen-devel@lists.xenproject.org; Tue, 22 Mar 2022 11:22:56 +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 6b0fe40c-a9d2-11ec-a405-831a346695d4; Tue, 22 Mar 2022 12:22:54 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 6b0fe40c-a9d2-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1647948174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iCkD9kQGHEIpSeuGuWXlR9E5wrrWdyUrQlYnyc/6iyA=; b=gbgq4FBt48dLd45ULw6fWFMwuv7HLeSCrP1rc4TA9po4ztReBBAIz4qA I0DGmqvUzgv2UtT107r5BxW5vdtr4plWmBw20hbxQ3GcAWrH6xcoauH3s KHlV4J6B7p5D+wl3UHBzslQ5mQp+ww+1YIbzvgJuH1Uk9R4OfvINE46dp w=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 66847218 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:OBUPp6DgjqcyERVW/wTjw5YqxClBgxIJ4kV8jS/XYbTApDNwhmEBn TQeXTiPOvreMWCgKd93bojkoBxSvJLQy9BnQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaA4E/raNANlFEkvU2ybuOU5NXsZ2YgHWeIdA970Ug5w7Vj2NYy6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhWx 41xtMTqdzwzN4iUsqcWXx1YOgpHaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguwqKtXrO4UO/Glt1zjDAd4tQIzZQrWM7thdtNs1rp4QTaqBP ZNJAdZpRFfdfR5QE3UaM7l9kMCvgUPWdCJHqV3A8MLb5ECMlVcsgdABKuH9YceWTM9YmkKZo GPu/GnjBBwectuFxlKt7XaEluLJ2yThV+o6FqC89/NsqE2ewCoUEhJ+fUu2p7y1h1CzX/pbK lcI4Ww+oK4q7kupQ9LhGRqirxasvBQRRt5RGO0S8xyWx+zf5APxO4QfZmcfMpp87pZwHGF0k A/S9z/0OdBxmJqaEU6cru2qlim7HHA/bmQOYS8tZjJQtrEPv7oPph7IS99iFou8gdv0BSz8z li2kcQuu1kApZVVjvvmpDgrlxrp/8GUFVBtum07S0r/tmtEiJiZi5tEALQxxdJJN86nQ1aIp xDocODOvblVXflheMFgKdjh/Y1FBd7YaVUwYnY1RvHNEghBHVb5Jui8BxkkeC9U3j4sI2OBX aMqkVo5CGVvFHWrd7RrRIm6Ft4ny6Ptffy8CKyLPooRP8cgLlHalM2LWaJ29zqx+KTLuftiU ap3jO72VSpKYUiZ5GTeqxghPU8DmXllmDK7qWHTxBW7y7uODEN5up9eWGZimtsRtfveyC2Mq o43H5LTl313Db2vCgGKoNV7BQ1bchAG6WXe9pU/mhireVE9RgnMypb5nNscRmCSt/8Mx7mSo S3lBBMwJZiWrSSvFDhmo0tLMNvHNauTZ1pgVcDwFT5EA0QeXLs= IronPort-HdrOrdr: A9a23:WTwJz60mjJAYb4hxSXAOjQqjBIokLtp133Aq2lEZdPRUGvb3qy nIpoV86faUskdoZJhOo7C90cW7LU80sKQFhLX5Xo3SOzUO2lHYT72KhLGKq1aLdhEWtNQtsZ uIG5IOceEYZmIasS+V2maF+q4bsbu6zJw= X-IronPort-AV: E=Sophos;i="5.90,201,1643691600"; d="scan'208";a="66847218" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v10 4/7] build: rework "headers*.chk" prerequisite in include/ Date: Tue, 22 Mar 2022 11:22:35 +0000 Message-ID: <20220322112238.1117737-5-anthony.perard@citrix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322112238.1117737-1-anthony.perard@citrix.com> References: <20220322112238.1117737-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1647948196387100001 Content-Type: text/plain; charset="utf-8" Listing public headers when out-of-tree build are involved becomes more annoying where every path to every headers needs to start with "$(srctree)/$(src)", or $(wildcard ) will not work. This means more repetition. ( "$(srcdir)" is a shortcut for "$(srctree)/$(src)" ) This patch attempt to reduce the amount of duplication and make better use of make's meta programming capability. The filters are now listed in a variable and don't have to repeat the path to the headers files as this is added later as needed. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- Notes: v10: - acked =20 v9: - reorder *-headers variables - call public-filter-headers on $(public-c99-headers) as well, for this= I needed to rework $(public-c99-headers) and $(public-ansi-headers-filt= er) =20 v8: - add prefix "public-" to newly introduced macros. - make use of the new "$(srcdir)" shortcut. xen/include/Makefile | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index 5a2b4c9f65fa..fddf5a575bf6 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -39,8 +39,8 @@ cppflags-$(CONFIG_X86) +=3D -m32 =20 endif =20 -public-$(CONFIG_X86) :=3D $(wildcard $(src)/public/arch-x86/*.h $(src)/pub= lic/arch-x86/*/*.h) -public-$(CONFIG_ARM) :=3D $(wildcard $(src)/public/arch-arm/*.h $(src)/pub= lic/arch-arm/*/*.h) +public-$(CONFIG_X86) :=3D $(wildcard $(srcdir)/public/arch-x86/*.h $(srcdi= r)/public/arch-x86/*/*.h) +public-$(CONFIG_ARM) :=3D $(wildcard $(srcdir)/public/arch-arm/*.h $(srcdi= r)/public/arch-arm/*/*.h) =20 .PHONY: all all: $(addprefix $(obj)/,$(headers-y)) @@ -81,10 +81,23 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) =20 all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk =20 -PUBLIC_HEADERS :=3D $(filter-out $(src)/public/arch-% $(src)/public/dom0_o= ps.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h) $(public-y)) +public-hdrs-path :=3D $(srcdir)/public =20 -PUBLIC_C99_HEADERS :=3D $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h -PUBLIC_ANSI_HEADERS :=3D $(filter-out $(src)/public/%ctl.h $(src)/public/x= sm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) +public-list-headers =3D $(wildcard $1/*.h $1/*/*.h) +public-filter-headers =3D $(filter-out $(addprefix $(public-hdrs-path)/, $= ($1-filter)), $($1)) + +public-headers :=3D $(call public-list-headers, $(public-hdrs-path)) $(pub= lic-y) +public-ansi-headers :=3D $(public-headers) +public-c99-headers :=3D $(addprefix $(public-hdrs-path)/, io/9pfs.h io/pvc= alls.h) + +public-headers-filter :=3D dom0_ops.h arch-% +public-ansi-headers-filter :=3D %ctl.h xsm/% %hvm/save.h $(public-headers-= filter) \ + $(patsubst $(public-hdrs-path)/%,%,$(public-c99-headers)) +public-c99-headers-filter :=3D + +PUBLIC_HEADERS :=3D $(call public-filter-headers,public-headers) +PUBLIC_ANSI_HEADERS :=3D $(call public-filter-headers,public-ansi-headers) +PUBLIC_C99_HEADERS :=3D $(call public-filter-headers,public-c99-headers) =20 $(src)/public/io/9pfs.h-prereq :=3D string $(src)/public/io/pvcalls.h-prereq :=3D string --=20 Anthony PERARD From nobody Wed May 15 23:20:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1647948209; cv=none; d=zohomail.com; s=zohoarc; b=F1aOK3cOcnWMc8pXux7eKi6HDq0ZQ+gsKmrnLDf40b1UPraRKwW51uTDBZzifWuK/oTvO4RvhRU9Al9EXY8Wd7V4BW10C5aICPq4Ixn6Twts/LjDxYVtaDQP+yRE6akaMquKdmBBA0K3seOwWqHBCp9e50tdZYn0YZ56jkOJ5jE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647948209; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xX1HczG7AlaSfEB3m4JfW0whh9fv8AefAQSLpW7K0n0=; b=DA3k7J6Kh/U/GecBpcvMyH/rrbweuFYHMqgTJubq3wG8HFbaY4ViIquNHFF6SMmUvfHebQQKbkjQs41Gnn9NNM0NtZFTmGqsaqPOjKjSrsTlvsKpQE/FZ38KlaPzLYXd6GKHWh8728+/HFIKFLPpc0tApskVGTDZzrTmrHfkgQw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1647948209169911.0353313034358; Tue, 22 Mar 2022 04:23:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.293380.498430 (Exim 4.92) (envelope-from ) id 1nWcbM-0003O7-Dw; Tue, 22 Mar 2022 11:23:00 +0000 Received: by outflank-mailman (output) from mailman id 293380.498430; Tue, 22 Mar 2022 11:23:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbM-0003NY-8r; Tue, 22 Mar 2022 11:23:00 +0000 Received: by outflank-mailman (input) for mailman id 293380; Tue, 22 Mar 2022 11:22:58 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbK-0001wJ-Fa for xen-devel@lists.xenproject.org; Tue, 22 Mar 2022 11:22:58 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6bd3e32a-a9d2-11ec-8fbc-03012f2f19d4; Tue, 22 Mar 2022 12:22:57 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 6bd3e32a-a9d2-11ec-8fbc-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1647948177; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R0zm3Y05bQJeOGXKAYJjvGWdLoPynE+nukJHSpmCtbU=; b=V1qMucPUrWLjwSFhJhVLV9YIB67BIRugfgLMkHTa5ilXTv3897QzFjpY ApgNbUwXoZ0SOOP7+6H8eRD945ByvOnDguhysq50REFg1ji1H/rUQhiNg i1Nk8Ju2mXdc64LAwWIHnbI0/ubtBP+YHwC3jbHjzlUlCUKblNiXgsga5 8=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 69219510 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:RtEwra59ti4SouPIcWGPvgxRtBXHchMFZxGqfqrLsTDasY5as4F+v mofXm3SM/vZN2X0Koh2YN/l/U4AuZPcxodhGQJp/ygzHi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuVGuG96yE6j8lkf5KkYAL+EnkZqTRMFWFw0XqPp8Zj2tQy2YPjWVvX0 T/Pi5a31GGNimYc3l08s8pvmDs31BglkGpF1rCWTakjUG72zxH5PrpGTU2CByKQrr1vNvy7X 47+IISRpQs1yfuP5uSNyd4XemVSKlLb0JPnZnB+A8BOiTAazsA+PzpS2FPxpi67hh3Q9+2dx umhurT3FyQ2EbzPqt85XkADEHtsH4Z85ZnYdC3XXcy7lyUqclPpyvRqSko3IZcZ6qB8BmQmG f4wcW5XKErZ3qTvnez9GrIEascLdaEHOKsWvG1gyjfIS+4rW5nZT43B5MNC3Sd2jcdLdRrbT 5RIM2M+MU2YC/FJEklIC8kxhviXukilWTx7t1jW+Jg5slGGmWSd15CyaYGIK7RmX/59hV2Er 2jL+2D4BBAyN9GFzzeBtHW2iYfngifTSI8UUrqi+ZZCgkCXx2EVIA0bUx28u/bRol6zXZdTJ lIZ/gIqrLMu7wq7Q9/lRRq6rXWY+BkGVLJ4Eec39QWMwar8+BuCCy4PSTspVTA9nJZoH3pwj AbPxo63Q2w02FGIdZ6D3vDKjiydKCsnFksPPHQHFxknyOP+hp5m23ojUe1fOKKyi9T0HxT5z DaLsDUyit0vsCIb60mo1QuZ2mzx//AlWiZwv1yKBTz9smuVcab/P+SVBU7nAeGsxWpzZn2Ip zA6lseX94ji5rndxXXWEI3h8FxEjstp0QEwY3YyRvHNFBz3ohZPmLy8Bhkkfy+F1e5eJVfUj Lf741852XOqFCLCgVVLS4ywEd826qPrCM7oUPvZBvIXPMQuJF/YoX4/PxDNt4wIrKTKuftjU Xt8WZzxZUv29Iw9lGbmLwvj+eFDKt8CKZP7GsmgkkXPPUu2b3+JU7YVWGZinchihJ5oVD79q o4FX+PTkk03eLSnPkH/rN5CRXhXfCNTLc2n9KRqmhurf1MO9JcJUKSKn9vMuuVNwsxoqws/1 irkCxEClwan2yGvxMfjQikLVY4DlK1X9RoTVRHA937ys5T/Se5DNJsiSqY= IronPort-HdrOrdr: A9a23:DnSDdqnEl1esVc5er5N7tKYaip3pDfIm3DAbv31ZSRFFG/Fxl6 iV88jzsiWE7Qr5OUtQ/uxoV5PgfZqxz/NICOoqTNWftWvd2FdARbsKheCJ/9SJIVybygc378 ldmsZFZOEYdWIK7vrH3A== X-IronPort-AV: E=Sophos;i="5.90,201,1643691600"; d="scan'208";a="69219510" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v10 5/7] build: specify source tree in include/ for prerequisite Date: Tue, 22 Mar 2022 11:22:36 +0000 Message-ID: <20220322112238.1117737-6-anthony.perard@citrix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322112238.1117737-1-anthony.perard@citrix.com> References: <20220322112238.1117737-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1647948210533100001 Content-Type: text/plain; charset="utf-8" When doing an out-of-tree build, and thus setting VPATH, GNU Make 3.81 on Ubuntu Trusty complains about Circular dependency of include/Makefile and include/xlat.lst and drop them. The build fails later due to headers malformed. This might be due to bug #13529 "Incorrect circular dependancy" https://savannah.gnu.org/bugs/?13529 which was fixed in 3.82. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- Notes: v10: - acked =20 v9: - add potential bug report link in commit message =20 v8: - make use of the new "$(srcdir)" shortcut - move the patch ahead of the problematic patch: build: adding out-of-tree support to the xen build xen/include/Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index fddf5a575bf6..c8c4bcd93bd3 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -45,19 +45,19 @@ public-$(CONFIG_ARM) :=3D $(wildcard $(srcdir)/public/a= rch-arm/*.h $(srcdir)/publi .PHONY: all all: $(addprefix $(obj)/,$(headers-y)) =20 -$(obj)/compat/%.h: $(obj)/compat/%.i $(src)/Makefile $(srctree)/tools/comp= at-build-header.py +$(obj)/compat/%.h: $(obj)/compat/%.i $(srcdir)/Makefile $(srctree)/tools/c= ompat-build-header.py $(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst $(obj)/%= ,%,$@) >>$@.new; \ mv -f $@.new $@ =20 -$(obj)/compat/%.i: $(obj)/compat/%.c $(src)/Makefile +$(obj)/compat/%.i: $(obj)/compat/%.c $(srcdir)/Makefile $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CF= LAGS)) $(cppflags-y) -o $@ $< =20 -$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(src= tree)/tools/compat-build-source.py +$(obj)/compat/%.c: $(src)/public/%.h $(srcdir)/xlat.lst $(srcdir)/Makefile= $(srctree)/tools/compat-build-source.py mkdir -p $(@D) $(PYTHON) $(srctree)/tools/compat-build-source.py $(srcdir)/xlat.lst <$< = >$@.new mv -f $@.new $@ =20 -$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(src= tree)/tools/get-fields.sh $(src)/Makefile +$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(src= tree)/tools/get-fields.sh $(srcdir)/Makefile export PYTHON=3D$(PYTHON); \ while read what name; do \ $(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name $< || exi= t $$?; \ @@ -65,7 +65,7 @@ $(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/= .xlat/%.lst $(srctree)/ mv -f $@.new $@ =20 .PRECIOUS: $(obj)/compat/.xlat/%.lst -$(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/Makefile +$(obj)/compat/.xlat/%.lst: $(srcdir)/xlat.lst $(srcdir)/Makefile mkdir -p $(@D) grep -v '^[[:blank:]]*#' $< | sed -ne 's,@arch@,$(compat-arch-y),g' -re '= s,[[:blank:]]+$*\.h[[:blank:]]*$$,,p' >$@.new $(call move-if-changed,$@.new,$@) @@ -73,7 +73,7 @@ $(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/Makefile xlat-y :=3D $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:b= lank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(srcdir)/xlat.lst | uniq) xlat-y :=3D $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y)) =20 -$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/c= onfig/auto.conf $(src)/Makefile +$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/c= onfig/auto.conf $(srcdir)/Makefile cat $(filter %.h,$^) >$@.new mv -f $@.new $@ =20 @@ -102,7 +102,7 @@ PUBLIC_C99_HEADERS :=3D $(call public-filter-headers,pu= blic-c99-headers) $(src)/public/io/9pfs.h-prereq :=3D string $(src)/public/io/pvcalls.h-prereq :=3D string =20 -$(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(src)/Makefile +$(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(srcdir)/Makefile for i in $(filter %.h,$^); do \ $(CC) -x c -ansi -Wall -Werror -include stdint.h \ -S -o /dev/null $$i || exit 1; \ @@ -110,7 +110,7 @@ $(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(src)/Makef= ile done >$@.new mv $@.new $@ =20 -$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(src)/Makefile +$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(srcdir)/Makefile rm -f $@.new $(foreach i, $(filter %.h,$^), \ echo "#include "\"$(i)\" \ @@ -120,7 +120,7 @@ $(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(src)/Make= file || exit $$?; echo $(i) >> $@.new;) mv $@.new $@ =20 -$(obj)/headers++.chk: $(PUBLIC_HEADERS) $(src)/Makefile +$(obj)/headers++.chk: $(PUBLIC_HEADERS) $(srcdir)/Makefile rm -f $@.new if ! $(CXX) -v >/dev/null 2>&1; then \ touch $@.new; \ --=20 Anthony PERARD From nobody Wed May 15 23:20:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1647948200; cv=none; d=zohomail.com; s=zohoarc; b=RsoAT+ITHKseIVl6W8aTZhjfWNTDlsgGHGfCxDqTpuHoVbmFMvZYbYGr4ZFYEonEZMMaKCKV73gQ0TQlnNVWyQTwazCGJTWl7lzCt+sH6i3UjSRBMDeXR0yNm8v0t34iY/6M49MFXgKj6nvbM49PCx+ECPDPplfptnUXwPEHXjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647948200; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VpTzoDZ7N6l1pGFqYWsmrhFOkDdTqx65PfjWwh7RWzw=; b=GnY91xmlJ9ES0Lfo2KMevYpaVXP3+VNjs+YQJE86+e/CGwQKcA3v6IkLYQefaYiyW5Awep3EZgPP0OFpS3XFN63kcu9slqcmXNE93czTGrCWv8YiQCMl9vnPC2320DEjrgcii6megiR10oYa+OrYAR3bY2w3Xv8s18c1r4Z72+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1647948200448370.7006514395448; Tue, 22 Mar 2022 04:23:20 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.293381.498441 (Exim 4.92) (envelope-from ) id 1nWcbO-0003oW-Tt; Tue, 22 Mar 2022 11:23:02 +0000 Received: by outflank-mailman (output) from mailman id 293381.498441; Tue, 22 Mar 2022 11:23:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbO-0003oC-Om; Tue, 22 Mar 2022 11:23:02 +0000 Received: by outflank-mailman (input) for mailman id 293381; Tue, 22 Mar 2022 11:23:00 +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 1nWcbM-0001pm-FX for xen-devel@lists.xenproject.org; Tue, 22 Mar 2022 11:23:00 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6cd33d40-a9d2-11ec-a405-831a346695d4; Tue, 22 Mar 2022 12:22:59 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 6cd33d40-a9d2-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1647948179; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PmhrQkgIv1T+ZSzGTSleStlqC/GW0kKEBuZmpFtrCLE=; b=ej+KmAEynk6+nDQdeTEDJcDGq1Qw71mRAq6ORUCYmqKupx8G3YnwIDI9 Ph6/QGRZKsvPAebkk4YrV5f0DT5MSgYLKweNdah6ykqdOLZ4DjQ+wbiPs WoQqgjwy9PKcw4w2aA891QFj1+uKr5+kgnOy2dWm+h+TFbr29+pUQTDXC I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 66766639 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:PWe3MqkCYIVnJ1guWqpXd43o5gysJkRdPkR7XQ2eYbSJt1+Wr1Gzt xIWXmvVaPeMYmb8LYxyPt6x9EsDuJTXmoVmTgdk/H0xFSMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2EoLd9IR2NYy24DiWVnV4 7senuWEULOb828sWo4rw/rrRCNH5JwebxtB4zTSzdgS1LPvvyF94KA3fMldHFOhKmVgJcaoR v6r8V2M1jixEyHBqD+Suu2TnkUiGtY+NOUV45Zcc/DKbhNq/kTe3kunXRa1hIg+ZzihxrhMJ NtxWZOYey0WAZTCsu4mYgh7LDFhO/0Z/vjWPi3q2SCT5xWun3rExvxvCAc9PJEC+/YxCmZLn RAaAGlTNFbZ3bvwme/lDLk37iggBJCD0Ic3s3d8zTbfHLA+TIrKWani7t5ExjYgwMtJGJ4yY uJHN2UxMkqbMnWjPH8UGpMEvaD4mEWlfjobuAyyp64ssmzMmVkZPL/Fb4OOJ43iqd9utl2Du mvM8mD9AxcbHN+S0zyI9jSrnOCntTz/cJIfEvu/7PECqF+Owm0eDjUGWF39puO24mauVtQaJ 0EK9y4Gqakp6FftXtT7Rwe/onOPolgbQdU4O+8w5RyJy6HUyx2EHWVCRTlEAOHKr+dvG2Zsj AXQ2Yq0W3o/69V5VE5x6J+mhwyNACY/J1QzdAw7XRQDs4bl55As20enoslYLIa5idj8GDfVy j+MrTQji7h7sfPnx5lX7nic3Wvy+8Ghohodo1yOAzn7tl8RiJuNPdTA1LTN0RpXwG91pHGlt WNMpcWR5ftm4XqlxH3UG7Vl8F1ECp+43NzgbbxHQsBJG9eFoSfLkWVsDNdWfhwB3iEsI2OBX aMrkVkNjKK/xVPzBUONX6q/Ct4x0Y/rHsn/W/bfY7JmO8YtK1/Xo3wxNBTOgggBdXTAd4llZ f93lu72UB4n5VlPlmLqF4/xL5d1rszB+Y8jbc+ilEn2uVZvTHWUVa0EIDOzghMRt8u5TPHu2 48HbaOikkwHOMWnO3W/2dNDfDgicClgbbir+pM/SwJ2Clc/cI3XI6SKmu1Jlk0Mt/k9q9okC VnmAx4GkgWj3SObQehIA1g6AI7SsV9EhSpTFUQR0ZyAghDPva7HAH8jSqYK IronPort-HdrOrdr: A9a23:MtDF9qk6WroXsGCSFTKQVgiSHd3pDfIU3DAbv31ZSRFFG/Fxl6 iV8sjzsiWE7gr5OUtQ4exoV5PhfZqxz/JICMwqTNKftWrdyQyVxeNZnOjfKlTbckWUnINgPO VbAsxD4bXLfCFHZK3BgTVQfexO/DD+ytHLudvj X-IronPort-AV: E=Sophos;i="5.90,201,1643691600"; d="scan'208";a="66766639" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v10 6/7] build: shuffle main Makefile Date: Tue, 22 Mar 2022 11:22:37 +0000 Message-ID: <20220322112238.1117737-7-anthony.perard@citrix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322112238.1117737-1-anthony.perard@citrix.com> References: <20220322112238.1117737-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1647948202292100003 Content-Type: text/plain; charset="utf-8" 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: v10: - acked =20 v9: - add some explanation in the commit message about why the code movement is needed. =20 v8: - new patch xen/Makefile | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/xen/Makefile b/xen/Makefile index b89db5e8ab37..889d91c68a42 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -19,17 +19,6 @@ export PYTHON ?=3D $(PYTHON_INTERPRETER) =20 export CHECKPOLICY ?=3D checkpolicy =20 -export XEN_ROOT :=3D $(CURDIR)/.. - -abs_objtree :=3D $(CURDIR) -abs_srctree :=3D $(CURDIR) - -export abs_srctree abs_objtree - -srctree :=3D . -objtree :=3D . -export srctree objtree - # Do not use make's built-in rules and variables MAKEFLAGS +=3D -rR =20 @@ -41,16 +30,6 @@ SRCARCH=3D$(shell echo $(ARCH) | \ -e s'/riscv.*/riscv/g') export ARCH SRCARCH =20 -# 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 :=3D $(XEN_TARGET_ARCH) -export TARGET_ARCH :=3D $(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 ?=3D .config =20 @@ -64,8 +43,6 @@ default: build .PHONY: dist dist: install =20 -include scripts/Kbuild.include - ifneq ($(root-make-done),y) # section to run before calling Rules.mk, but only once. =20 @@ -141,6 +118,17 @@ endif =20 export quiet Q KBUILD_VERBOSE =20 +abs_objtree :=3D $(CURDIR) +abs_srctree :=3D $(CURDIR) + +export abs_srctree abs_objtree + +srctree :=3D . +objtree :=3D . +export srctree objtree + +export XEN_ROOT :=3D $(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 =20 @@ -163,6 +151,18 @@ ifneq ($(filter %config,$(MAKECMDGOALS)),) config-build :=3D y endif =20 +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 :=3D $(XEN_TARGET_ARCH) +export TARGET_ARCH :=3D $(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 :=3D $(SHELL) export YACC =3D $(if $(BISON),$(BISON),bison) export LEX =3D $(if $(FLEX),$(FLEX),flex) --=20 Anthony PERARD From nobody Wed May 15 23:20:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1647948210; cv=none; d=zohomail.com; s=zohoarc; b=S3rZZkyhWxkN1g4Lj6XKuH8LNHtVfyOu9+fv4SRhpnDl2Qj60xFFVx8NZOyrcjsK9GqAHzxtB0gPFNeFMDxa4jnMyxo6m/BMyTyW73hREvZiOA1uG6MA4mpfwTm/VA44JLKdAORvR1G+M0X7Ca7Dc9WmZ5lDZNObHabf0w2F99A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647948210; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ooDCjQ9l6G7SFuxppqkEQE1JX1TKeBOxfGwHyblXsEo=; b=LAmHfTWVDgle4TpQZnL26D02oeYXvMpkw5+q836JHzmprOngM9KX33VK2oJ192U+LWrcRaJ8JSEPqWc7JWupYlrVknpBypUgGiXR6DmRq/WbQf5uMv/Hd9h9xYadXhk+KXpZIggBJ106+MyIcEHaQNlnjWGmLvewlAVq6EeEZvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1647948210839561.9961157542504; Tue, 22 Mar 2022 04:23:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.293383.498452 (Exim 4.92) (envelope-from ) id 1nWcbR-0004HA-CS; Tue, 22 Mar 2022 11:23:05 +0000 Received: by outflank-mailman (output) from mailman id 293383.498452; Tue, 22 Mar 2022 11:23:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWcbR-0004Gu-7O; Tue, 22 Mar 2022 11:23:05 +0000 Received: by outflank-mailman (input) for mailman id 293383; Tue, 22 Mar 2022 11:23:03 +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 1nWcbP-0001pm-F7 for xen-devel@lists.xenproject.org; Tue, 22 Mar 2022 11:23:03 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6ee55da6-a9d2-11ec-a405-831a346695d4; Tue, 22 Mar 2022 12:23:01 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 6ee55da6-a9d2-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1647948181; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7EuDIVgX0pirkg3sBr2XMOrnL0KxHz4Ebez1+VopRO4=; b=bhavVLt6O0+wx2PmQLT730Q8A8TJeXiRJ7nE9XZeLaTL3yIWkswa2Sep rqENQr69GW3q065y6Agkw4X71lT4ptLDgfvCRlxhF8TfmSQ2nDHZKKzkP w3HV6GVhcSEZ9Ioo0j8HFugeHfXQKSdy9zEC6RUJydL33FWpS5GSOioKV 0=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 66766645 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:3l8ZSqIl0IsAcH3kFE+RXJUlxSXFcZb7ZxGr2PjKsXjdYENS0jAHz WYdW2vVafvZYWT0Ld1yOdu/phlU7JKEzd81SAtlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokf0/0vrav67xZVF/fngqoDUUYYoAQgsA148IMsdoUg7wbRh2dQy2YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 PVO5cOWUUArB5TryeYScRRDED90bYQTrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBMDtIIMYvGAm1TzDBOwqaZvCX7/L9ZlT2zJYasVmQ6iBO ZRHNWcHgBLoZDFzeXBNNrAElb2YhlaubHp7pQy+uv9ii4TU5FMoi+W8WDbPQfSVQe1Fk0Deo XjJl0ziGQ0TPtGbzTuD81qvi/XJkCe9X5gdfJW0+fJnj0ea7nACAx0RE12gqL+2jVDWc9FYL VYd9mwxrKwx3EuxR9L5Uluzp3vslhwBX9tdFcUq5QfLzbDbiy6bDGUZSj9KaPQ9qdQ7Azct0 zehj97vQDBirrCRYXac7auP6yO/PzAPKm0PbjNCShEKi/Hhr5s6ihbnR9NqAqmzyNbyHFnYz yiRqSkih50alcMRy7ig5lfDni6toZ7SCAUy423qsnmNt10jItT/PsrxtAadva0owJulokepn HtUxO6Gq+I3NLbcliOvTf4OArv5zqPQWNHDumJHE54k/jWr3nese4FM/T1zTHtU3tY4lSzBO xGK514IjHNHFD7zNPIsPdrtYyg/5fK4fekJQMw4eTanjnJZUAactB9jakeLt4wGuBh9yPpvU Xt3nCvFMJr7NUiF5GfvLwv++eVyrszb+Y81bcqgp/hA+eDCDEN5sZ9fbDOzghkRtctoWjn9/ ddFLNetwB5CSuD4aSS/2ddNcQ9afSdmWsGs9ZE/mgu/zuxOQj1J5xj5m+5JRmCYt/4NyregE o+VBCe0N2YTdVWYcF7XOxiPmZvkXIplrGJTAMDfFQ3A5pTXWq72tP13X8JuJdEPrbU/pdYpH 6htU5jRWZxnF2WYkwnxmLGg9eSOgjzw3lnQV8dkCRBiF6Ndq/vhoYa1IFGwqHFQUkJad6IW+ tWd6+8SerJbLywKMSocQKvHI4+Z1ZTFpN9PYg== IronPort-HdrOrdr: A9a23:P/73pq7X6mYPEW0RXgPXwM7XdLJyesId70hD6qhwISY7TiX+rb HIoB17726MtN9/YhAdcLy7VZVoBEmsl6KdgrNhWYtKPjOHhILAFugLhuHfKn/bakjDH4ZmpM FdmsNFZuEYY2IXsS+D2njaL+od X-IronPort-AV: E=Sophos;i="5.90,201,1643691600"; d="scan'208";a="66766645" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , "Daniel P . Smith" , Julien Grall , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Konrad Rzeszutek Wilk" , Ross Lagerwall , Daniel De Graaf Subject: [XEN PATCH v10 7/7] build: adding out-of-tree support to the xen build Date: Tue, 22 Mar 2022 11:22:38 +0000 Message-ID: <20220322112238.1117737-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322112238.1117737-1-anthony.perard@citrix.com> References: <20220322112238.1117737-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1647948238064100001 Content-Type: text/plain; charset="utf-8" This implement out-of-tree support, there's two ways to create an out-of-tree build tree (after that, `make` in that new directory works): make O=3Dbuild mkdir build; cd build; make -f ../Makefile also works with an absolute path for both. This implementation only works if the source tree is clean, as we use VPATH. This patch copies most new code with handling out-of-tree build from Linux v5.12. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich Reviewed-by: Daniel P. Smith Acked-by: Julien Grall Tested-by: Julien Grall Acked-by: Ross Lagerwall (livepatch parts) --- Notes: v10: - rebased =20 v9: - acked - add "source -> ." symlink in the in-tree build as well. This allow to make relative symlink to the "common/efi/*.c" sources. - also now, the "source" symlink is removed on `distclean`, add added to .gitignore. =20 v8: - replace script/mkmakefile by cmd_makefile like it's been done in Linux 5.13. - fix GNU Make version, replace few 0.81 by 3.81. - reorder include header path in CFLAGS ( -I ), to have the $(objtree) paths listed before the $(srctree) paths. This will be usefull later if we allow to build out-of-tree from a dirty source tree. - make use of -iquote - sometime, add -iquote path even when not necessary when building in-t= ree. - extract code movement into a separate patch - make use of the new "$(srcdir)" shortcut - split command line in headers*.chk target into more lines .gitignore | 1 + xen/Makefile | 143 +++++++++++++++++++++++++++++++---- xen/Rules.mk | 11 ++- xen/arch/x86/arch.mk | 5 +- xen/arch/x86/boot/Makefile | 6 ++ xen/common/efi/efi-common.mk | 3 +- xen/include/Makefile | 11 ++- xen/test/livepatch/Makefile | 2 + xen/xsm/flask/Makefile | 3 +- xen/xsm/flask/ss/Makefile | 1 + 10 files changed, 164 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index d425be4bd9d7..c6d2c4b4f1e9 100644 --- a/.gitignore +++ b/.gitignore @@ -325,6 +325,7 @@ xen/include/xen/*.new xen/include/xen/acm_policy.h xen/include/xen/compile.h xen/include/xen/lib/x86/cpuid-autogen.h +xen/source xen/test/livepatch/config.h xen/test/livepatch/expect_config.h xen/test/livepatch/*.livepatch diff --git a/xen/Makefile b/xen/Makefile index 889d91c68a42..11057318e875 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -1,3 +1,7 @@ +# $(lastword,) for GNU Make older than 3.81 +lastword =3D $(word $(words $(1)),$(1)) +this-makefile :=3D $(call lastword,$(MAKEFILE_LIST)) + # This is the correct place to edit the build version. # All other places this is stored (eg. compile.h) should be autogenerated. export XEN_VERSION =3D 4 @@ -19,6 +23,13 @@ export PYTHON ?=3D $(PYTHON_INTERPRETER) =20 export CHECKPOLICY ?=3D checkpolicy =20 +$(if $(filter __%, $(MAKECMDGOALS)), \ + $(error targets prefixed with '__' are only for internal use)) + +# That's our default target when none is given on the command line +PHONY :=3D __all +__all: + # Do not use make's built-in rules and variables MAKEFLAGS +=3D -rR =20 @@ -37,9 +48,6 @@ export CC CXX LD NM OBJCOPY OBJDUMP =20 export TARGET :=3D xen =20 -.PHONY: default -default: build - .PHONY: dist dist: install =20 @@ -118,16 +126,88 @@ endif =20 export quiet Q KBUILD_VERBOSE =20 +# $(realpath,) for GNU Make older than 3.81 +realpath =3D $(wildcard $(foreach file,$(1),$(shell cd -P $(dir $(file)) &= & echo "$$PWD/$(notdir $(file))"))) + +ifeq ("$(origin O)", "command line") + KBUILD_OUTPUT :=3D $(O) +endif + +ifneq ($(KBUILD_OUTPUT),) +# Make's built-in functions such as $(abspath ...), $(realpath ...) cannot +# expand a shell special character '~'. We use a somewhat tedious way here. +abs_objtree :=3D $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) = && pwd) +$(if $(abs_objtree),, \ + $(error failed to create output directory "$(KBUILD_OUTPUT)")) + +# $(realpath ...) resolves symlinks +abs_objtree :=3D $(call realpath,$(abs_objtree)) +else abs_objtree :=3D $(CURDIR) -abs_srctree :=3D $(CURDIR) +endif + +ifeq ($(abs_objtree),$(CURDIR)) +# Suppress "Entering directory ..." unless we are changing the work direct= ory. +MAKEFLAGS +=3D --no-print-directory +else +need-sub-make :=3D 1 +endif + +abs_srctree :=3D $(call realpath,$(dir $(this-makefile))) + +ifneq ($(words $(subst :, ,$(abs_srctree))), 1) +$(error source directory cannot contain spaces or colons) +endif + +ifneq ($(abs_srctree),$(abs_objtree)) +# Look for make include files relative to root of kernel src +# +# This does not become effective immediately because MAKEFLAGS is re-parsed +# once after the Makefile is read. We need to invoke sub-make. +MAKEFLAGS +=3D --include-dir=3D$(abs_srctree) +need-sub-make :=3D 1 +endif =20 export abs_srctree abs_objtree +export root-make-done :=3D y + +ifeq ($(need-sub-make),1) + +PHONY +=3D $(MAKECMDGOALS) __sub-make + +$(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make + @: + +# Invoke a second make in the output directory, passing relevant variables +__sub-make: + $(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS) + +endif # need-sub-make +endif # root-make-done + +# We process the rest of the Makefile if this is the final invocation of m= ake +ifeq ($(need-sub-make),) + +ifeq ($(abs_srctree),$(abs_objtree)) + # building in the source tree + srctree :=3D . + building_out_of_srctree :=3D +else + ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) + # building in a subdirectory of the source tree + srctree :=3D .. + else + srctree :=3D $(abs_srctree) + endif + building_out_of_srctree :=3D 1 +endif =20 -srctree :=3D . objtree :=3D . -export srctree objtree +VPATH :=3D $(srctree) + +export building_out_of_srctree srctree objtree VPATH =20 -export XEN_ROOT :=3D $(CURDIR)/.. +export XEN_ROOT :=3D $(abs_srctree)/.. =20 # 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 @@ -204,9 +284,6 @@ endif =20 export XEN_HAS_CHECKPOLICY :=3D $(call success,$(CHECKPOLICY) -h 2>&1 | gr= ep -q xen) =20 -export root-make-done :=3D y -endif # root-make-done - # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D # Rules shared between *config targets and build targets =20 @@ -214,6 +291,37 @@ PHONY +=3D tools_fixdep tools_fixdep: $(Q)$(MAKE) $(build)=3Dtools tools/fixdep =20 +PHONY +=3D outputmakefile +# Before starting out-of-tree build, make sure the source tree is clean. +# outputmakefile generates a Makefile in the output directory, if using a +# separate output directory. This allows convenient use of make in the +# output directory. +# At the same time when output Makefile generated, generate .gitignore to +# ignore whole output directory + +quiet_cmd_makefile =3D GEN Makefile +cmd_makefile =3D { \ + echo "\# Automatically generated by $(srctree)/Makefile: don't edit"; \ + echo "include $(srctree)/Makefile"; \ + } > Makefile + +outputmakefile: + $(Q)ln -fsn $(srctree) source +ifdef building_out_of_srctree + $(Q)if [ -f $(srctree)/.config -o \ + -d $(srctree)/include/config -o \ + -d $(srctree)/include/generated ]; then \ + echo >&2 "***"; \ + echo >&2 "*** The source tree is not clean, please run 'make$(if $(finds= tring command line, $(origin XEN_TARGET_ARCH)), XEN_TARGET_ARCH=3D$(XEN_TAR= GET_ARCH)) distclean'"; \ + echo >&2 "*** in $(abs_srctree)";\ + echo >&2 "***"; \ + false; \ + fi + $(call cmd,makefile) + $(Q)test -e .gitignore || \ + { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore +endif + ifeq ($(config-build),y) # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D # *config targets only - make sure prerequisites are updated, and descend @@ -229,13 +337,13 @@ filechk_kconfig_allconfig =3D \ .allconfig.tmp: FORCE set -e; { $(call filechk_kconfig_allconfig); } > $@ =20 -config: tools_fixdep FORCE +config: tools_fixdep outputmakefile FORCE $(Q)$(MAKE) $(build)=3Dtools/kconfig $@ =20 # Config.mk tries to include .config file, don't try to remake it %/.config: ; =20 -%config: .allconfig.tmp tools_fixdep FORCE +%config: .allconfig.tmp tools_fixdep outputmakefile FORCE $(Q)$(MAKE) $(build)=3Dtools/kconfig KCONFIG_ALLCONFIG=3D$< $@ =20 else # !config-build @@ -312,6 +420,10 @@ CFLAGS +=3D -flto LDFLAGS-$(CONFIG_CC_IS_CLANG) +=3D -plugin LLVMgold.so endif =20 +ifdef building_out_of_srctree + CFLAGS +=3D -I$(objtree)/include + CFLAGS +=3D -I$(objtree)/arch/$(TARGET_ARCH)/include +endif CFLAGS +=3D -I$(srctree)/include CFLAGS +=3D -I$(srctree)/arch/$(TARGET_ARCH)/include =20 @@ -335,6 +447,8 @@ export CFLAGS_UBSAN =20 endif # need-config =20 +__all: build + main-targets :=3D build install uninstall clean distclean MAP .PHONY: $(main-targets) ifneq ($(XEN_TARGET_ARCH),x86_32) @@ -431,13 +545,13 @@ _clean: =20 .PHONY: _distclean _distclean: clean - rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out GTAGS= GPATH GRTAGS GSYMS .config + rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out GTAGS= GPATH GRTAGS GSYMS .config source =20 $(TARGET).gz: $(TARGET) gzip -n -f -9 < $< > $@.new mv $@.new $@ =20 -$(TARGET): FORCE +$(TARGET): outputmakefile FORCE $(Q)$(MAKE) $(build)=3Dtools $(Q)$(MAKE) $(build)=3D. include/xen/compile.h $(Q)$(MAKE) $(build)=3Dinclude all @@ -506,6 +620,7 @@ cloc: done | cloc --list-file=3D- =20 endif #config-build +endif # need-sub-make =20 PHONY +=3D FORCE FORCE: diff --git a/xen/Rules.mk b/xen/Rules.mk index 57a029455586..70b7489ea89b 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -37,7 +37,7 @@ SPECIAL_DATA_SECTIONS :=3D rodata $(foreach a,1 2 4 8 16,= \ $(foreach r,rel rel.ro,data.$(r).local) =20 # The filename build.mk has precedence over Makefile -include $(firstword $(wildcard $(src)/build.mk) $(src)/Makefile) +include $(firstword $(wildcard $(srcdir)/build.mk) $(srcdir)/Makefile) =20 # Linking # ------------------------------------------------------------------------= --- @@ -328,6 +328,15 @@ existing-targets :=3D $(wildcard $(sort $(targets))) =20 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) =20 +# Create directories for object files if they do not exist +obj-dirs :=3D $(sort $(patsubst %/,%, $(dir $(targets)))) +# If targets exist, their directories apparently exist. Skip mkdir. +existing-dirs :=3D $(sort $(patsubst %/,%, $(dir $(existing-targets)))) +obj-dirs :=3D $(strip $(filter-out $(existing-dirs), $(obj-dirs))) +ifneq ($(obj-dirs),) +$(shell mkdir -p $(obj-dirs)) +endif + # Declare the contents of the PHONY variable as phony. We keep that # information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY) diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index cfde143053fc..fce2ef5b6732 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -77,6 +77,9 @@ ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) =20 efi-check :=3D arch/x86/efi/check =20 +# Create the directory for out-of-tree build +$(shell mkdir -p $(dir $(efi-check))) + # Check if the compiler supports the MS ABI. XEN_BUILD_EFI :=3D $(call if-success,$(CC) $(CFLAGS) -c $(srctree)/$(efi-c= heck).c -o $(efi-check).o,y) =20 @@ -116,4 +119,4 @@ export EFI_LDFLAGS endif =20 # Set up the assembler include path properly for older toolchains. -CFLAGS +=3D -Wa,-I$(srctree)/include +CFLAGS +=3D -Wa,-I$(objtree)/include -Wa,-I$(srctree)/include diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index ca8001c72b23..784655f5e2bd 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -7,11 +7,17 @@ targets +=3D $(head-srcs:.S=3D.o) =20 head-srcs :=3D $(addprefix $(obj)/, $(head-srcs)) =20 +ifdef building_out_of_srctree +$(obj)/head.o: CFLAGS-y +=3D -iquote $(obj) +endif $(obj)/head.o: $(head-srcs) =20 CFLAGS_x86_32 :=3D $(subst -m64,-m32 -march=3Di686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) CFLAGS_x86_32 +=3D -Werror -fno-builtin -g0 -msoft-float +ifdef building_out_of_srctree +CFLAGS_x86_32 +=3D -I$(objtree)/include +endif CFLAGS_x86_32 +=3D -I$(srctree)/include =20 # override for 32bit binaries diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk index 960d44a6d55b..4298ceaee71d 100644 --- a/xen/common/efi/efi-common.mk +++ b/xen/common/efi/efi-common.mk @@ -3,12 +3,13 @@ EFIOBJ-$(CONFIG_COMPAT) +=3D compat.o =20 CFLAGS-y +=3D -fshort-wchar CFLAGS-y +=3D -iquote $(srctree)/common/efi +CFLAGS-y +=3D -iquote $(srcdir) =20 # Part of the command line transforms $(obj) # e.g.: It transforms "dir/foo/bar" into successively # "dir foo bar", ".. .. ..", "../../.." $(obj)/%.c: $(srctree)/common/efi/%.c FORCE - $(Q)ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))/comm= on/efi/$(> $@.new;) mv $@.new $@ @@ -129,8 +130,9 @@ $(obj)/headers++.chk: $(PUBLIC_HEADERS) $(srcdir)/Makef= ile $(foreach i, $(filter %.h,$^), \ echo "#include "\"$(i)\" \ | $(CXX) -x c++ -std=3Dgnu++98 -Wall -Werror -D__XEN_TOOLS__ \ - -include stdint.h -include $(src)/public/xen.h \ - $(foreach j, $($(i)-prereq), -include c$(j)) -S -o /dev/null - \ + -include stdint.h -include $(srcdir)/public/xen.h \ + $(foreach j, $($(patsubst $(srctree)/%,%,$i)-prereq), -include c$(j= )) \ + -S -o /dev/null - \ || exit $$?; echo $(i) >> $@.new;) mv $@.new $@ =20 @@ -139,7 +141,8 @@ endif ifeq ($(XEN_TARGET_ARCH),x86_64) .PHONY: lib-x86-all lib-x86-all: - $(MAKE) -C $(obj)/xen/lib/x86 all + @mkdir -p $(obj)/xen/lib/x86 + $(MAKE) -C $(obj)/xen/lib/x86 -f $(abs_srctree)/$(src)/xen/lib/x86/Makefi= le all =20 all: lib-x86-all endif diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile index ddb07371315e..c258ab0b5940 100644 --- a/xen/test/livepatch/Makefile +++ b/xen/test/livepatch/Makefile @@ -11,6 +11,8 @@ endif CODE_ADDR=3D$(shell nm --defined $(1) | grep $(2) | awk '{print "0x"$$1}') CODE_SZ=3D$(shell nm --defined -S $(1) | grep $(2) | awk '{ print "0x"$$2}= ') =20 +CFLAGS-y +=3D -iquote $(obj) + extra-y +=3D xen_hello_world.livepatch xen_hello_world-objs :=3D xen_hello_world_func.o xen_hello_world.o note.o = xen_note.o modinfo.o $(obj)/xen_hello_world.o: $(obj)/config.h diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile index a99038cb5722..d25312f4fa1c 100644 --- a/xen/xsm/flask/Makefile +++ b/xen/xsm/flask/Makefile @@ -4,7 +4,8 @@ obj-y +=3D flask_op.o =20 obj-y +=3D ss/ =20 -CFLAGS-y +=3D -I$(obj)/include +CFLAGS-y +=3D -iquote $(obj)/include +CFLAGS-y +=3D -I$(srcdir)/include =20 AWK =3D awk =20 diff --git a/xen/xsm/flask/ss/Makefile b/xen/xsm/flask/ss/Makefile index aba1339f3808..ffe92ec19ed6 100644 --- a/xen/xsm/flask/ss/Makefile +++ b/xen/xsm/flask/ss/Makefile @@ -8,4 +8,5 @@ obj-y +=3D services.o obj-y +=3D conditional.o obj-y +=3D mls.o =20 +CFLAGS-y +=3D -iquote $(objtree)/xsm/flask/include CFLAGS-y +=3D -I$(srctree)/xsm/flask/include --=20 Anthony PERARD