public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools:Define Macro in Inf file, the pcdvalue Can't convert
@ 2019-01-25  8:52 Fan, ZhijuX
  2019-01-28  3:48 ` Feng, Bob C
  0 siblings, 1 reply; 2+ messages in thread
From: Fan, ZhijuX @ 2019-01-25  8:52 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Gao, Liming, Feng, Bob C

Define Macro in Inf file, the pcdvalue Can't convert

in dec:
gUefiOvmfPkgGuid.test1|"ddd"|VOID*|0x3c
in inf:
DEFINE ABC=PATH
gUefiOvmfPkgTokenSpaceGuid.test1|$(ABC)

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 6df0d3cdf8..f31dbc2649 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -757,9 +757,13 @@ class InfParser(MetaFileParser):
         if self._ValueList[2] != '':
             InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
             if InfPcdValueList[0] in ['True', 'true', 'TRUE']:
-                self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1);
+                self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1)
             elif InfPcdValueList[0] in ['False', 'false', 'FALSE']:
-                self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1);
+                self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1)
+            elif isinstance(InfPcdValueList[0], str) and InfPcdValueList[0].find('$(') >= 0:
+                Value = ReplaceExprMacro(InfPcdValueList[0],self._Macros)
+                if Value != '0':
+                    self._ValueList[2] = Value
         if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict:
             self.PcdsDict[self._ValueList[0], self._ValueList[1]] = self._SectionType
         elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] != self._SectionType:
-- 
2.14.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-28  3:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-25  8:52 [PATCH] BaseTools:Define Macro in Inf file, the pcdvalue Can't convert Fan, ZhijuX
2019-01-28  3:48 ` Feng, Bob C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox