From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.62]) by mx.groups.io with SMTP id smtpd.web09.4021.1579714413200301214 for ; Wed, 22 Jan 2020 09:33:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=zqaO7oDT; spf=pass (domain: arm.com, ip: 40.107.6.62, 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=sZH/DR62heQfZ5sFkzvjOkeBjc/Ukqap0A/Vh/cGsd0=; b=zqaO7oDTCAa9nVjS6FrgUeIXZdlCDWbXbv76IIXE4PAKJPUYJmpeeMblWX++nefRb7FA539dWdh4SMneJqUvZWvZeuZBb/4JaQAL/JmSao61/Wjtr9G+tPhQ5tHfanJpRGWMsy+P68pQnFHHPirSz2YB1Fbz72JHgefCPUw/IBY= Received: from VI1PR08CA0100.eurprd08.prod.outlook.com (2603:10a6:800:d3::26) by VI1PR08MB2896.eurprd08.prod.outlook.com (2603:10a6:802:1f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19; Wed, 22 Jan 2020 17:33:30 +0000 Received: from VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::208) by VI1PR08CA0100.outlook.office365.com (2603:10a6:800:d3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18 via Frontend Transport; Wed, 22 Jan 2020 17:33:30 +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 VE1EUR03FT045.mail.protection.outlook.com (10.152.19.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.18 via Frontend Transport; Wed, 22 Jan 2020 17:33:29 +0000 Received: ("Tessian outbound 28955e0c1ca8:v40"); Wed, 22 Jan 2020 17:33:29 +0000 X-CR-MTA-TID: 64aa7808 Received: from ffef8b8e8236.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F24CCAA3-DDF7-4631-85A3-2AC2349A5E2D.1; Wed, 22 Jan 2020 17:33:24 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ffef8b8e8236.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 22 Jan 2020 17:33:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sq9BExrOhScFgIvg2NK8UA4y2apdo6Jw8+6nsx+FXpvcLFbz9TRg+CFfQHnW+JZ6myQluBubhusif2yZYWB0gziE6vndFPTJs4nLMfiykVaZQ1VexeKJLOXPmsBtOeJywpDxnKf6nsnyxkCgvjbj6urWWCEW6CLDeVNKq6ENQhEse6bBOQo6CF5qEPFYsZHn/qgTNF1XQapBszo5+G82QxM8nFxBrE20T16cPflTxzYB0yqAnzhJ43y9EQ7GE14qVwiMWNFO15rq67wddC1tGvni9AT8GJcofUECG0QNh7LopH0XpNvM/ig9f1tGmvUOrOn5lO4mB4IKmn74Q274Hw== 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=sZH/DR62heQfZ5sFkzvjOkeBjc/Ukqap0A/Vh/cGsd0=; b=nXGvF3ChQqCLd55Kr9FVX50kcsW1WRRYWZMs2uLrJG4y2DXt6QEbHHR41ap9j7hjURFsFlsDLlMx1qSpcl4txI6NESL3PwPrzfbYETqSz7HfU2YEPQoSo+NlqvZin1+4MZOC3K58ZJKB0eYFohBLcccoj2S8KFiJsB3Pmy2S3n0i4RtjixYPRPh/MNZYxL4xuKq5nEEBOI1rXNnIkIsoAeE3vdkHXGzuyvjJ5asMA/CXLJJWCY+r7NazeFZDyDlj9IQd5z6cO+oG2+HugHE2guas3PFLPB6ewDqY0MUE30ljLa+AjPOjoqSJHWM7ZPIqFtNJL2y6mg1kI6CqryAwzQ== 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=sZH/DR62heQfZ5sFkzvjOkeBjc/Ukqap0A/Vh/cGsd0=; b=zqaO7oDTCAa9nVjS6FrgUeIXZdlCDWbXbv76IIXE4PAKJPUYJmpeeMblWX++nefRb7FA539dWdh4SMneJqUvZWvZeuZBb/4JaQAL/JmSao61/Wjtr9G+tPhQ5tHfanJpRGWMsy+P68pQnFHHPirSz2YB1Fbz72JHgefCPUw/IBY= Received: from DB7PR08MB3113.eurprd08.prod.outlook.com (52.134.111.149) by DB7PR08MB3852.eurprd08.prod.outlook.com (20.178.47.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Wed, 22 Jan 2020 17:33:22 +0000 Received: from DB7PR08MB3113.eurprd08.prod.outlook.com ([fe80::6d14:b899:9fc4:d248]) by DB7PR08MB3113.eurprd08.prod.outlook.com ([fe80::6d14:b899:9fc4:d248%4]) with mapi id 15.20.2644.027; Wed, 22 Jan 2020 17:33:22 +0000 From: "PierreGondois" To: Pierre Gondois , "devel@edk2.groups.io" CC: "ard.biesheuvel@linaro.org" , "bob.c.feng@intel.com" , "liming.gao@intel.com" , Sami Mujawar , nd Subject: Re: [PATCH v2 1/1] BaseTools: Build ASL files before C files Thread-Topic: [PATCH v2 1/1] BaseTools: Build ASL files before C files Thread-Index: AQHVywryCvQGS3yrVkebm+eDXtRQVqf2/bYw Date: Wed, 22 Jan 2020 17:33:22 +0000 Message-ID: References: <20200114184615.9832-1-pierre.gondois@arm.com> In-Reply-To: <20200114184615.9832-1-pierre.gondois@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 8b86294e-9807-4e8e-9027-e8cc6e7815e5.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Pierre.Gondois@arm.com; x-originating-ip: [217.140.106.52] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ca9d6b30-e46d-4674-a7b7-08d79f613255 X-MS-TrafficTypeDiagnostic: DB7PR08MB3852:|DB7PR08MB3852:|VI1PR08MB2896: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: True x-ms-oob-tlc-oobclassifiers: OLM:6430;OLM:6430; x-forefront-prvs: 029097202E X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(39860400002)(136003)(376002)(396003)(199004)(189003)(71200400001)(52536014)(2906002)(110136005)(54906003)(186003)(26005)(53546011)(6506007)(81166006)(81156014)(316002)(8676002)(55016002)(76116006)(8936002)(4326008)(7696005)(66946007)(66446008)(66476007)(66556008)(64756008)(9686003)(966005)(30864003)(478600001)(5660300002)(33656002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR08MB3852;H:DB7PR08MB3113.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; 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: 374yKuVTjWe1ywKJjKecbhyWhbGl5B9XVFMCCkYExrWWA6wwAQgazSeqyDdTf4KgL9XPWLlwS174qmwkzEIT9V6K/KfN0VZHSTGaIgBIzAIpRDpSQdS3N2kvjtFhXeIjeAc5ZctbxZZc9YMizq567lTQSA+lD6OPFTFtKUZvvAOsRhP2+ldIGZXJVy9+ppcIxDIzBpMwid7aaErNVbbqdz63+e5qmDZLab+XEEFYxRW+PscQuiEM+o37JzIPwNCf+5QMCUQIpnqB9tFjJ8hDIK4c1R2XVvBD2Nhf0nzSHzzEeZTFVqpgXTsGxJCx2ZATt/qvlrOX4Nv/NgiAvV+inKNSYLPIktL27I0h1QJBpM8E99ZoTon9yJeKKLRiJSe7Rp9FLd5b5Ru1gU1Uxycsgnztj6ukjKwp5xQmxD3INfY+em2Oq2liARdEi9aXaHNqBXmoJOlbrAxHHY488PX7bky4bKhAuTJbSjoSwD0V0Iw= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3852 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: VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(346002)(136003)(376002)(39860400002)(396003)(199004)(189003)(81166006)(8936002)(52536014)(966005)(81156014)(2906002)(186003)(336012)(30864003)(5660300002)(4326008)(86362001)(356004)(26005)(478600001)(55016002)(8676002)(9686003)(33656002)(26826003)(316002)(70206006)(110136005)(53546011)(70586007)(36906005)(7696005)(6506007)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR08MB2896;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:Pass;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;A:1;MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 998a50fa-8195-4b04-7c0f-08d79f612dc1 X-Forefront-PRVS: 029097202E X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YbWbIEyti0WdP+Fn1gOX88oQ45yoQl+wxol3PbCye3nTo7Hd46xke9x6ViyElsA5mgoIDMsfQ55FD6x8O9m/ER1h33p4Lzqc4/XFWzB2DwdQbuViH+d6p/sUOgoxrFcIlNNeRlvRTp+ouVqWsMjUZFkCj8xyvxwbDjwLh6LVMZQ8cDCoAnqAMNU9Yksk83DVaxTwk7GOfD6TCmOWbGyOj6IZQs4qpiHpMJwzVZ8+7doqBejFMjv4KDrZ61uW+XZnNrszksq4vHMJzlUWaGc2zaQprx7rhwJEbnQ+NG3++LVf9keKxpkxakpd29SmLI48Nlkrv2D3FB0NYYBLyFdI7Cpjgclm8MQF7AhoXokg1Bv3/hQy8wGP2qEJEQ0ISOqR9dpzJzL6LWscQutrRTgVS9wFQHLcGhSP7fgEKEEpJJ1KKTbBTzxa8/EZSypDnam6VX/YOEblsrj1aDwoBb1u9fglzzEqK2fqc2e59q/0s/0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2020 17:33:29.9924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca9d6b30-e46d-4674-a7b7-08d79f613255 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: VI1PR08MB2896 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello everyone, Do you have any input on the patch? Regards, Pierre -----Original Message----- From: PierreGondois =20 Sent: 14 January 2020 18:46 To: devel@edk2.groups.io Cc: Pierre Gondois ; ard.biesheuvel@linaro.org; bob= .c.feng@intel.com; liming.gao@intel.com; Sami Mujawar ; nd Subject: [PATCH v2 1/1] BaseTools: Build ASL files before C files From: Pierre Gondois 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 ar= e colon separated (':'), e.g.: [Sources] FileName1.X FileName2.Y : FileName1.X FileName3.Z : FileName1.X : FileName3.Z 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/tree/676_build= _asl_first_v2 Notes: v2: - Enable file dependencies in .if files [Pierre] BaseTools/Source/Python/AutoGen/BuildEngine.py | 6 ++++ BaseTools/Source/Python/AutoGen/GenMake.py | 7 +++++ BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 17 +++++++++++ BaseTools/Source/Python/Common/DataType.py | 3 +- BaseTools/Source/Python/Common/Misc.py | 3 ++ BaseTools/Source/Python/Workspace/InfBuildData.py | 32 +++++++++++++++++= +-- BaseTools/Source/Python/Workspace/MetaFileParser.py | 18 +++++++++-- 7 files changed, 81 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Sou= rce/Python/AutoGen/BuildEngine.py index d602414ca41f37155c9c6d00eec54ea3918840c3..687617756619a5b547f18c99c47= 73842a8328ae8 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -2,6 +2,8 @@ # 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 +55,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 +280,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 fe94f9a4c232bb599a59563444c3985700c78ec6..5d932b66fb68baa06570a2eb421= d717f0dab8187 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -2,6 +2,8 @@ # Create makefile for MS nmake and GNU make # # Copyright (c) 2007 - 201= 8, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # =20 @@ -997,6 +999,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..b1cba5178e88db0855f5d0979bb= 7aa355093eade 100755 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py @@ -2,6 +2,8 @@ # 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 +878,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..fb7a8f62087cfe7e0e007a98648= 32dc1eefc3068 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -2,6 +2,8 @@ # 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 +1440,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..02e5c578b426e66b343df937a56= ccea319b9f646 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -3,6 +3,8 @@ # # 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 +538,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_COLON_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 +561,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..04a656b8ba1e55addc5f37ec8ee= 2b0439cef0ef1 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -3,6 +3,8 @@ # # 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 +737,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)'