From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.54]) by mx.groups.io with SMTP id smtpd.web11.21442.1592236660841078401 for ; Mon, 15 Jun 2020 08:57:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=cxtkzwgk; spf=pass (domain: arm.com, ip: 40.107.7.54, 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=V3ikpo6PttTfvO+6slHd70k9ycKisErkEnUkUWZ7mUY=; b=cxtkzwgk59pfjiXfOb0lX3aYF0bCVdhWQfPAAnMFIA61tiOmUXJMh0NSkKksdJDrbLiDJakFDMp3loxKS0kiHTKlOPkoEjAtESz+sFt0ObOZseVbPZAmodozNLqgxaCsiamV15mR/OoNmTG+X5LizYUbux7BgA1ONAVB6DCNO9Q= Received: from AM6P193CA0094.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::35) by DB8PR08MB5211.eurprd08.prod.outlook.com (2603:10a6:10:ed::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Mon, 15 Jun 2020 15:57:37 +0000 Received: from AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:88:cafe::9e) by AM6P193CA0094.outlook.office365.com (2603:10a6:209:88::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Mon, 15 Jun 2020 15:57:37 +0000 X-MS-Exchange-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 AM5EUR03FT015.mail.protection.outlook.com (10.152.16.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 15:57:37 +0000 Received: ("Tessian outbound e024a44fe66b:v59"); Mon, 15 Jun 2020 15:57:37 +0000 X-CR-MTA-TID: 64aa7808 Received: from 50fc6ecc6172.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1AE0D60F-F1E3-4FEC-B799-90068ABBD955.1; Mon, 15 Jun 2020 15:57:32 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 50fc6ecc6172.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jun 2020 15:57:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JczXkDdU5JdApVD7y5Bhnn4q3YTf61qBWlD/XkX4QI8mGtCinf7oY863KK9TObtLhCAcrfC+2fa+uews9ShMQu1i4FAWJ+/lxkhVgop3RnqjwLd6UV86QVR8tNF8uRXkgpryVbyLfW/eH1g5oJ7itDL3btqPx0j8sJGE+fXsu1hp118mZlyDfSOe7V5EBwPc6nVVCaEcHOnWLwtUuDxn5y70n5ZGcMIisYQT8LOwo7wN930zXzYWoKQejXdp7Pxz8F416vM0MugUdIn8PFsSeghVKvCZQ8lMN776r7TgCrEy7w06+p3E3fBDeCtLlNVvwqMvwkxVX4+bFoj6C1wN/Q== 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=V3ikpo6PttTfvO+6slHd70k9ycKisErkEnUkUWZ7mUY=; b=YFmludyl+iPLd7z00vwV00oRJSZKl+4vLQcj+bG0n2YndoeJopweTjHPyQCnalBM3pZKi//Qrr1NkrTgbstYB2mZPhi347fV8nBrJcQQVI2t0jqTq8XAuFt+omivVxW6rVOIaHDIflgHDdIcioZGcaYz8VoqjElmReH+snc9+sFSsGdm7PROk0A9Wen5l6sPOe9BsOuy41Y3uhZLyAPOhV8TA4/vUzN+wbKQ7uS91U0DmgxlScy6OI4TBueKNVrjAEuubtumhFib2C8Z9sAnB1G0Cux6JhHDw5FCeWU+mBJsrHw8BDWERSwY6IysK064X1wYwCij6UL9CzXQJOcGAQ== 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=V3ikpo6PttTfvO+6slHd70k9ycKisErkEnUkUWZ7mUY=; b=cxtkzwgk59pfjiXfOb0lX3aYF0bCVdhWQfPAAnMFIA61tiOmUXJMh0NSkKksdJDrbLiDJakFDMp3loxKS0kiHTKlOPkoEjAtESz+sFt0ObOZseVbPZAmodozNLqgxaCsiamV15mR/OoNmTG+X5LizYUbux7BgA1ONAVB6DCNO9Q= Received: from DB7PR08MB3113.eurprd08.prod.outlook.com (2603:10a6:5:20::21) by DB7PR08MB4586.eurprd08.prod.outlook.com (2603:10a6:10:34::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Mon, 15 Jun 2020 15:57:30 +0000 Received: from DB7PR08MB3113.eurprd08.prod.outlook.com ([fe80::4178:71bd:a2a4:78bf]) by DB7PR08MB3113.eurprd08.prod.outlook.com ([fe80::4178:71bd:a2a4:78bf%7]) with mapi id 15.20.3088.028; Mon, 15 Jun 2020 15:57:30 +0000 From: "PierreGondois" To: "Feng, Bob C" , "devel@edk2.groups.io" CC: "Gao, Liming" , Sami Mujawar , Tomas Pilar , nd Subject: Re: [edk2-devel] [PATCH v1 1/3] BaseTools: Generate multiple rules when multiple output files Thread-Topic: [edk2-devel] [PATCH v1 1/3] BaseTools: Generate multiple rules when multiple output files Thread-Index: AQHWLR5DvrgOttPYDUayOoMOpRHh2qjFRBEAgAAUpFCACYdYEIACfGMAgAijLgA= Date: Mon, 15 Jun 2020 15:57:30 +0000 Message-ID: References: <20200518141120.66132-1-pierre.gondois@arm.com> <20200518141120.66132-2-pierre.gondois@arm.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 328c5bb5-3106-4d02-b118-527059487e6d.0 x-checkrecipientchecked: true Authentication-Results-Original: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=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: 0dbe5160-d6a9-4b98-9773-08d81144d337 x-ms-traffictypediagnostic: DB7PR08MB4586:|DB8PR08MB5211: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; x-forefront-prvs: 04359FAD81 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: BU/z5Rogdv4k6ixjE4XKdyNP9miotF+Hgd1S912Acgj2klqtFrUFjFWjaE7hUu12GcwqkQl/u3WtrEnCPXhlDX8phH2qNxo8JBDVQbc3snKwM6nCrY7n5kXrSauSaGiPkUfWrRwVkXPb3EaP++aNJ/4Wo3DEv8dg698UZd8mHZAPQjNS1yi4faTaJrO38djwfI2w2lhlYUXUHHNednpjWQ0qLg2YdOKRxylnRZdiWr2GO4tBVTvPGc1QgEZpr/l21qnEJoX50mzAP1fDM5ZGh1Y1g482z0lAkmrNBRH0Eq1/wNs5OLcq54wpYCp+/2UjQQoPAn3EnEEtwRK48JmsnPrYzLDQ7aHCe+Ru/nAi2S3YOeOjgBY0NDiTA2G536k2Pbv6gFF9UtJwNvmswFTpoA== 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:(4636009)(39860400002)(376002)(346002)(366004)(136003)(396003)(55016002)(86362001)(9686003)(4326008)(53546011)(316002)(26005)(33656002)(6506007)(186003)(478600001)(30864003)(5660300002)(2906002)(8676002)(66946007)(71200400001)(966005)(83380400001)(76116006)(110136005)(7696005)(54906003)(66446008)(8936002)(66556008)(52536014)(66476007)(64756008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: QszWoFzpNQyAzpchrxBqS8CXsGWSLmuSPW0UifK0vqfLUHLEvaMjzOdw2tF/DJssWAUHPn1T8QFGnO9pfEMCImnCrYCQSyERkA0ikfqgN4V8tUsHfMX2t4c1ahRFx/56JTj5kKUW4bsObPOMmbJCutEPcAlSQHaVxXMY242yOgLIWbumiWgOXBs3VimKYijadxITFgMVKMP+7tsLEk4Cn3IXx444xGdT4m6RRVi408bFdP1KBn2LELk45q7xf4kgqVPucVSpc55dVvOo4nCKS9QwBl6d1tnZfzfuPZYUdg8WCfsgkyTD5TXDdNr/bmDu8JZgEOlmkSFIWaA1WwmyD1/BAuUUYrlzDrEHSzCxAF+PcfTZJ8/N34fBk0HHyQQrlXHNxXwoqq1/NQp6bwcUhF5q6lF7d5RmcRq7lVS2aeIQOTSCJT2KvSjl9ULYrDrSYGJCSGfaKqt9DZDMYBGnlf7cSK7ORESOdR6a3Hc+CTZTXoQNiB3Lw6k7AU1phMUl MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB4586 Original-Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; Return-Path: Pierre.Gondois@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT015.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:(4636009)(346002)(376002)(39860400002)(136003)(396003)(46966005)(8936002)(7696005)(186003)(5660300002)(30864003)(55016002)(6506007)(8676002)(86362001)(966005)(316002)(9686003)(478600001)(53546011)(26005)(36906005)(110136005)(54906003)(2906002)(83380400001)(4326008)(356005)(336012)(82310400002)(70206006)(33656002)(70586007)(52536014)(47076004)(81166007)(82740400003);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 08e3275b-4c23-48e0-a4ff-08d81144cf42 X-Forefront-PRVS: 04359FAD81 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h8JgTQbWo5oAioNjx/UvuvCOo2LQYWFUSeCn2W3EFntB4Jt3Qa0HXu4bVtTqTmJaX7p7uAcVXO7/47wCFAIuNlahNsFO9uJ7buf/wwrrfU5hlahAMi1RV4KbfeXNE7cAKcLI/AzFHEwfgl3P7na/YBbQRDfHL9kkRDbRqlA5mxug6jlGtKwrCXXXVDq9hZIMEFWsiQKB7llRoE1dWw+MDcuSRZcdqfg+BAxHwO1QaPcMkOp9CFYpXBbgM4OMG+7iFpy3MFjH4Ku/wqn29RCWA/4OV0hevtJQ+pg7/iLXz6heMRZHywIidTqSPyhpEJXZyVaH8hjpHtwqDO1xEMo63f4vSU9GXqInGkVPYvq21CiqVVWhPbs+93PxQQAVg1aeHTcEM896Ol8oS1YAOHduo3UX2dAANpvBKN7J8U+GPRAEUkL/KeHA25Qj+2nefMAYVmHrD05CpBgzZ3nAZ4B8uM3lY13D6ADYYvwgWpBoeig= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2020 15:57:37.1199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0dbe5160-d6a9-4b98-9773-08d81144d337 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: DB8PR08MB5211 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello Bob, I have locally corrected the patch. On non-arm architecture, I had previou= sly tested it for the following configurations, but this wasn't enough appa= rently. I am currently testing it on more platforms and I will send you the= list of the tested platforms along with the V2. Plarform=3D"Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc"|"Platform/In= tel/BoardModulePkg/BoardModulePkg.dsc" Host=3DWindows|Linux BuildType=3DDEBUG|RELEASE Toolchain=3DVS2017|GCC5 Arch=3DX64|IA32 Before submitting a V2, I am planning to create a pull request on the edk2= github repository, allowing me to check whether it passes the CI tests. Wo= uld it be fine for you? About your comment about changing the logic of ApplyBuildRule, the logic o= f _ApplyBuildRule currently breaks out of the loop whenever a final target = is found. The new rule on ".amli" files needs to continue looking for rules= to apply, otherwise the processing on the initial ASL file stops when the = AML file is generated (thus, not continuing the path ".amli"->".c"->".obj")= . I agree this is hard to check, but I believe the edk2 CI tests should all= ow to put more trust in the patch serie. Regards, Pierre -----Original Message----- From: Feng, Bob C =20 Sent: 10 June 2020 04:58 To: Pierre Gondois ; devel@edk2.groups.io Cc: Gao, Liming ; Sami Mujawar ; Tomas Pilar ; nd Subject: RE: [edk2-devel] [PATCH v1 1/3] BaseTools: Generate multiple rule= s when multiple output files Hi Pierre, I found there is an incorrect target generated in the OvmfPkg/AcpiTables M= akefile when I tried to build Ovmf. That incorrect target causes ovmf to bu= ild failed. $(DEBUG_DIR)\PlatformAcpiTables : $(MAKE_FILE) $(DEBUG_DIR)\PlatformAcpiTa= bles : $(STATIC_LIBRARY_FILES) $(DEBUG_DIR)\PlatformAcpiTables : $(STATIC_L= IBRARY_FILES_LIST) "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) Regarding this patch, I think it changes the logic of the _ApplyBuildRule,= replacing "break" with "continue" and removing some if and elseif blocks, = so it would be hard for me to make sure your current logic can cover all th= e original cases. Would you show me how many testing you have done? Thanks, Bob=20 -----Original Message----- From: Pierre Gondois Sent: Monday, June 8, 2020 10:01 PM To: Feng, Bob C ; devel@edk2.groups.io Cc: Gao, Liming ; Sami Mujawar ; Tomas Pilar ; nd Subject: RE: [edk2-devel] [PATCH v1 1/3] BaseTools: Generate multiple rule= s when multiple output files Hello Bob, Should I modify the patch ? Regards, Pierre -----Original Message----- From: Pierre Gondois Sent: Tuesday, June 2, 2020 2:04 PM To: Feng, Bob C ; devel@edk2.groups.io Cc: Gao, Liming ; Sami Mujawar ; Tomas Pilar ; nd Subject: RE: [edk2-devel] [PATCH v1 1/3] BaseTools: Generate multiple rule= s when multiple output files Hello Bob, Thank you for your answer, I put my comments as [Pierre], Regards, Pierre -----Original Message----- From: Feng, Bob C Sent: 02 June 2020 12:16 To: devel@edk2.groups.io; Pierre Gondois Cc: Gao, Liming ; Sami Mujawar ; Tomas Pilar ; nd Subject: RE: [edk2-devel] [PATCH v1 1/3] BaseTools: Generate multiple rule= s when multiple output files My comments are inline marked as [Bob]. Thanks, Bob -----Original Message----- From: devel@edk2.groups.io On Behalf Of PierreGondo= is Sent: Monday, May 18, 2020 10:11 PM To: devel@edk2.groups.io Cc: Pierre Gondois ; Feng, Bob C ; Gao, Liming ; Sami.Mujawar@arm.com; Tomas.Pila= r@arm.com; nd@arm.com Subject: [edk2-devel] [PATCH v1 1/3] BaseTools: Generate multiple rules wh= en multiple output files From: Pierre Gondois BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2425 This patch modifies the Makefile generation not to stop adding Makfile rul= es when the first final target is found. E.g.: If the following rules are described in build_rule.txt: -[Rule1]: .X files generate .Y and .Z files; -[Rule2]: .Z files generate .Z1 files. Currently, if a File1.X file was part of the sources of a module, only [Ru= le1] would be generated in the Makefile. Indeed, there are no rules to apply to .Y files: .Y files are a final targ= et. However, there is still [Rule2] to apply to .Z files. [Bob] I think currently a rule's output file will be added back to source = file list, and in the later loop, that output file will be handled by anoth= er rule. Doesn't that algorithm handle your case above? [Pierre] The rule's output file was effectively added to the list of source files, = and a rule was searched for this output file. However, the loop stopped wh= en the first final target was found. By final target I mean "a file that is= n't the input of a rule". For the asl/aml/amli case, this meant that: -(first loop iteration: treating the ASL file) The rule for ASL files was= found and applied to the input ASL file. The AML and ".amli" files were ad= ded to the list of source files to look for a rule to apply to them. The lo= op continues. -(second loop iteration: treating the AML file) There is no rule for AML = files. This means that the AML file is a final target. The loop ends withou= t having applied the rule on the ".amli" file. This is why all the "break" instructions of the loop have been replaced wi= th "continue". This prevents the loop from exiting without having treated a= ll the files in the "SourceList". This patch also adds a dependency between the first ouput file of a rule a= nd the other output files. For instance, with the same example as above, File1.Y and File1.Z are gene= rated by the following rule: File1.Y: File1.X and the new dependency is: File1.Z: File1.Y This is necessary to keep a dependency order during the execution of the M= akefile. Indeed, .Y and .Z files are generated by the execution of a common= set of commands, and without this rule, there is no explicit dependency re= lation between them. [Bob] If there are 3 output files, for example:=20 A B C Will the dependency relationship be B: A C: B [Pierre] Currently, the dependency relation that would be created is: B: A C: A This can be changed to the dependency you described. Signed-off-by: Pierre Gondois --- The changes can be seen at: https://github.com/PierreARM/edk2/tree/803_Com= pile_AML_bytecode_array_into_OBJ_file_v1 Notes: v1: - Generate multiple rules when multiple output files are specified in the build_rule.txt file. [Pierre] BaseTools/Source/Python/AutoGen/GenMake.py | 6 +++ BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 40 ++++++++++---------= - 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source= /Python/AutoGen/GenMake.py index bbb3c29446f53fa7f2cb61a216a5b119f72c3fbc..0314d0ea34d99a014379e8d30c= 46ac0f0a7068ce 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1054,6 +1054,12 @@ cleanlib: TargetDict =3D {"target": self.PlaceMacro(T.Target.Pa= th, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": Deps} self.BuildTargetList.append(self._BUILD_TARGET_TEMPLA= TE.Replace(TargetDict)) =20 + # Add a Makefile rule for targets generating multiple= files. + # The main output is a prerequisite for the other out= put files. + for i in T.Outputs[1:]: + AnnexeTargetDict =3D {"target":=20 + self.PlaceMacro(i.Path, self.Macros), "cmd": "", "deps":=20 + self.PlaceMacro(T.Target.Path, self.Macros)} + + self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(Annexe + TargetDict)) + def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppD= ict, DependencyDict): if not CmdSumDict: for item in self._AutoGenObject.Targets[Type]: diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/= Source/Python/AutoGen/ModuleAutoGen.py index aad591de65f086043d55aeea5661f59c53792e7c..82facdb2774c56833718317f44= 14e0c1861de47f 100755 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py @@ -860,7 +860,8 @@ class ModuleAutoGen(AutoGen): SubDirectory =3D os.path.join(self.OutputDir, File.SubDir) if not os.path.exists(SubDirectory): CreateDirectory(SubDirectory) - LastTarget =3D None + TargetList =3D set() + FinalTargetName =3D set() RuleChain =3D set() SourceList =3D [File] Index =3D 0 @@ -872,7 +873,7 @@ class ModuleAutoGen(AutoGen): while Index < len(SourceList): Source =3D SourceList[Index] Index =3D Index + 1 - + FileType =3D TAB_UNKNOWN_FILE if Source !=3D File: CreateDirectory(Source.Dir) =20 @@ -881,34 +882,27 @@ class ModuleAutoGen(AutoGen): if not self.IsLibrary: continue RuleObject =3D self.BuildRules[TAB_DEFAULT_BINARY_FILE] - elif FileType in self.BuildRules: - RuleObject =3D self.BuildRules[FileType] elif Source.Ext in self.BuildRules: RuleObject =3D self.BuildRules[Source.Ext] else: - # stop at no more rules - if LastTarget: - self._FinalBuildTargetList.add(LastTarget) - break - + # No more rule to apply: Source is a final target. + FinalTargetName.add(Source) + continue FileType =3D RuleObject.SourceFileType self._FileTypes[FileType].add(Source) =20 # stop at STATIC_LIBRARY for library if self.IsLibrary and FileType =3D=3D TAB_STATIC_LIBRARY: - if LastTarget: - self._FinalBuildTargetList.add(LastTarget) - break + FinalTargetName.add(Source) + continue =20 Target =3D RuleObject.Apply(Source, self.BuildRuleOrder) if not Target: - if LastTarget: - self._FinalBuildTargetList.add(LastTarget) - break - elif not Target.Outputs: - # Only do build for target with outputs - self._FinalBuildTargetList.add(Target) + # No Target: Source is a final target. + FinalTargetName.add(Source) + continue =20 + TargetList.add(Target) self._BuildTargets[FileType].add(Target) =20 if not Source.IsBinary and Source =3D=3D File: @@ -916,12 +910,16 @@ class ModuleAutoGen(AutoGen): =20 # to avoid cyclic rule if FileType in RuleChain: - break + EdkLogger.error("build", ERROR_STATEMENT, "Cyclic=20 + dependency detected while generating rule for %s" % str(Source)) =20 RuleChain.add(FileType) SourceList.extend(Target.Outputs) - LastTarget =3D Target - FileType =3D TAB_UNKNOWN_FILE + + # For each final target, retrieve the TargetDescBlock instance. + for FTargetName in FinalTargetName: + for Target in TargetList: + if FTargetName =3D=3D Target.Target: + self._FinalBuildTargetList.add(Target) =20 @cached_property def Targets(self): -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'