]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools: Fix flexible PCD single quote and double quote bugs
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / GenMake.py
index 7d3374a493734f661e111acb6c53692618b13587..4b924d21e099b0bee55554cd8a8194a95b12c3e6 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Create makefile for MS nmake and GNU make\r
 #\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -798,9 +798,13 @@ cleanlib:
                                     Tool = Flag\r
                                     break\r
                         if Tool:\r
+                            if 'PATH' not in self._AutoGenObject._BuildOption[Tool]:\r
+                                EdkLogger.error("build", AUTOGEN_ERROR, "%s_PATH doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))\r
                             SingleCommandLength += len(self._AutoGenObject._BuildOption[Tool]['PATH'])\r
                             for item in SingleCommandList[1:]:\r
                                 if FlagDict[Tool]['Macro'] in item:\r
+                                    if 'FLAGS' not in self._AutoGenObject._BuildOption[Tool]:\r
+                                        EdkLogger.error("build", AUTOGEN_ERROR, "%s_FLAGS doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))\r
                                     Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']\r
                                     for Option in self._AutoGenObject.BuildOption.keys():\r
                                         for Attr in self._AutoGenObject.BuildOption[Option]:\r
@@ -1551,11 +1555,19 @@ class TopLevelMakefile(BuildFile):
             for index, option in enumerate(GlobalData.gCommand):\r
                 if "--pcd" == option and GlobalData.gCommand[index+1]:\r
                     pcdName, pcdValue = GlobalData.gCommand[index+1].split('=')\r
-                    if pcdValue.startswith('H'):\r
-                        pcdValue = 'H' + '"' + pcdValue[1:] + '"'\r
-                        ExtraOption += " --pcd " + pcdName + '=' + pcdValue\r
-                    elif pcdValue.startswith('L'):\r
-                        pcdValue = 'L' + '"' + pcdValue[1:] + '"'\r
+                    for Item in GlobalData.BuildOptionPcd:\r
+                        if '.'.join(Item[0:2]) == pcdName:\r
+                            pcdValue = Item[2]\r
+                            if pcdValue.startswith('L') or pcdValue.startswith('"'):\r
+                                pcdValue, Size = ParseFieldValue(pcdValue)\r
+                                NewVal = '{'\r
+                                for S in range(Size):\r
+                                    NewVal = NewVal + '0x%02X' % ((pcdValue >> S * 8) & 0xff)\r
+                                    NewVal += ','\r
+                                pcdValue =  NewVal[:-1] + '}'\r
+                            break\r
+                    if pcdValue.startswith('{'):\r
+                        pcdValue = 'H' + '"' + pcdValue + '"'\r
                         ExtraOption += " --pcd " + pcdName + '=' + pcdValue\r
                     else:\r
                         ExtraOption += " --pcd " + GlobalData.gCommand[index+1]\r