## @file
# Create makefile for MS nmake and GNU make
#
-# Copyright (c) 2007 - 2010, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
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)
% (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]
# 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))
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: