Fixed customized build bug
authorjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 7 Apr 2008 07:22:10 +0000 (07:22 +0000)
committerjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 7 Apr 2008 07:22:10 +0000 (07:22 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1124 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/AutoGen/AutoGen.py
Source/Python/AutoGen/GenMake.py
Source/Python/Workspace/WorkspaceDatabase.py

index fa44700..7b99e26 100755 (executable)
@@ -782,7 +782,7 @@ class ModuleAutoGen(object):
 \r
         for Type in self.Module.CustomMakefile:\r
             MakeType = gMakeTypeMap[Type]\r
-            Info.CustomMakeFile[MakeType] = os.path.join(Info.SourceDir, self.Module.CustomMakefile[Type])\r
+            Info.CustomMakefile[MakeType] = os.path.join(Info.SourceDir, self.Module.CustomMakefile[Type])\r
 \r
         if self.Module.LibraryClass != None and self.Module.LibraryClass != []:\r
             Info.IsLibrary = True\r
index e7660a5..7295491 100755 (executable)
@@ -68,8 +68,8 @@ gMakefileHeader = '''#
 #\r
 '''\r
 \r
-gLibraryMakeCommand = '''cd %(makedir)s && "$(MAKE)" $(MAKE_FLAGS) %(target)s\r
-\tcd $(MODULE_BUILD_DIR)'''\r
+gLibraryMakeCommand = '''@cd %(makedir)s && "$(MAKE)" $(MAKE_FLAGS) %(target)s\r
+\t@cd $(MODULE_BUILD_DIR)'''\r
 \r
 gMakeType = ""\r
 if sys.platform == "win32":\r
@@ -181,37 +181,38 @@ ${BEGIN}PLATFORM_${tool_code}_FLAGS = ${platform_tool_flags}
 ${END}\r
 \r
 #\r
-# Platform Tools Flags Macro Definition (from platform description file)\r
+# Module Tools Flags Macro Definition (from platform/module description file)\r
 #\r
 ${BEGIN}MODULE_${tool_code}_FLAGS = ${module_tool_flags}\r
 ${END}\r
 \r
 #\r
-# ToolsFlagMacro\r
+# Tools Flag Macro\r
 #\r
 ${BEGIN}${tool_code}_FLAGS = $(DEFAULT_${tool_code}_FLAGS) $(PLATFORM_${tool_code}_FLAGS) $(MODULE_${tool_code}_FLAGS)\r
 ${END}\r
 \r
 #\r
-# ToolsPathMacro\r
+# Tools Path Macro\r
 #\r
 ${BEGIN}${tool_code} = ${tool_path}\r
 ${END}\r
 \r
-${custom_makefile_content}\r
+MAKE_FILE = ${makefile_path}\r
 \r
 #\r
-# Target used when called from platform makefile, which will bypass the build of dependent libraries\r
+# Shell Command Macro\r
 #\r
+${BEGIN}${shell_command_code} = ${shell_command}\r
+${END}\r
 \r
-pbuild: init all\r
-\r
+${custom_makefile_content}\r
 \r
 #\r
-# Target used for library build, which will bypass the build of dependent libraries\r
+# Target used when called from platform makefile, which will bypass the build of dependent libraries\r
 #\r
 \r
-lbuild: init all\r
+pbuild: init all\r
 \r
 \r
 #\r
@@ -226,8 +227,7 @@ mbuild: init all
 #\r
 init:\r
 \t-@echo Building ... $(MODULE_NAME) $(MODULE_VERSION) [$(ARCH)] in platform $(PLATFORM_NAME) $(PLATFORM_VERSION)\r
-\t${BEGIN}-@${create_directory_command}\r
-\t${END}\r
+${BEGIN}\t-@${create_directory_command}\n${END}\\r
 \r
 '''\r
 \r
@@ -390,15 +390,15 @@ ${BEGIN}\t-@${copy_autogen_h}\n${END}
 # GenLibsTarget\r
 #\r
 gen_libs:\r
-\t${BEGIN}cd $(BUILD_DIR)${separator}$(ARCH)${separator}${dependent_library_build_directory} && "$(MAKE)" $(MAKE_FLAGS)\r
-\t${END}cd $(MODULE_BUILD_DIR)\r
+\t${BEGIN}@cd $(BUILD_DIR)${separator}$(ARCH)${separator}${dependent_library_build_directory} && "$(MAKE)" $(MAKE_FLAGS)\r
+\t${END}@cd $(MODULE_BUILD_DIR)\r
 \r
 #\r
 # Build Flash Device Image\r
 #\r
 gen_fds:\r
-\tcd $(BUILD_DIR) && "$(MAKE)" $(MAKE_FLAGS) fds\r
-\tcd $(MODULE_BUILD_DIR)\r
+\t@cd $(BUILD_DIR) && "$(MAKE)" $(MAKE_FLAGS) fds\r
+\t@cd $(MODULE_BUILD_DIR)\r
 \r
 #\r
 # Individual Object Build Targets\r
@@ -436,8 +436,8 @@ cleanpch:
 #\r
 \r
 cleanlib:\r
-\t${BEGIN}cd $(BUILD_DIR)${separator}$(ARCH)${separator}${dependent_library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) cleanall\r
-\t${END}cd $(MODULE_BUILD_DIR)\r
+\t${BEGIN}@cd $(BUILD_DIR)${separator}$(ARCH)${separator}${dependent_library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) cleanall\r
+\t${END}@cd $(MODULE_BUILD_DIR)\r
 \r
 '''\r
 \r
@@ -514,7 +514,7 @@ ${END}\tcd $(BUILD_DIR)
 #\r
 build_modules:\r
 ${BEGIN}\t@cd ${module_build_directory} && "$(MAKE)" $(MAKE_FLAGS) pbuild\r
-${END}\tcd $(BUILD_DIR)\r
+${END}\t@$(BUILD_DIR)\r
 \r
 #\r
 # Build Flash Device Image\r
@@ -537,7 +537,7 @@ run:
 clean:\r
 \t${BEGIN}@cd ${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) clean\r
 \t${END}${BEGIN}@cd ${module_build_directory} && "$(MAKE)" $(MAKE_FLAGS) clean\r
-\t${END}cd $(BUILD_DIR)\r
+\t${END}@cd $(BUILD_DIR)\r
 \r
 #\r
 # Clean all generated files except to makefile\r
@@ -551,7 +551,7 @@ ${END}
 #\r
 cleanlib:\r
 \t${BEGIN}@cd ${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) cleanall\r
-\t${END}cd $(BUILD_DIR)\r
+\t${END}@cd $(BUILD_DIR)\r
 \r
 '''\r
 \r
@@ -925,6 +925,7 @@ class Makefile(object):
 \r
         MakefileName = gMakefileName[MakeType]\r
         MakefileTemplateDict = {\r
+            "makefile_path"             : os.path.join("$(MODULE_BUILD_DIR)", MakefileName),\r
             "makefile_header"           : gMakefileHeader % MakefileName,\r
             "platform_name"             : self.PlatformInfo.Name,\r
             "platform_guid"             : self.PlatformInfo.Guid,\r
@@ -950,6 +951,9 @@ class Makefile(object):
             "platform_tool_flags"       : self.PlatformInfo.BuildOption.values(),\r
             "module_tool_flags"         : self.ModuleInfo.BuildOption.values(),\r
 \r
+            "shell_command_code"        : gShellCommand[MakeType].keys(),\r
+            "shell_command"             : gShellCommand[MakeType].values(),\r
+\r
             "tool_code"                 : self.PlatformInfo.ToolPath.keys(),\r
             "tool_path"                 : self.PlatformInfo.ToolPath.values(),\r
 \r
index 6f22f83..603b787 100644 (file)
@@ -1118,14 +1118,13 @@ class InfBuildData(ModuleBuildClassObject):
         #\r
         TAB_INF_DEFINES_INF_VERSION                 : "_AutoGenVersion",\r
         TAB_INF_DEFINES_COMPONENT_TYPE              : "_ComponentType",\r
-        TAB_INF_DEFINES_MAKEFILE_NAME               : "_CustomMakefile",\r
-        TAB_INF_DEFINES_CUSTOM_MAKEFILE             : "_CustomMakefile",\r
+        TAB_INF_DEFINES_MAKEFILE_NAME               : "_MakefileName",\r
+        #TAB_INF_DEFINES_CUSTOM_MAKEFILE             : "_CustomMakefile",\r
         TAB_INF_DEFINES_VERSION_NUMBER              : "_Version",\r
         TAB_INF_DEFINES_VERSION_STRING              : "_Version",\r
         TAB_INF_DEFINES_VERSION                     : "_Version",\r
         TAB_INF_DEFINES_PCD_IS_DRIVER               : "_PcdIsDriver",\r
         TAB_INF_DEFINES_SHADOW                      : "_Shadow",\r
-        TAB_INF_DEFINES_CUSTOM_MAKEFILE             : "_CustomMakefile",\r
     }\r
 \r
     _MODULE_TYPE_ = {\r
@@ -1244,6 +1243,7 @@ class InfBuildData(ModuleBuildClassObject):
         self._PcdIsDriver           = None\r
         self._BinaryModule          = None\r
         self._Shadow                = None\r
+        self._MakefileName          = None\r
         self._CustomMakefile        = None\r
         self._Specification         = None\r
         self._LibraryClass          = None\r
@@ -1325,7 +1325,18 @@ class InfBuildData(ModuleBuildClassObject):
                 if Record[1] == '':\r
                     continue\r
                 self._DestructorList.append(Record[1])\r
-\r
+            elif Name == TAB_INF_DEFINES_CUSTOM_MAKEFILE:\r
+                TokenList = GetSplitValueList(Record[1])\r
+                self._CustomMakefile = {}\r
+                if len(TokenList) < 2:\r
+                    self._CustomMakefile['MSFT'] = TokenList[0]\r
+                    self._CustomMakefile['GCC'] = TokenList[0]\r
+                else:\r
+                    if TokenList[0] not in ['MSFT', 'GCC']:\r
+                        EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
+                                        "No supported family [%s]" % TokenList[0], \r
+                                        File=self.DescFilePath, Line=Record[-1])\r
+                    self._CustomMakefile[TokenList[0]] = TokenList[1]\r
         # \r
         # R8.x modules\r
         # \r
@@ -1443,7 +1454,7 @@ class InfBuildData(ModuleBuildClassObject):
             if self._Header_ == None:\r
                 self._GetHeaderInfo()\r
             if self._CustomMakefile == None:\r
-                self._CustomMakefile = ''\r
+                self._CustomMakefile = {}\r
         return self._CustomMakefile\r
 \r
     def _GetSpec(self):\r