1## @file
2# This file is used to define common static strings used by INF/DEC/DSC files
3#
4# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
5# SPDX-License-Identifier: BSD-2-Clause-Patent
6
7import re
8
9gIsWindows = None
10gWorkspace = "."
11gOptions = None
12gCaseInsensitive = False
13gAllFiles = None
14gCommand = None
15gSKUID_CMD = None
16
17gGlobalDefines = {}
18gPlatformDefines = {}
19# PCD name and value pair for fixed at build and feature flag
20gPlatformPcds = {}
21# PCDs with type that are not fixed at build and feature flag
22gPlatformOtherPcds = {}
23gActivePlatform = None
24gCommandLineDefines = {}
25gEdkGlobal = {}
26gCommandMaxLength = 4096
27# for debug trace purpose when problem occurs
28gProcessingFile = ''
29gBuildingModule = ''
30gSkuids = []
31gDefaultStores = []
32gGuidDict = {}
33
34# definition for a MACRO name.  used to create regular expressions below.
35_MacroNamePattern = "[A-Z][A-Z0-9_]*"
36
37## Regular expression for matching macro used in DSC/DEC/INF file inclusion
38gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern), re.UNICODE)
39gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
40gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
41
42# definition for a GUID.  used to create regular expressions below.
43_HexChar = r"[0-9a-fA-F]"
44_GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{12}}".format(Hex=_HexChar)
45
46## Regular expressions for GUID matching
47gGuidPattern = re.compile(r'{}'.format(_GuidPattern))
48gGuidPatternEnd = re.compile(r'{}$'.format(_GuidPattern))
49
50## Regular expressions for HEX matching
51g4HexChar = re.compile(r'{}{{4}}'.format(_HexChar))
52gHexPattern = re.compile(r'0[xX]{}+'.format(_HexChar))
53gHexPatternAll = re.compile(r'0[xX]{}+$'.format(_HexChar))
54
55## Regular expressions for string identifier checking
56gIdentifierPattern = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
57## Regular expression for GUID c structure format
58_GuidCFormatPattern = r"{{\s*0[xX]{Hex}{{1,8}}\s*,\s*0[xX]{Hex}{{1,4}}\s*,\s*0[xX]{Hex}{{1,4}}" \
59                      r"\s*,\s*{{\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
60                      r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
61                      r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
62                      r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}\s*}}\s*}}".format(Hex=_HexChar)
63gGuidCFormatPattern = re.compile(r"{}".format(_GuidCFormatPattern))
64
65#
66# A global variable for whether current build in AutoGen phase or not.
67#
68gAutoGenPhase = False
69
70#
71# The Conf dir outside the workspace dir
72#
73gConfDirectory = ''
74gCmdConfDir = ''
75gBuildDirectory = ''
76#
77# The relative default database file path
78#
79gDatabasePath = ".cache/build.db"
80
81#
82# Build flag for binary build
83#
84gIgnoreSource = False
85
86#
87# FDF parser
88#
89gFdfParser = None
90
91BuildOptionPcd = []
92
93#
94# Mixed PCD name dict
95#
96MixedPcd = {}
97
98# Structure Pcd dict
99gStructurePcd = {}
100gPcdSkuOverrides={}
101# Pcd name for the Pcd which used in the Conditional directives
102gConditionalPcds = []
103
104gUseHashCache = None
105gBinCacheDest = None
106gBinCacheSource = None
107gPlatformHash = None
108gPlatformHashFile = None
109gPackageHash = None
110gPackageHashFile = None
111gModuleHashFile = None
112gCMakeHashFile = None
113gHashChainStatus = None
114gModulePreMakeCacheStatus = None
115gModuleMakeCacheStatus = None
116gFileHashDict = None
117gModuleAllCacheStatus = None
118gModuleCacheHit = None
119
120gEnableGenfdsMultiThread = True
121gSikpAutoGenCache = set()
122# Common lock for the file access in multiple process AutoGens
123file_lock = None
124
125