import Common.GlobalData as GlobalData
## Regular expression for finding header file inclusions
-gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:[\"<]?[ \t]*)([\w.\\/]+)(?:[ \t]*[\">]?)", re.MULTILINE|re.UNICODE)
+gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE|re.UNICODE|re.IGNORECASE)
## Regular expression for matching macro used in header file inclusion
gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)
-## pattern for include style in R8.x code
+## pattern for include style in Edk.x code
gProtocolDefinition = "Protocol/%(HeaderKey)s/%(HeaderKey)s.h"
gGuidDefinition = "Guid/%(HeaderKey)s/%(HeaderKey)s.h"
gArchProtocolDefinition = "ArchProtocol/%(HeaderKey)s/%(HeaderKey)s.h"
% (self._AutoGenObject.BuildTarget, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch),
ExtraData="[%s]" % str(self._AutoGenObject))
- # convert dependent libaries to build command
+ # convert dependent libraries to build command
self.ProcessDependentLibrary()
if len(self._AutoGenObject.Module.ModuleEntryPointList) > 0:
ModuleEntryPoint = self._AutoGenObject.Module.ModuleEntryPointList[0]
ArchEntryPoint = ModuleEntryPoint
if self._AutoGenObject.Arch == "EBC":
- # EBC compiler always use "EfiStart" as entry point. Only applies to R9 modules
+ # EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules
ImageEntryPoint = "EfiStart"
elif self._AutoGenObject.AutoGenVersion < 0x00010005:
- # R8 modules use entry point specified in INF file
+ # Edk modules use entry point specified in INF file
ImageEntryPoint = ModuleEntryPoint
else:
- # R9 modules always use "_ModuleEntryPoint" as entry point
+ # EdkII modules always use "_ModuleEntryPoint" as entry point
ImageEntryPoint = "_ModuleEntryPoint"
# tools definitions
# convert source files and binary files to build targets
self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList]
- if len(self.ResultFileList) == 0:
+ if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0:
EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
ExtraData="[%s]" % str(self._AutoGenObject))
False
)
- # R8 modules need <BaseName>StrDefs.h for string ID
+ # Edk modules need <BaseName>StrDefs.h for string ID
#if self._AutoGenObject.AutoGenVersion < 0x00010005 and len(self._AutoGenObject.UnicodeFileList) > 0:
# BcTargetList = ['strdefs']
#else:
self.FileDependency = self.GetFileDependency(
SourceFileList,
ForceIncludedFile,
- self._AutoGenObject.IncludePathList
+ self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList
)
DepSet = None
for File in self.FileDependency:
if DepSet == None:
DepSet = set()
#
- # Extract comman files list in the dependency files
+ # Extract common files list in the dependency files
#
for File in DepSet:
self.CommonFileDependency.append(self.PlaceMacro(File.Path, self.Macros))
gDependencyDatabase[self._AutoGenObject.Arch] = {}
DepDb = gDependencyDatabase[self._AutoGenObject.Arch]
+ # add path of given source file into search path list.
+ if File.Dir not in SearchPathList:
+ SearchPathList.append(File.Dir)
while len(FileStack) > 0:
F = FileStack.pop()
CurrentFilePath = F.Dir
for Inc in IncludedFileList:
+ Inc = Inc.strip()
# if there's macro used to reference header file, expand it
HeaderList = gMacroPattern.findall(Inc)
if len(HeaderList) == 1 and len(HeaderList[0]) == 2:
Inc = os.path.normpath(Inc)
for SearchPath in [CurrentFilePath] + SearchPathList:
FilePath = os.path.join(SearchPath, Inc)
- if not os.path.exists(FilePath) or FilePath in CurrentFileDependencyList:
+ if not os.path.isfile(FilePath) or FilePath in CurrentFileDependencyList:
continue
FilePath = PathClass(FilePath)
CurrentFileDependencyList.append(FilePath)
FileStack.append(FilePath)
break
else:
- EdkLogger.debug(EdkLogger.DEBUG_9, "%s included by %s was not found"\
+ EdkLogger.debug(EdkLogger.DEBUG_9, "%s included by %s was not found "\
"in any given path:\n\t%s" % (Inc, F, "\n\t".join(SearchPathList)))
if not MacroUsedByIncludedFile:
#
fds: init
\t-@cd $(FV_DIR)
-${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -D ${macro} ${END}
+${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list}${END}${BEGIN}${extra_options}${END}${BEGIN} -r ${fd}${END}${BEGIN} -i ${fv}${END}${BEGIN} -C ${cap}${END}${BEGIN} -D${macro}${END}
#
# run command for emulator platform only
if GlobalData.gCaseInsensitive:
ExtraOption += " -c"
+ ExtraOptionList = []
+ if ExtraOption:
+ ExtraOptionList.append(ExtraOption)
MakefileName = self._FILE_NAME_[self._FileType]
SubBuildCommandList = []
"active_platform" : str(PlatformInfo),
"fd" : PlatformInfo.FdTargetList,
"fv" : PlatformInfo.FvTargetList,
- "extra_options" : ExtraOption,
+ "cap" : PlatformInfo.CapTargetList,
+ "extra_options" : ExtraOptionList,
"macro" : MacroList,
}