]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/GenMake.py
Sync EDKII BaseTools to BaseTools project r2065.
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / GenMake.py
index f689a8692db8060933017392690fe0d6c99494a5..b1e438547fb67f4dcfcb9a379ba3b6babf0444cc 100644 (file)
@@ -1,8 +1,8 @@
 ## @file
 # Create makefile for MS nmake and GNU make
 #
-# Copyright (c) 2007, 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
@@ -26,7 +26,7 @@ from BuildEngine import *
 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)
@@ -754,6 +754,7 @@ cleanlib:
 
                 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:
@@ -768,7 +769,7 @@ cleanlib:
                     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)
@@ -1308,8 +1309,14 @@ ${END}\t@cd $(BUILD_DIR)\n
         if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":
             FdfFileList = [PlatformInfo.FdfFile]
             # macros passed to GenFds
+            # MacroList.append('"%s=%s"' % ("WORKSPACE", GlobalData.gWorkspace))
+            MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource))
+            MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource))
             for MacroName in GlobalData.gGlobalDefines:
-                MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName]))
+                if GlobalData.gGlobalDefines[MacroName] != "":
+                    MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName]))
+                else:
+                    MacroList.append('"%s"' % MacroName)
         else:
             FdfFileList = []