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 = []
32
33# definition for a MACRO name.  used to create regular expressions below.
34_MacroNamePattern = "[A-Z][A-Z0-9_]*"
35
36## Regular expression for matching macro used in DSC/DEC/INF file inclusion
37gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern), re.UNICODE)
38gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
39gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
40
41# definition for a GUID.  used to create regular expressions below.
42_HexChar = r"[0-9a-fA-F]"
43_GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{12}}".format(Hex=_HexChar)
44
45## Regular expressions for GUID matching
46gGuidPattern = re.compile(r'{}'.format(_GuidPattern))
47gGuidPatternEnd = re.compile(r'{}$'.format(_GuidPattern))
48
49## Regular expressions for HEX matching
50g4HexChar = re.compile(r'{}{{4}}'.format(_HexChar))
51gHexPattern = re.compile(r'0[xX]{}+'.format(_HexChar))
52gHexPatternAll = re.compile(r'0[xX]{}+$'.format(_HexChar))
53
54## Regular expressions for string identifier checking
55gIdentifierPattern = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
56## Regular expression for GUID c structure format
57_GuidCFormatPattern = r"{{\s*0[xX]{Hex}{{1,8}}\s*,\s*0[xX]{Hex}{{1,4}}\s*,\s*0[xX]{Hex}{{1,4}}" \
58                      r"\s*,\s*{{\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
59                      r"\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}}\s*}}\s*}}".format(Hex=_HexChar)
62gGuidCFormatPattern = re.compile(r"{}".format(_GuidCFormatPattern))
63
64#
65# A global variable for whether current build in AutoGen phase or not.
66#
67gAutoGenPhase = False
68
69#
70# The Conf dir outside the workspace dir
71#
72gConfDirectory = ''
73
74gBuildDirectory = ''
75#
76# The relative default database file path
77#
78gDatabasePath = ".cache/build.db"
79
80#
81# Build flag for binary build
82#
83gIgnoreSource = False
84
85#
86# FDF parser
87#
88gFdfParser = None
89
90BuildOptionPcd = []
91
92#
93# Mixed PCD name dict
94#
95MixedPcd = {}
96
97# Structure Pcd dict
98gStructurePcd = {}
99gPcdSkuOverrides={}
100# Pcd name for the Pcd which used in the Conditional directives
101gConditionalPcds = []
102
103gUseHashCache = None
104gBinCacheDest = None
105gBinCacheSource = None
106gPlatformHash = None
107gPackageHash = {}
108gModuleHash = {}
109gEnableGenfdsMultiThread = False
110gSikpAutoGenCache = set()
111
112# Dictionary for tracking Module build status as success or failure
113# False -> Fail : True -> Success
114gModuleBuildTracking = dict()
115
116# Dictionary of booleans that dictate whether a module or
117# library can be skiped
118# Top Dict:     Key: Arch Type              Value: Dictionary
119# Second Dict:  Key: Module\Library Name    Value: True\False
120gBuildHashSkipTracking = dict()
121