From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web12.1115.1592548488343568126 for ; Thu, 18 Jun 2020 23:34:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=ek1SJKxR; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: yuwei.chen@intel.com) IronPort-SDR: s2W87AsiYHmWInQA9iO2ols1bLEctYEGXIdiwr3QUYclxes3qherSTrVE7porhdibPKQdp66j3 ECpX2PwlKSGQ== X-IronPort-AV: E=McAfee;i="6000,8403,9656"; a="123113404" X-IronPort-AV: E=Sophos;i="5.75,253,1589266800"; d="scan'208";a="123113404" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2020 23:34:46 -0700 IronPort-SDR: 244tyof/pff5l6AAAo3aTNTVCURz+xzvQ45EiBZkpBMvJggErh4mpj+JLFWS5I4kXuLhSsUv6x Sg2nVj0ae1hA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,253,1589266800"; d="scan'208";a="310075074" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 18 Jun 2020 23:34:47 -0700 Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 18 Jun 2020 23:34:47 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 18 Jun 2020 23:34:47 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.170) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 18 Jun 2020 23:34:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cZojlo53QZtCAmJTlEVO1nwF3TQ5LJBneu9RXlKxpjL0l/KQ5+um2Ty+bXe3Zj9MkDwzlHl4Jb8Mr1yJ4RFc6vh/isxBG7ypx2TPM4Xrduac8K9hKieZpj9Poxo3pZXto+sp74N9lwjFqvmeTOMbqITZ2cDlOoc8u4sk2ZziobXHFRfXq+aHnON38H68Zmz3VwbqyIZmQeWXym8o8Xr890UKnP+cV8qsH7Nmn2bOGH1yWdt6Friy6sYYjbIYlSNlw+z/2IFcA8f3SAyF2LEvbuxtwsi7lEkTY3wxuGQyTceKB2GetMta3n1XJ8OC+INtqmB4sbOATUmfwK0jOlhtMg== 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=2Ze2o/XeCzRxyWdf0ysDIpW47ibxU8cZQwyZhR9WAW0=; b=JqIjXK33aoJjS1jnm4RqioOLYCMqUCKGUZt94DaLwoEVnNfV0km671YZ/IpjZI76wOticNtdguerqbZl9VUrahq28mEFPoD77HwhGrHtr7rYaXn1dZRiyIpe7vOuNuUlVivr0Ehtu4Kl7fwFYQyF3tSzLAPZoZ50lGFf+ySlZoPkfXxw9SxzXiAmhpDdE1b2vBopC74xHsJyEujsk2ex7YfY1IP947o7oUSvN3/aT051cnK9NxWHNpyHVOzLO/GCJc694XC7JevYlOkigV/QhSgTLY5V6XycvbaLvTRA0uGZSz2mC1J5hc1iQg3fLiDhgYo4ns6mVvdEjFQEE8uP+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2Ze2o/XeCzRxyWdf0ysDIpW47ibxU8cZQwyZhR9WAW0=; b=ek1SJKxRpUhNAmdueLtCKenMbWUEXluo3Q/teAd1Jy0Jeou0Sa7LeK1NWn96a3b7DXiyAUon6vI42eVH5Jsc3sINi/Nk7TvQlojZ3HcIU9oaV9yKRQE8puLJR5rG0TkAXocOijVql6gP0f9Z+D+nJ8XeLVGMD6KcaeoRME2hs8g= Received: from DM5PR11MB1594.namprd11.prod.outlook.com (2603:10b6:4:5::16) by DM6PR11MB4562.namprd11.prod.outlook.com (2603:10b6:5:2a8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Fri, 19 Jun 2020 06:34:45 +0000 Received: from DM5PR11MB1594.namprd11.prod.outlook.com ([fe80::503:d97b:c650:831d]) by DM5PR11MB1594.namprd11.prod.outlook.com ([fe80::503:d97b:c650:831d%12]) with mapi id 15.20.3109.021; Fri, 19 Jun 2020 06:34:45 +0000 From: "Yuwei Chen" To: "devel@edk2.groups.io" , "pierre.gondois@arm.com" CC: "sami.mujawar@arm.com" , "tomas.pilar@arm.com" , "Feng, Bob C" , "Gao, Liming" , "nd@arm.com" Subject: Re: [edk2-devel] [PATCH v2 1/4] BaseTools: Generate multiple rules when multiple output files Thread-Topic: [edk2-devel] [PATCH v2 1/4] BaseTools: Generate multiple rules when multiple output files Thread-Index: AQHWRXyj6e3nRgFkDk+j26kXpwR91ajffDbw Date: Fri, 19 Jun 2020 06:34:44 +0000 Message-ID: References: <20200618142713.146412-1-pierre.gondois@arm.com> <20200618142713.146412-2-pierre.gondois@arm.com> In-Reply-To: <20200618142713.146412-2-pierre.gondois@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bcb388b0-6af7-4f50-9172-08d8141adb1e x-ms-traffictypediagnostic: DM6PR11MB4562: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0439571D1D x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NuQuaeRO8DEQm0r/rPL/0WqLlLyQpQVgAEjTV9SoAogqfUaJ8XKA0oRLkOdtIskqKm4gIEaV3+TCeOch+biFlaF6jCewu8uKegeuY+YWc1x6GuQ1Q1EObFJ8gheiEFSBtTQqTP/qn+EKCfs9eTmkRXgdDy/IGAICSH4Erdi+jVsdXJAhwnNxZxqi/8o9EYJF/ASE8TqEI/q/QClZPkeot0j9qK5w+OGEJZEx1wuVJ1Iomx2png5F7Rl0v9ED9YSPoFnu6A44iaKp9BR2gVYS5WF6PuEoy1K98zNQG89JcwYNC5MTm8tYAKEoFnaY7B5+Px6RQauQ4k91+LCuL57GG+/Hrl3vCQ6LcTmZ4IoyDz3DGjbY08puHNtdpsud9kXDRUFAOKDEi4qo0R0176rxew== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR11MB1594.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(376002)(346002)(136003)(396003)(39860400002)(366004)(76116006)(316002)(86362001)(66946007)(66476007)(71200400001)(4326008)(54906003)(83380400001)(8936002)(110136005)(33656002)(2906002)(7696005)(53546011)(5660300002)(52536014)(26005)(55016002)(9686003)(186003)(478600001)(8676002)(966005)(66556008)(64756008)(66446008)(6506007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: 1l18Wh/hwjnsv1t3e6AFo6L2ymhcRQWEyx+m9a/E0Aa7DTviHJFGSWw5Wa/CSSnywj3dg66fJz6Ehb98cOhC9f022yooRFH1RGiJzoEvZWJGqQNIgWbL7bL/AIc60oTFu+eb/vZM8dlQ5pydPcbABlOBDAcaS7cY0OIltHHYA9kA4eGHJLXRdIYCgVmaQwbxD2/xNr2VbZZHa4wF82aThy9yG+4rM16QnE6XvO2HOi2DVGttVxuBpad4GDbswwEyD+m4/4qubDYJyVkA5p7UgOdDJgep667aKTzevldzrrrQLVU53/oe/WGG0Uh/PiRghHutnPrejYL9ZAONTviFlDZ4xpshc0jXNwsUxoOubrY4lsf0d1nSj8zvop4Yo33wLFvZrbf/H9daSMEiDgoKo5ct+/BeJT/XD52yrmaRMxnskj5VSgPXCWQGOl8GoI/LHbjbUTCwFUP29RqBmimRfpS/8dHeGtNO1A6KRvpb6pY= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: bcb388b0-6af7-4f50-9172-08d8141adb1e X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jun 2020 06:34:44.9804 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QtW/lY3POeHhxjwJYQpLkKb85gcneppbH+yOzYtn8Jtybwvb63thgc1B8wMH+/2FWhmBrH8FILMqoQWdGJC9gQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4562 Return-Path: yuwei.chen@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Pierre The patch looks good. Thanks, Yuwei > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of > PierreGondois > Sent: Thursday, June 18, 2020 10:27 PM > To: devel@edk2.groups.io > Cc: Pierre Gondois ; sami.mujawar@arm.com; > tomas.pilar@arm.com; Feng, Bob C ; Gao, Liming > ; nd@arm.com > Subject: [edk2-devel] [PATCH v2 1/4] BaseTools: Generate multiple rules > when multiple output files >=20 > From: Pierre Gondois >=20 > This patch modifies the Makefile generation not to stop adding Makfile r= ules > 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 [= Rule1] > would be generated in the Makefile. > Indeed, there are no rules to apply to .Y files: .Y files are a final ta= rget. > However, there is still [Rule2] to apply to .Z files. >=20 > This patch also adds a dependency between the first ouput file of a rule= and > the other output files. > For instance, with the same example as above, File1.Y and File1.Z are > generated by the following rule: > File1.Y: File1.X > > >=20 > and the new dependency is: > File1.Z: File1.Y >=20 > This is necessary to keep a dependency order during the execution of the > Makefile. Indeed, .Y and .Z files are generated by the execution of a co= mmon > set of commands, and without this rule, there is no explicit dependency > relation between them. >=20 > Signed-off-by: Pierre Gondois > --- >=20 > The changes can be seen at > https://github.com/PierreARM/edk2/commits/pg/803_Compile_AML_bytec > ode_array_into_OBJ_file_v2 >=20 > Notes: > Notes: > v1: > - Generate multiple rules when multiple output files > are specified in the build_rule.txt file. [Pierre] > v2: > - Use the "FileType" variable in the _ApplyBuildRule > function as it is in the current state. [Pierre] >=20 > BaseTools/Source/Python/AutoGen/GenMake.py | 6 ++++ > BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 38 > +++++++++++--------- > 2 files changed, 27 insertions(+), 17 deletions(-) >=20 > 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.= Path, self.Macros), > "cmd": "\n\t".join(T.Commands),"deps": Deps} >=20 > self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(Target > Dict)) >=20 > + # Add a Makefile rule for targets generating multip= le files. > + # The main output is a prerequisite for the other o= utput files. > + for i in T.Outputs[1:]: > + AnnexeTargetDict =3D {"target": self.PlaceMacro= (i.Path, > self.Macros), "cmd": "", "deps": self.PlaceMacro(T.Target.Path, self.Mac= ros)} > + > + > self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(Annex > e > + TargetDict)) > + > def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, > CmdCppDict, 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..dc8b1fe3d160cac2da22227fc2 > 33e3aa0d92cb1e 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 > @@ -870,6 +871,9 @@ class ModuleAutoGen(AutoGen): > self.BuildOption >=20 > while Index < len(SourceList): > + # Reset the FileType if not the first iteration. > + if Index > 0: > + FileType =3D TAB_UNKNOWN_FILE > Source =3D SourceList[Index] > Index =3D Index + 1 >=20 > @@ -886,29 +890,25 @@ class ModuleAutoGen(AutoGen): > 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 >=20 > 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 +916,16 @@ class ModuleAutoGen(AutoGen): >=20 > # to avoid cyclic rule > if FileType in RuleChain: > - break > + EdkLogger.error("build", ERROR_STATEMENT, "Cyclic > + 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 name, retrieve the corresponding > 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)' >=20 >=20 >=20