diff options
author | Carsey, Jaben <jaben.carsey@intel.com> | 2018-08-25 00:33:17 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-08-30 08:42:09 +0800 |
commit | 94c04559374df0d1cecea32114df7be6d5931db9 (patch) | |
tree | e5f3097fac277ed91a05c1a2d7d776d5627a2f43 /BaseTools/Source/Python/AutoGen | |
parent | 7c7c8190d30b8ea547921143a8b8b0e44b585d89 (diff) | |
download | edk2-94c04559374df0d1cecea32114df7be6d5931db9.tar.gz edk2-94c04559374df0d1cecea32114df7be6d5931db9.tar.bz2 edk2-94c04559374df0d1cecea32114df7be6d5931db9.zip |
BaseTools: Create and use a shared value for 'MSFT' from DataType
I see lots of 'MSFT' throughout code and this can reduce them.
Cc: Bob Feng <Bob.c.Feng@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGen.py | 8 | ||||
-rw-r--r-- | BaseTools/Source/Python/AutoGen/BuildEngine.py | 8 | ||||
-rw-r--r-- | BaseTools/Source/Python/AutoGen/GenMake.py | 3 |
3 files changed, 10 insertions, 9 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 314a321e95..15365e7b1d 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -79,7 +79,7 @@ gEfiVarStoreNamePattern = re.compile("\s*name\s*=\s*(\w+)") gEfiVarStoreGuidPattern = re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
## Mapping Makefile type
-gMakeTypeMap = {"MSFT":"nmake", "GCC":"gmake"}
+gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
## Build rule configuration file
@@ -1842,7 +1842,7 @@ class PlatformAutoGen(AutoGen): or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]:
EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \
% self.ToolChain)
- self._ToolChainFamily = "MSFT"
+ self._ToolChainFamily = TAB_COMPILER_MSFT
else:
self._ToolChainFamily = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]
return self._ToolChainFamily
@@ -1855,7 +1855,7 @@ class PlatformAutoGen(AutoGen): or not ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]:
EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \
% self.ToolChain)
- self._BuildRuleFamily = "MSFT"
+ self._BuildRuleFamily = TAB_COMPILER_MSFT
else:
self._BuildRuleFamily = ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]
return self._BuildRuleFamily
@@ -2977,7 +2977,7 @@ class ModuleAutoGen(AutoGen): # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC/RVCT
# is the former use /I , the Latter used -I to specify include directories
#
- if self.PlatformInfo.ToolChainFamily in ('MSFT'):
+ if self.PlatformInfo.ToolChainFamily in (TAB_COMPILER_MSFT):
BuildOptIncludeRegEx = gBuildOptIncludePatternMsft
elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'):
BuildOptIncludeRegEx = gBuildOptIncludePatternOther
diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py index 4291da9001..ac7a668755 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -318,7 +318,7 @@ class BuildRule: # @param LineIndex The line number from which the parsing will begin
# @param SupportedFamily The list of supported tool chain families
#
- def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=["MSFT", "INTEL", "GCC", "RVCT"]):
+ def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=[TAB_COMPILER_MSFT, "INTEL", "GCC", "RVCT"]):
self.RuleFile = File
# Read build rules from file if it's not none
if File is not None:
@@ -596,17 +596,17 @@ if __name__ == '__main__': EdkLogger.Initialize()
if len(sys.argv) > 1:
Br = BuildRule(sys.argv[1])
- print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1]))
+ print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", TAB_COMPILER_MSFT][1]))
print()
print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1]))
print()
print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1]))
print()
- print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))
+ print(str(Br[".ac", "ACPI_TABLE", "IA32", TAB_COMPILER_MSFT][1]))
print()
print(str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1]))
print()
- print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))
+ print(str(Br[".ac", "ACPI_TABLE", "IA32", TAB_COMPILER_MSFT][1]))
print()
print(str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1]))
print()
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 55081acbd8..35ee98c82b 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -27,6 +27,7 @@ from Common.StringUtils import * from .BuildEngine import *
import Common.GlobalData as GlobalData
from collections import OrderedDict
+from Common.DataType import TAB_COMPILER_MSFT
## Regular expression for finding header file inclusions
gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE)
@@ -166,7 +167,7 @@ class BuildFile(object): "gmake" : "include"
}
- _INC_FLAG_ = {"MSFT" : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"}
+ _INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"}
## Constructor of BuildFile
#
|