## @ GenCfgOpt.py\r
#\r
# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials are licensed and made available under\r
-# the terms and conditions of the BSD License that accompanies this distribution.\r
-# The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
##\r
\r
**/\r
"""\r
\r
+BuildOptionPcd = []\r
+\r
class CLogicalExpression:\r
def __init__(self):\r
self.index = 0\r
self._PcdsDict[Match.group(1)] = Match.group(2)\r
if self.Debug:\r
print "INFO : PCD %s = [ %s ]" % (Match.group(1), Match.group(2))\r
+ i = 0\r
+ while i < len(BuildOptionPcd):\r
+ Match = re.match("\s*([\w\.]+)\s*\=\s*(\w+)", BuildOptionPcd[i])\r
+ if Match:\r
+ self._PcdsDict[Match.group(1)] = Match.group(2)\r
+ i += 1\r
else:\r
Match = re.match("^\s*#\s+(!BSF|@Bsf|!HDR)\s+(.+)", DscLine)\r
if Match:\r
NewTextBody.extend(OldTextBody)\r
return NewTextBody\r
\r
+ def WriteLinesWithoutTailingSpace (self, HeaderFd, Line):\r
+ TxtBody2 = Line.splitlines(True)\r
+ for Line2 in TxtBody2:\r
+ Line2 = Line2.rstrip()\r
+ Line2 += '\n'\r
+ HeaderFd.write (Line2)\r
+ return 0\r
def CreateHeaderFile (self, InputHeaderFile):\r
FvDir = self._FvDir\r
\r
Index += 1\r
for Item in range(len(StructStart)):\r
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:\r
- HeaderFd.write (Line)\r
+ self.WriteLinesWithoutTailingSpace(HeaderFd, Line)\r
HeaderFd.write("#pragma pack()\n\n")\r
HeaderFd.write("#endif\n")\r
HeaderFd.close()\r
Index += 1\r
for Item in range(len(StructStart)):\r
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:\r
- HeaderFd.write (Line)\r
+ self.WriteLinesWithoutTailingSpace(HeaderFd, Line)\r
HeaderFd.write("#pragma pack()\n\n")\r
HeaderFd.write("#endif\n")\r
HeaderFd.close()\r
\r
\r
def Usage():\r
- print "GenCfgOpt Version 0.52"\r
+ print "GenCfgOpt Version 0.53"\r
print "Usage:"\r
print " GenCfgOpt UPDTXT PlatformDscFile BuildFvDir [-D Macros]"\r
print " GenCfgOpt HEADER PlatformDscFile BuildFvDir InputHFile [-D Macros]"\r
#\r
# Parse the options and args\r
#\r
+ i = 1\r
+\r
GenCfgOpt = CGenCfgOpt()\r
+ while i < len(sys.argv):\r
+ if sys.argv[i].strip().lower() == "--pcd":\r
+ BuildOptionPcd.append(sys.argv[i+1])\r
+ i += 1\r
+ i += 1\r
argc = len(sys.argv)\r
if argc < 4:\r
Usage()\r