diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 512b172352..1880148a6d 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1400,6 +1400,17 @@ class DscParser(MetaFileParser): self._Scope = [[S1, S2, S3]] # + # Expand macros in arch field for all records so that per-module + # sub-items (e.g. under [Components.$(PEI_ARCH)]) + # resolve correctly, not just the Component record itself. + # + self._Scope[0][0] = ReplaceMacro(self._Scope[0][0], self._Macros) + if '$(' in self._Scope[0][0] and S1 != TAB_ARCH_COMMON: + EdkLogger.warn("Parser", + "Macro in arch field was not resolved. " + "'%s' used in section header is not defined." % S1, + File=self._FileWithError, Line=LineStart) + # # For !include directive, handle it specially, # merge arch and module type in case of duplicate items # @@ -1712,7 +1723,6 @@ class DscParser(MetaFileParser): def __ProcessComponent(self): self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) - self._Scope[0][0] = ReplaceMacro(self._Scope[0][0], self._Macros) def __ProcessBuildOption(self): self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False)