The BuildOptions in an INF should also follow override rule: If '==' is used, all other options with '=' are overridden.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yingke Liu <yingke.d....@intel.com> --- BaseTools/Source/Python/AutoGen/AutoGen.py | 14 ++++---------- .../Source/Python/Workspace/WorkspaceDatabase.py | 20 +++++++------------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 7fb1a88..449e096 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2000,7 +2000,6 @@ class PlatformAutoGen(AutoGen): if Options.get((self.BuildRuleFamily, NowKey)) != None: Options.pop((self.BuildRuleFamily, NowKey)) - OverrideOpt = set() for Key in Options: if ModuleStyle != None and len (Key) > 2: # Check Module style is EDK or EDKII. @@ -2026,18 +2025,15 @@ class PlatformAutoGen(AutoGen): if Arch == "*" or Arch == self.Arch: if Tool not in BuildOptions: BuildOptions[Tool] = {} - if Options[Key].startswith('='): - OverrideOpt.add((Tool, Attr)) - if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or (Tool, Attr) in OverrideOpt: + if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='): BuildOptions[Tool][Attr] = Options[Key] - else: + elif not BuildOptions[Tool][Attr].startswith('='): # append options for the same tool BuildOptions[Tool][Attr] += " " + Options[Key] # Build Option Family has been checked, which need't to be checked again for family. if FamilyMatch or FamilyIsNull: return BuildOptions - OverrideOpt = set() for Key in Options: if ModuleStyle != None and len (Key) > 2: # Check Module style is EDK or EDKII. @@ -2061,11 +2057,9 @@ class PlatformAutoGen(AutoGen): if Arch == "*" or Arch == self.Arch: if Tool not in BuildOptions: BuildOptions[Tool] = {} - if Options[Key].startswith('='): - OverrideOpt.add((Tool, Attr)) - if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or (Tool, Attr) in OverrideOpt: + if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='): BuildOptions[Tool][Attr] = Options[Key] - else: + elif not BuildOptions[Tool][Attr].startswith('='): # append options for the same tool BuildOptions[Tool][Attr] += " " + Options[Key] return BuildOptions diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index 9da6ac7..1c8e0f3 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -753,7 +753,6 @@ class DscBuildData(PlatformBuildClassObject): ## Retrieve [BuildOptions] def _GetBuildOptions(self): if self._BuildOptions == None: - OverrideTool = set() self._BuildOptions = sdict() # # Retrieve build option for EDKII and EDK style module @@ -762,14 +761,12 @@ class DscBuildData(PlatformBuildClassObject): RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, CodeBase] for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4 in RecordList: CurKey = (ToolChainFamily, ToolChain, CodeBase) - if Option.startswith('='): - OverrideTool.add(CurKey) # # Only flags can be appended # - if CurKey not in self._BuildOptions or not ToolChain.endswith('_FLAGS') or CurKey in OverrideTool: + if CurKey not in self._BuildOptions or not ToolChain.endswith('_FLAGS') or Option.startswith('='): self._BuildOptions[CurKey] = Option - else: + elif not self._BuildOptions[CurKey].startswith('='): self._BuildOptions[CurKey] += ' ' + Option return self._BuildOptions @@ -778,18 +775,15 @@ class DscBuildData(PlatformBuildClassObject): self._ModuleTypeOptions = sdict() if (Edk, ModuleType) not in self._ModuleTypeOptions: options = sdict() - OverrideTool = set() self._ModuleTypeOptions[Edk, ModuleType] = options DriverType = '%s.%s' % (Edk, ModuleType) RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, DriverType] for ToolChainFamily, ToolChain, Option, Arch, Type, Dummy3, Dummy4 in RecordList: - if Arch == self._Arch and Type == DriverType: + if Type == DriverType: Key = (ToolChainFamily, ToolChain, Edk) - if Option.startswith('='): - OverrideTool.add(Key) - if Key not in options or not ToolChain.endswith('_FLAGS') or Key in OverrideTool: + if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='): options[Key] = Option - else: + elif not options[Key].startswith('='): options[Key] += ' ' + Option return self._ModuleTypeOptions[Edk, ModuleType] @@ -2399,9 +2393,9 @@ class InfBuildData(ModuleBuildClassObject): ToolChainFamily = Record[0] ToolChain = Record[1] Option = Record[2] - if (ToolChainFamily, ToolChain) not in self._BuildOptions: + if (ToolChainFamily, ToolChain) not in self._BuildOptions or Option.startswith('='): self._BuildOptions[ToolChainFamily, ToolChain] = Option - else: + elif not self._BuildOptions[ToolChainFamily, ToolChain].startswith('='): # concatenate the option string if they're for the same tool OptionString = self._BuildOptions[ToolChainFamily, ToolChain] self._BuildOptions[ToolChainFamily, ToolChain] = OptionString + " " + Option -- 1.9.5.msysgit.0 ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel