From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.76]) by mx.groups.io with SMTP id smtpd.web12.7446.1585657155160798507 for ; Tue, 31 Mar 2020 05:19:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=3pyGlA4z; spf=pass (domain: arm.com, ip: 40.107.0.76, mailfrom: pierre.gondois@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8jUAmc0UFdo6IGGPTGZ9BzSXA5JKujRPPeRcMR72XJ4=; b=3pyGlA4zw09JLVktMPwKDjT2xp4ik7gq6VBu2ZWIqXlEET/KB8MooEwDFaRt6mxhY7k4oNhLctFmIPXySy6Ts/jQVoA10aoZtXprafwn2hjaUMkEIKyBTgMckzZUgf4FBakTyMLFNYYvLHuGRfLuWj98ql+/+0vGvZfX+m6fSAo= Received: from VI1PR0102CA0086.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::27) by AM6PR08MB3430.eurprd08.prod.outlook.com (2603:10a6:20b:43::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Tue, 31 Mar 2020 12:19:12 +0000 Received: from VE1EUR03FT061.eop-EUR03.prod.protection.outlook.com (2603:10a6:803:15:cafe::74) by VI1PR0102CA0086.outlook.office365.com (2603:10a6:803:15::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Tue, 31 Mar 2020 12:19:12 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT061.mail.protection.outlook.com (10.152.19.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.17 via Frontend Transport; Tue, 31 Mar 2020 12:19:12 +0000 Received: ("Tessian outbound 55454527ea3b:v50"); Tue, 31 Mar 2020 12:19:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fcff1c3dfb6479cd X-CR-MTA-TID: 64aa7808 Received: from ae0ea0bf1bb0.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 97A97276-7C94-4E70-B19C-AA16C394FCC2.1; Tue, 31 Mar 2020 12:19:06 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ae0ea0bf1bb0.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 31 Mar 2020 12:19:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l4MvPxOMS1XNNI15xOLX50gTl+SnOarVKlSzvK2c+0XQghA+5uXsuuZKhrf1M2/sFbFddNpjz6GcHhX4fsWdF7wXwkLGAXJylZ5366u51FfwGnOGx4PBgmVdkMgTxStLttTT+hI/Tx+6cN/8kxDXVuOIV/6Z1xrJvD2k6ywkZghBX6lItuPKqeSn7hOYLDgacVMoxP8/hUkXjkQQhr/mkHfiBC37DcWVcRGiSzqZhZhqALiS5+fielzS5lR/ZEDlfH7bmUd1J+miMwHnkaeAOf7B+6550mvjwRNdxisgMt3uFDp+dGz/pRdSXOAXapE2n6wcOdzOZCDc8eMIAJoLag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8jUAmc0UFdo6IGGPTGZ9BzSXA5JKujRPPeRcMR72XJ4=; b=hSWLGf0O0ATEWrQNZn+hF/Oy9V4ScPTubb89PMKkEQ4+FrAC4nZ7v54/oYXQtGnHWGq8bGpQZ21Di5CzBYEQijMau6SQcwPqBM65yWx/wTOiVU+dwbDFBLoa0uFDW+Tg6RCwaqq8UPZgLEOklTaN1uv8IZcfT9YbYxuRuIO07JoRb1P06kCqOQJyoQpaUDFFMzO4Bzc8PiiQ+pcWwKVbIEIN3BgntAx56aBiHdDH2Wz+nruEqsOR0/qzzHaod+akE7YlSOKWioWKYcXu8SaZrzxh2PTWXwNhqr7lD2i+qSRfpo7yKrDqXh+r1MUx2CywjvOljTr/GkJlLvNM4/Q+vA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8jUAmc0UFdo6IGGPTGZ9BzSXA5JKujRPPeRcMR72XJ4=; b=3pyGlA4zw09JLVktMPwKDjT2xp4ik7gq6VBu2ZWIqXlEET/KB8MooEwDFaRt6mxhY7k4oNhLctFmIPXySy6Ts/jQVoA10aoZtXprafwn2hjaUMkEIKyBTgMckzZUgf4FBakTyMLFNYYvLHuGRfLuWj98ql+/+0vGvZfX+m6fSAo= Received: from DB7PR08MB3113.eurprd08.prod.outlook.com (52.134.111.149) by DB7PR08MB3033.eurprd08.prod.outlook.com (52.134.107.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Tue, 31 Mar 2020 12:19:03 +0000 Received: from DB7PR08MB3113.eurprd08.prod.outlook.com ([fe80::60d3:1160:c077:67ed]) by DB7PR08MB3113.eurprd08.prod.outlook.com ([fe80::60d3:1160:c077:67ed%3]) with mapi id 15.20.2856.019; Tue, 31 Mar 2020 12:19:03 +0000 From: "PierreGondois" To: Pierre Gondois , "devel@edk2.groups.io" CC: "bob.c.feng@intel.com" , "liming.gao@intel.com" , Sami Mujawar , nd Subject: Re: [PATCH v4 1/1] BaseTools: Enable file dependencies in .inf files Thread-Topic: [PATCH v4 1/1] BaseTools: Enable file dependencies in .inf files Thread-Index: AQHWBq2eV5G03E83tUKW7PCW4/3Yj6hin27Q Date: Tue, 31 Mar 2020 12:19:03 +0000 Message-ID: References: <20200330160903.22184-1-pierre.gondois@arm.com> In-Reply-To: <20200330160903.22184-1-pierre.gondois@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Pierre.Gondois@arm.com; x-originating-ip: [217.140.99.251] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6143b2a3-f856-4d52-93c3-08d7d56db8b9 x-ms-traffictypediagnostic: DB7PR08MB3033:|DB7PR08MB3033:|AM6PR08MB3430: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:820;OLM:820; x-forefront-prvs: 0359162B6D X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR08MB3113.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10009020)(4636009)(366004)(396003)(136003)(39860400002)(376002)(346002)(7696005)(81156014)(5660300002)(26005)(4326008)(186003)(55016002)(81166006)(86362001)(8676002)(30864003)(9686003)(66446008)(316002)(110136005)(71200400001)(2906002)(66476007)(54906003)(64756008)(6506007)(66556008)(52536014)(8936002)(66946007)(966005)(33656002)(478600001)(53546011)(76116006)(142923001);DIR:OUT;SFP:1101; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LNRzB7kcwEyEQiuweKjIGvwvsN+sxN6DweEo5ce8+OZtNaWDzAvjVM55Gz39P/upo04kI7SHm1zRh0EpPnxe1dlOBw56NGQZoTZOBCcAiUhAuNtJ7sXO+qSR7g0WDrQOEpdSX6PQkI4FZUW/oHQYqT0putyFaMGJxeQ8gZZX8ssMTVAjY+QrQYvpULYSpPkdlIP42Tow0RsDz7C5UN3brq+6U8/ft49L1520NqIBwSrye+oZHzJP1jnuN8AoJYMkxwC8OOzh16CaVQ7peyJqjWE2BvuVyvtV52XCYD4gVi6El8xOmEW3AvHZQWnWPbP39bDzoSRbXjYeUpjPjcPVRzI5oeDd7a3iYQSxRtNtFBoOAU+okApiCb3nWKnb04wJs2DTIrE14MEE1z0Og0Ra6DjLhdCrByvwlxBK8DR6avFleV7OgkfIV5JHTuHewBE84Btfo4C3jnKHF4otRl62svKZuId/H7QwAVWZ1g4cObpxkL5GVwFHeEXpeFBQmvDPralD+W1V7W3yl4Fc5U3tlIrH+X3/hm2utWxmVkx6PSdcGxoZRENBp+kNNz2dAl9S x-ms-exchange-antispam-messagedata: z1LbUNdyH+A4N9foObqYImjd6S6cl+CYsxBmF3AWLnkJBD+EZ5aFunZyX4aUS8/+uxmuMcj6XNcoBgat4bcNt3zv1G27L4tTat4pZtLFjiRHrI1h1SONAT+Y5beU0WNEoZLMQnO355DfsTrPTIG8Lg== MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3033 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pierre.Gondois@arm.com; Return-Path: Pierre.Gondois@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT061.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFTY:;SFS:(10009020)(4636009)(396003)(136003)(39860400002)(346002)(376002)(46966005)(70586007)(316002)(110136005)(52536014)(55016002)(5660300002)(70206006)(2906002)(8936002)(336012)(186003)(54906003)(26005)(33656002)(82740400003)(6506007)(81156014)(26826003)(966005)(36906005)(81166006)(8676002)(478600001)(53546011)(47076004)(4326008)(9686003)(86362001)(356004)(7696005)(30864003)(142923001);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 18cbc1e1-bf2d-438f-3c67-08d7d56db3b6 X-Forefront-PRVS: 0359162B6D X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SC2ifWPwotk6xGa+SoUps2opaQzhBqYQWBgCRU7jqkkKworY5LbtMpoT1h7n1yd6VkP3kvXyGJXIbJiFvUDV6on9fiby1y/CVOG5oy0lHQe1xiyeSJLoO80RhzBhFnxncOc63jFWcB45d9+8Pu9gufHfQp2gdn086c3KsFtMn5R0RG7ipOz4D9SlXHNRsflws+I/DVXXWilwlNt78YtXGDQlTeM48uJaakN4zEKJsbmTj3kOScZ9eR23i43Gq1ibwvsWg16yqzT+K/zpOEjDTgZN0Xz+xiqPCuSLSAtSbRVCUASf8Wb1Hr3uLZ54mfcPPfXpZy13++p6h4K2/NIughVT9trcjAiHAJMonx+jCqlDbVqAd5xJ+JLsPvdkv4Zft+mFQORdFWwn8wVsW7RCaPZ2FBlzYRsvmrs1hkjksemUgMEhGh2/6SsO79k898OrRPLZSjTwgmDubfxlYZK+6Kg+HzkNWdwKQClKeg0CRS5Afa/PJo4YFarQevP/DXt9XTkSrA6DVc29jDX5r6uXAiTXBE0XIRe1qDzcdOnfjXWWQwFyEya8pK2TpPRqb1vYkSU5ak1gpLohMKtkr1A7/lmhITlMQ7EFmUkDyzd2UByQqGlMvgwp9KVs3eJJdfz5 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2020 12:19:12.2094 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6143b2a3-f856-4d52-93c3-08d7d56db8b9 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3430 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This patch is following the v3 named "BaseTools: Build ASL files before C f= iles ", available at https://edk2.groups.io/g/devel/message/53735=20 Sorry for messing with the names. Regards, Pierre -----Original Message----- From: PierreGondois =20 Sent: Monday, March 30, 2020 5:09 PM To: devel@edk2.groups.io Cc: Pierre Gondois ; bob.c.feng@intel.com; liming.g= ao@intel.com; Sami Mujawar ; nd Subject: [PATCH v4 1/1] BaseTools: Enable file dependencies in .inf files From: Pierre Gondois BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2425 The dependencies for C files are satisfied by the build system. However, there are use cases where source files with different languages ar= e inter-dependent. The EDKII build framework currently doesn't have options= to specify such dependencies. E.g. It may be necessary to specify the build order between ASL files and C files. The use case being that the AML blob generated by compiling the ASL files is loaded and parsed by some C code. This patch allows to describe dependencies between files listed in the '[So= urces]' section of '.inf' files. The list of source files to build prior st= arts with a colon (':'), e.g.: [Sources] FileName1.X FileName2.Y : FileName1.X FileName3.Z : FileName1.X FileName2.Y In the example above: * FileName1.X will be built prior to FileName2.Y. * FileName1.X and FileName2.Y will be built prior to FileName3.Z. This does not affect the file specific build options, which are pipe separa= ted, e.g.: FileName2.Y | GCC : FileName1.X The list of colon separated files must be part of the module, i.e. they mus= t be present in the [Sources] section. Their file extension must be described in the BaseTools/Conf/build_rule.tem= plate file, and generate an output file, i.e. have a non-empty '' section. Declaring a dependency in the [Sources] sections leads to the creation of m= akefile rules between these files in the build. The makefile rule is betwee= n the generated files. E.g.: FileName1.X generates FileName1.objx FileName2.Y generates FileName2.objy Then FileName2.Y : FileName1.X will create the following makefile rule: FileName2.objy : FileName1.objx INF Specification updates: s3.2.1, "Common Definitions": ::=3D ":" ::=3D s2.5, "[Sources] Section": To describe a build order dependency between source files, specify the source files to build prior by listing them, colon separated. ::=3D [] [] ::=3D [FileNameDependency]* Signed-off-by: Pierre Gondois --- The changes can be seen at https://github.com/PierreARM/edk2/commits/676_bu= ild_asl_first_v4 Notes: v4: - Correct typo in commit message, requested from [Bob] - Create a Bugzilla to update the Inf specification, and submit a patch to update the Inf specification, available at: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2646 BaseTools/Source/Python/AutoGen/BuildEngine.py | 5 ++++ BaseTools/Source/Python/AutoGen/GenMake.py | 5 ++++ BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 16 ++++++++++ BaseTools/Source/Python/Common/DataType.py | 3 +- BaseTools/Source/Python/Common/Misc.py | 2 ++ BaseTools/Source/Python/Workspace/InfBuildData.py | 31 +++++++++++++++++= +-- BaseTools/Source/Python/Workspace/MetaFileParser.py | 17 +++++++++-- 7 files changed, 74 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Sou= rce/Python/AutoGen/BuildEngine.py index d602414ca41f37155c9c6d00eec54ea3918840c3..59cc0f8a765835ee459880f6645= 3063af5f5779d 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -2,6 +2,7 @@ # The engine for building files # # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # =20 @@ -53,6 +54,7 @@ class TargetDescBlock(object): self.Outputs =3D Outputs self.Commands =3D Commands self.Dependencies =3D Dependencies + self.SourceFileDependencies =3D None if self.Outputs: self.Target =3D self.Outputs[0] else: @@ -277,6 +279,9 @@ class FileBuildRule: TargetDesc.GenListFile =3D self.GenListFile TargetDesc.GenIncListFile =3D self.GenIncListFile self.BuildTargets[DstFile[0]] =3D TargetDesc + + TargetDesc.SourceFileDependencies =3D=20 + SourceFile.SourceFileDependencies + return TargetDesc =20 def _BuildCommand(self, Macros): diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index bbb3c29446f53fa7f2cb61a216a5b119f72c3fbc..e257fd2c2eefee2782bc52606e5= 37a2147f6857b 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1013,6 +1013,11 @@ cleanlib: =20 Deps =3D [] CCodeDeps =3D [] + + if T.SourceFileDependencies: + for File in T.SourceFileDependencies: + Deps.append(self.PlaceMacro(str(File),=20 + self.Macros)) + # Add force-dependencies for Dep in T.Dependencies: Deps.append(self.PlaceMacro(str(Dep), self.Macros)) di= ff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Sou= rce/Python/AutoGen/ModuleAutoGen.py index aad591de65f086043d55aeea5661f59c53792e7c..f5e25d6f0231a393c838eb66922= ee5e769a4bdde 100755 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py @@ -2,6 +2,7 @@ # Create makefile for MS nmake and GNU make # # Copyright (c) 2019, Inte= l Corporation. All rights reserved.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # from __future__ import = absolute_import @@ -876,6 +877,21 @@ class ModuleAutoGen(AutoGen): if Source !=3D File: CreateDirectory(Source.Dir) =20 + # The Makefile rule created from with source file dependency m= ust + # have an object file as prerequisite. + # This gets the ouput format of sources. + OutPutSourceFileDependencies =3D [] + if Source.SourceFileDependencies: + for File in Source.SourceFileDependencies: + if File.Type in self.BuildRules: + DepRuleObject =3D self.BuildRules[File.Type] + DepTarget =3D DepRuleObject.Apply(File, self.Build= RuleOrder) + # Files not producing outputs like '.h files don't= create a target. + if DepTarget: + =20 + OutPutSourceFileDependencies.extend(DepTarget.Outputs) + + Source.SourceFileDependencies =3D=20 + OutPutSourceFileDependencies + if File.IsBinary and File =3D=3D Source and File in BinaryFile= List: # Skip all files that are not binary libraries if not self.IsLibrary: diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 8d80b410892946c8b862e060b0bf5f630b409825..8f21e1060446982f866c653aaea= 70cd662e307a0 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -2,7 +2,7 @@ # This file is used to define common static strings used by INF/DEC/DSC fi= les # # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved= .
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<= BR> +# Portions copyright (c) 2011 - 2020, ARM Ltd. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent =20 ## @@ -19,6 +19,7 @@ TAB_VALUE_SPLIT =3D '|' TAB_COMMA_SPLIT =3D ',' TAB_SPACE_SPLIT =3D ' ' TAB_SEMI_COLON_SPLIT =3D ';' +TAB_COLON_SPLIT =3D ':' TAB_SECTION_START =3D '[' TAB_SECTION_END =3D ']' TAB_OPTION_START =3D '<' diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index da5fb380f0354d6e885aa716d2c9b2fead249d63..cb5c73d473954254a1f4cfe794d= 97b1b8a198185 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -2,6 +2,7 @@ # Common routines used by all tools # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # =20 @@ -1438,6 +1439,7 @@ class PathClass(object): Arch=3D'COMMON', ToolChainFamily=3D'', Target=3D'', TagNa= me=3D'', ToolCode=3D''): self.Arch =3D Arch self.File =3D str(File) + self.SourceFileDependencies =3D [] if os.path.isabs(self.File): self.Root =3D '' self.AlterRoot =3D '' diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 7675b0ea00ebd6a5fc3e823c965e32066f66f650..f5333e01d907f3883f43edd3ba6= 5c2477aaf9b78 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -3,6 +3,7 @@ # # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
= # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # =20 @@ -536,12 +537,19 @@ class InfBuildData(ModuleBuildClassObject): return [] =20 RetVal =3D [] + PendingSourceFileDependencies =3D dict() RecordList =3D self._RawData[MODEL_EFI_SOURCE_FILE, self._Arch, se= lf._Platform] Macros =3D self._Macros for Record in RecordList: LineNo =3D Record[-1] - ToolChainFamily =3D Record[1] - TagName =3D Record[2] + + BuildOptions =3D ['', ''] + SplittedValueList =3D GetSplitValueList(Record[1], TAB_VALUE_S= PLIT, 1) + BuildOptions[0:len(SplittedValueList)] =3D SplittedValueList + SourceFileDependencies =3D=20 + list(set(GetSplitValueList(Record[2], TAB_SPACE_SPLIT))) + + ToolChainFamily =3D BuildOptions[0] + TagName =3D BuildOptions[1] ToolCode =3D Record[3] =20 File =3D PathClass(NormPath(Record[0], Macros), self._ModuleDi= r, '', @@ -552,9 +560,28 @@ class InfBuildData(ModuleBuildClassObject): EdkLogger.error('build', ErrorCode, ExtraData=3DErrorInfo,= File=3Dself.MetaFile, Line=3DLineNo) =20 RetVal.append(File) + + # If there are source file dependencies, resolve them after al= l + # the PathClass instances of the source files have been create= d. + if SourceFileDependencies[0] !=3D '': + PendingSourceFileDependencies[File] =3D=20 + SourceFileDependencies + # add any previously found dependency files to the source list if self._DependencyFileList: RetVal.extend(self._DependencyFileList) + + # Resolve the dependencies between the PathClass instances. + for SourceFile, SourceFileDepList in PendingSourceFileDependencies= .items(): + for SourceFileDepFile in SourceFileDepList: + Found =3D False + for Val in RetVal: + if SourceFileDepFile =3D=3D Val.File: + SourceFile.SourceFileDependencies.append(Val) + Found =3D True + break + if not Found: + EdkLogger.error("build", FILE_NOT_FOUND,=20 + ExtraData=3DSourceFileDepFile) + return RetVal =20 ## Retrieve library classes employed by this module diff --git a/BaseT= ools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Wo= rkspace/MetaFileParser.py index a3b6edbd15ee5bf79cef0ac1fc5e53db30356c91..9212a7015702d212d6a7e6c57b2= c1e5913e546a9 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -3,6 +3,7 @@ # # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
= # (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # =20 @@ -735,8 +736,20 @@ class InfParser(MetaFileParser): # @ParseMacro def _SourceFileParser(self): - TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT= ) - self._ValueList[0:len(TokenList)] =3D TokenList + SourceFileDependencySplit =3D GetSplitValueList(self._CurrentLine,= TAB_COLON_SPLIT, 1) + BuildOptionSplit =3D=20 + GetSplitValueList(SourceFileDependencySplit[0], TAB_VALUE_SPLIT, 1) + + # Get the filename. + self._ValueList[0] =3D BuildOptionSplit[0] + + # Get the build options. + if len(BuildOptionSplit) > 1: + self._ValueList[1] =3D BuildOptionSplit[1] + + # Get the dependencies. + if len(SourceFileDependencySplit) > 1: + self._ValueList[2] =3D SourceFileDependencySplit[1] + Macros =3D self._Macros # For Acpi tables, remove macro like ' TABLE_NAME=3DSata1' if 'COMPONENT_TYPE' in Macros: -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'