summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/AutoGen
diff options
context:
space:
mode:
authorHess Chen <hesheng.chen@intel.com>2014-08-18 04:59:01 +0000
committerhchen30 <hchen30@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-18 04:59:01 +0000
commit03af27533236a08309b60ba1f3236234f3de46bc (patch)
tree61d0e1722b1bf9453c316f927965b2fc5151bb52 /BaseTools/Source/Python/AutoGen
parentf5ba4007ae30597c5a8b5dde20f2e0bac3f4f7bc (diff)
downloadedk2-platforms-03af27533236a08309b60ba1f3236234f3de46bc.tar.xz
This patch is going to retire the top level makefile on BaseTools for supporting a pure binary build without any complier.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yingke Liu <yingke.d.liu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15816 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py30
-rw-r--r--BaseTools/Source/Python/AutoGen/GenMake.py96
2 files changed, 17 insertions, 109 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index c4662572a0..36e43478c7 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -655,6 +655,8 @@ class WorkspaceAutoGen(AutoGen):
)
Count += 1
+ def _GenFdsCommand(self):
+ return (GenMake.TopLevelMakefile(self)._TEMPLATE_.Replace(GenMake.TopLevelMakefile(self)._TemplateDict)).strip()
## Create makefile for the platform and modules in it
#
@@ -662,15 +664,6 @@ class WorkspaceAutoGen(AutoGen):
# modules will be created as well
#
def CreateMakeFile(self, CreateDepsMakeFile=False):
- # create makefile for platform
- Makefile = GenMake.TopLevelMakefile(self)
- if Makefile.Generate():
- EdkLogger.debug(EdkLogger.DEBUG_9, "Generated makefile for platform [%s] %s\n" %
- (self.MetaFile, self.ArchList))
- else:
- EdkLogger.debug(EdkLogger.DEBUG_9, "Skipped the generation of makefile for platform [%s] %s\n" %
- (self.MetaFile, self.ArchList))
-
if CreateDepsMakeFile:
for Pa in self.AutoGenObjectList:
Pa.CreateMakeFile(CreateDepsMakeFile)
@@ -705,6 +698,7 @@ class WorkspaceAutoGen(AutoGen):
FvDir = property(_GetFvDir)
MakeFileDir = property(_GetMakeFileDir)
BuildCommand = property(_GetBuildCommand)
+ GenFdsCommand = property(_GenFdsCommand)
## AutoGen class for platform
#
@@ -801,6 +795,9 @@ class PlatformAutoGen(AutoGen):
self._LibraryAutoGenList = None
self._BuildCommand = None
+ # get library/modules for build
+ self.LibraryBuildDirectoryList = []
+ self.ModuleBuildDirectoryList = []
# get the original module/package/platform objects
self.BuildDatabase = Workspace.BuildDatabase
return True
@@ -827,6 +824,10 @@ class PlatformAutoGen(AutoGen):
# don't do this twice
self.IsCodeFileCreated = True
+ ## Generate Fds Command
+ def _GenFdsCommand(self):
+ return self.Workspace.GenFdsCommand
+
## Create makefile for the platform and mdoules in it
#
# @param CreateModuleMakeFile Flag indicating if the makefile for
@@ -844,14 +845,11 @@ class PlatformAutoGen(AutoGen):
if self.IsMakeFileCreated:
return
- # create makefile for platform
+ # create library/module build dirs for platform
Makefile = GenMake.PlatformMakefile(self)
- if Makefile.Generate():
- EdkLogger.debug(EdkLogger.DEBUG_9, "Generated makefile for platform [%s] [%s]\n" %
- (self.MetaFile, self.Arch))
- else:
- EdkLogger.debug(EdkLogger.DEBUG_9, "Skipped the generation of makefile for platform [%s] [%s]\n" %
- (self.MetaFile, self.Arch))
+ self.LibraryBuildDirectoryList = Makefile.GetLibraryBuildDirectoryList()
+ self.ModuleBuildDirectoryList = Makefile.GetModuleBuildDirectoryList()
+
self.IsMakeFileCreated = True
## Deal with Shared FixedAtBuild Pcds
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 64eedfaa12..180e217705 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1105,6 +1105,7 @@ cleanlib:
self.IntermediateDirectoryList = []
self.ModuleBuildDirectoryList = []
self.LibraryBuildDirectoryList = []
+ self.LibraryMakeCommandList = []
# Compose a dict object containing information used to do replacement in template
def _CreateTemplateDict(self):
@@ -1128,6 +1129,7 @@ cleanlib:
Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":Makefile}
LibraryMakefileList.append(Makefile)
LibraryMakeCommandList.append(Command)
+ self.LibraryMakeCommandList = LibraryMakeCommandList
ModuleMakefileList = []
ModuleMakeCommandList = []
@@ -1198,99 +1200,7 @@ cleanlib:
#
class TopLevelMakefile(BuildFile):
## template used to generate toplevel makefile
- _TEMPLATE_ = TemplateString('''\
-${makefile_header}
-
-#
-# Platform Macro Definition
-#
-PLATFORM_NAME = ${platform_name}
-PLATFORM_GUID = ${platform_guid}
-PLATFORM_VERSION = ${platform_version}
-
-#
-# Build Configuration Macro Definition
-#
-TOOLCHAIN = ${toolchain_tag}
-TOOLCHAIN_TAG = ${toolchain_tag}
-TARGET = ${build_target}
-
-#
-# Build Directory Macro Definition
-#
-BUILD_DIR = ${platform_build_directory}
-FV_DIR = ${platform_build_directory}${separator}FV
-
-#
-# Shell Command Macro
-#
-${BEGIN}${shell_command_code} = ${shell_command}
-${END}
-
-MAKE = ${make_path}
-MAKE_FILE = ${makefile_path}
-
-#
-# Default target
-#
-all: modules fds
-
-#
-# Initialization target: print build information and create necessary directories
-#
-init:
-\t-@
-\t${BEGIN}-@${create_directory_command}
-\t${END}
-#
-# library build target
-#
-libraries: init
-${BEGIN}\t@cd $(BUILD_DIR)${separator}${arch} && "$(MAKE)" $(MAKE_FLAGS) libraries
-${END}\t@cd $(BUILD_DIR)
-
-#
-# module build target
-#
-modules: init
-${BEGIN}\t@cd $(BUILD_DIR)${separator}${arch} && "$(MAKE)" $(MAKE_FLAGS) modules
-${END}\t@cd $(BUILD_DIR)
-
-#
-# Flash Device Image Target
-#
-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} -C ${cap} ${END}${BEGIN} -D ${macro} ${END}
-
-#
-# run command for emulator platform only
-#
-run:
-\tcd $(BUILD_DIR)${separator}IA32 && ".${separator}SecMain"
-\tcd $(BUILD_DIR)
-
-#
-# Clean intermediate files
-#
-clean:
-${BEGIN}\t-@${sub_build_command} clean
-${END}\t@cd $(BUILD_DIR)
-
-#
-# Clean all generated files except to makefile
-#
-cleanall:
-${BEGIN}\t${cleanall_command}
-${END}
-
-#
-# Clean all library files
-#
-cleanlib:
-${BEGIN}\t-@${sub_build_command} cleanlib
-${END}\t@cd $(BUILD_DIR)\n
-''')
+ _TEMPLATE_ = TemplateString('''${BEGIN}\tGenFds -f "${fdf_file}" -o "${platform_build_directory}" -t ${toolchain_tag} -b ${build_target} -p "${active_platform}" -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -C ${cap} ${END}${BEGIN} -D ${macro} ${END}''')
## Constructor of TopLevelMakefile
#