From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web09.9554.1619888571219850443 for ; Sat, 01 May 2021 10:02:52 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: michael.d.kinney@intel.com) IronPort-SDR: wwkZIQk0FKFL/3+52u4ymuyOrBYreBnIg+ejct+61USqON5RZk51CQW3UOwI4FMOyx66USeXQs tY/OtscHkoOQ== X-IronPort-AV: E=McAfee;i="6200,9189,9971"; a="261433108" X-IronPort-AV: E=Sophos;i="5.82,266,1613462400"; d="scan'208";a="261433108" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2021 10:02:47 -0700 IronPort-SDR: zhF/2Dt/BUFwt4BnnOBQy57PL25jakM8tA7C60SxS4m1Rk72s40yYW/KhhfUjeZVyoV1o4O3/K Gnxo1wDrldbg== X-IronPort-AV: E=Sophos;i="5.82,266,1613462400"; d="scan'208";a="538134787" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.209.84.85]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2021 10:02:47 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen , Ray Ni , Steven Shi Subject: [Patch 1/1] BaseTools: Fix New Target/ToolChain/Arch in DSC [BuildOptions] issues Date: Sat, 1 May 2021 10:02:41 -0700 Message-Id: <20210501170241.1185-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3359 * Save/Restore global state in GetToolChainAndFamilyFromDsc() This resolves an issue where the multi-arch build for UefiPayloadPkg would skip the autogen and build of IA32 components. * Expand tools wildcard. This resolves the issue where autogen makefile contents would have a BUIDLRULEFAMILY tools definitions with an '*' in the tool field that breaks the build from invalid makefile syntax. * Build rule family higher priority than Family. This resolves the issue where flags were appended from both the BUILDRULEFAMILY and FAMILY when only BUILDRULEFAMILY should be appended when present. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Cc: Ray Ni Cc: Steven Shi Signed-off-by: Michael D Kinney --- .../Python/AutoGen/ModuleAutoGenHelper.py | 27 +++++++++---------- .../Source/Python/AutoGen/PlatformAutoGen.py | 27 +++++++++---------- BaseTools/Source/Python/build/build.py | 2 ++ 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py index 167bb59d2315..036fdac3d7df 100644 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py @@ -181,20 +181,12 @@ class AutoGenInfo(object): if Family == ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]: FamilyMatch = True Found = True - if TAB_TOD_DEFINES_FAMILY in ToolDef[Tool]: - if Family == ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: - FamilyMatch = True - Found = True if TAB_STAR in ToolDef: FamilyIsNull = False if TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDef[TAB_STAR]: if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_BUILDRULEFAMILY]: FamilyMatch = True Found = True - if TAB_TOD_DEFINES_FAMILY in ToolDef[TAB_STAR]: - if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_FAMILY]: - FamilyMatch = True - Found = True if not Found: continue # expand any wildcard @@ -640,14 +632,19 @@ class PlatformInfo(AutoGenInfo): if Attr == TAB_TOD_DEFINES_BUILDRULEORDER: continue Value = Options[Tool][Attr] - # check if override is indicated - if Value.startswith('='): - BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:]) - else: - if Attr != 'PATH': - BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value) + ToolList = [Tool] + if Tool == TAB_STAR: + ToolList = list(AllTools) + ToolList.remove(TAB_STAR) + for ExpandedTool in ToolList: + # check if override is indicated + if Value.startswith('='): + BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value[1:]) else: - BuildOptions[Tool][Attr] = mws.handleWsMacro(Value) + if Attr != 'PATH': + BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value) + else: + BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value) return BuildOptions, BuildRuleOrder diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py index 21e72438e59e..832c0da86bb7 100644 --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py @@ -1391,14 +1391,19 @@ class PlatformAutoGen(AutoGen): if Attr == TAB_TOD_DEFINES_BUILDRULEORDER: continue Value = Options[Tool][Attr] - # check if override is indicated - if Value.startswith('='): - BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:]) - else: - if Attr != 'PATH': - BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value) + ToolList = [Tool] + if Tool == TAB_STAR: + ToolList = list(AllTools) + ToolList.remove(TAB_STAR) + for ExpandedTool in ToolList: + # check if override is indicated + if Value.startswith('='): + BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value[1:]) else: - BuildOptions[Tool][Attr] = mws.handleWsMacro(Value) + if Attr != 'PATH': + BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value) + else: + BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value) return BuildOptions, BuildRuleOrder @@ -1529,20 +1534,12 @@ class PlatformAutoGen(AutoGen): if Family == ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]: FamilyMatch = True Found = True - if TAB_TOD_DEFINES_FAMILY in ToolDef[Tool]: - if Family == ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: - FamilyMatch = True - Found = True if TAB_STAR in ToolDef: FamilyIsNull = False if TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDef[TAB_STAR]: if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_BUILDRULEFAMILY]: FamilyMatch = True Found = True - if TAB_TOD_DEFINES_FAMILY in ToolDef[TAB_STAR]: - if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_FAMILY]: - FamilyMatch = True - Found = True if not Found: continue diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 0570c29f1ada..e5693c0d27a2 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -897,6 +897,7 @@ class Build(): # $(TARGET), $(TOOLCHAIN), $(TOOLCHAIN_TAG), or $(ARCH) operands. # def GetToolChainAndFamilyFromDsc (self, File): + SavedGlobalDefines = GlobalData.gGlobalDefines.copy() for BuildTarget in self.BuildTargetList: GlobalData.gGlobalDefines['TARGET'] = BuildTarget for BuildToolChain in self.ToolChainList: @@ -929,6 +930,7 @@ class Build(): self.ToolDef.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] = [] if ToolChain not in self.ToolDef.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]: self.ToolDef.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG].append(ToolChain) + GlobalData.gGlobalDefines = SavedGlobalDefines ## Load configuration # -- 2.31.1.windows.1