2 # Create makefile for MS nmake and GNU make
4 # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
5 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 import Common
.LongFilePathOs
as os
20 import os
.path
as path
21 from Common
.LongFilePathSupport
import OpenLongFilePath
as open
23 from Common
.BuildToolError
import *
24 from Common
.Misc
import *
25 from Common
.String
import *
26 from BuildEngine
import *
27 import Common
.GlobalData
as GlobalData
29 ## Regular expression for finding header file inclusions
30 gIncludePattern
= re
.compile(r
"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?
[ \t]*)([-\w
.\\/() \t]+)(?
:[ \t]*[\">]?\
)?
)", re.MULTILINE|re.UNICODE|re.IGNORECASE)
32 ## Regular expression for matching macro used in header file inclusion
33 gMacroPattern = re.compile("([_A
-Z
][_A
-Z0
-9]*)[ \t]*\
((.+)\
)", re.UNICODE)
37 ## pattern for include style in Edk.x code
38 gProtocolDefinition = "Protocol
/%(HeaderKey)s/%(HeaderKey)s.h
"
39 gGuidDefinition = "Guid
/%(HeaderKey)s/%(HeaderKey)s.h
"
40 gArchProtocolDefinition = "ArchProtocol
/%(HeaderKey)s/%(HeaderKey)s.h
"
41 gPpiDefinition = "Ppi
/%(HeaderKey)s/%(HeaderKey)s.h
"
42 gIncludeMacroConversion = {
43 "EFI_PROTOCOL_DEFINITION
" : gProtocolDefinition,
44 "EFI_GUID_DEFINITION
" : gGuidDefinition,
45 "EFI_ARCH_PROTOCOL_DEFINITION
" : gArchProtocolDefinition,
46 "EFI_PROTOCOL_PRODUCER
" : gProtocolDefinition,
47 "EFI_PROTOCOL_CONSUMER
" : gProtocolDefinition,
48 "EFI_PROTOCOL_DEPENDENCY
" : gProtocolDefinition,
49 "EFI_ARCH_PROTOCOL_PRODUCER
" : gArchProtocolDefinition,
50 "EFI_ARCH_PROTOCOL_CONSUMER
" : gArchProtocolDefinition,
51 "EFI_ARCH_PROTOCOL_DEPENDENCY
" : gArchProtocolDefinition,
52 "EFI_PPI_DEFINITION
" : gPpiDefinition,
53 "EFI_PPI_PRODUCER
" : gPpiDefinition,
54 "EFI_PPI_CONSUMER
" : gPpiDefinition,
55 "EFI_PPI_DEPENDENCY
" : gPpiDefinition,
58 ## default makefile type
60 if sys.platform == "win32
":
68 # This base class encapsules build file and its generation. It uses template to generate
69 # the content of build file. The content of build file will be got from AutoGen objects.
71 class BuildFile(object):
72 ## template used to generate the build file (i.e. makefile if using make)
73 _TEMPLATE_ = TemplateString('')
75 _DEFAULT_FILE_NAME_ = "Makefile
"
77 ## default file name for each type of build file
80 "gmake
" : "GNUmakefile
"
83 ## Fixed header string for makefile
84 _MAKEFILE_HEADER = '''#
86 # This file is auto-generated by build utility
94 # Auto-generated makefile for building modules, libraries or platform
98 ## Header string for each type of build file
100 "nmake
" : _MAKEFILE_HEADER % _FILE_NAME_["nmake
"],
101 "gmake
" : _MAKEFILE_HEADER % _FILE_NAME_["gmake
"]
104 ## shell commands which can be used in build file in the form of macro
105 # $(CP) copy file command
106 # $(MV) move file command
107 # $(RM) remove file command
108 # $(MD) create dir command
109 # $(RD) remove dir command
117 "RD
" : "rmdir
/s
/q
",
129 ## directory separator
135 ## directory creation template
137 "nmake
" : 'if not exist %(dir)s $(MD) %(dir)s',
138 "gmake
" : "$
(MD
) %(dir)s"
141 ## directory removal template
143 "nmake
" : 'if exist %(dir)s $(RD) %(dir)s',
144 "gmake
" : "$
(RD
) %(dir)s"
148 "nmake
" : 'if exist %(dir)s cd %(dir)s',
149 "gmake
" : "test
-e
%(dir)s && cd
%(dir)s"
153 "nmake
" : 'if exist %(file)s "$
(MAKE
)" $(MAKE_FLAGS) -f %(file)s',
154 "gmake
" : 'test -e %(file)s && "$
(MAKE
)" $(MAKE_FLAGS) -f %(file)s'
158 "nmake
" : '!INCLUDE',
162 _INC_FLAG_ = {"MSFT
" : "/I
", "GCC
" : "-I
", "INTEL
" : "-I
", "RVCT
" : "-I
"}
164 ## Constructor of BuildFile
166 # @param AutoGenObject Object of AutoGen class
168 def __init__(self, AutoGenObject):
169 self._AutoGenObject = AutoGenObject
170 self._FileType = gMakeType
174 # @param FileType Type of build file. Only nmake and gmake are supported now.
176 # @retval TRUE The build file is created or re-created successfully
177 # @retval FALSE The build file exists and is the same as the one to be generated
179 def Generate(self, FileType=gMakeType):
180 if FileType not in self._FILE_NAME_:
181 EdkLogger.error("build
", PARAMETER_INVALID, "Invalid build
type [%s]" % FileType,
182 ExtraData="[%s]" % str(self._AutoGenObject))
183 self._FileType = FileType
184 FileContent = self._TEMPLATE_.Replace(self._TemplateDict)
185 FileName = self._FILE_NAME_[FileType]
186 return SaveFileOnChange(os.path.join(self._AutoGenObject.MakeFileDir, FileName), FileContent, False)
188 ## Return a list of directory creation command string
190 # @param DirList The list of directory to be created
192 # @retval list The directory creation command list
194 def GetCreateDirectoryCommand(self, DirList):
195 return [self._MD_TEMPLATE_[self._FileType] % {'dir':Dir} for Dir in DirList]
197 ## Return a list of directory removal command string
199 # @param DirList The list of directory to be removed
201 # @retval list The directory removal command list
203 def GetRemoveDirectoryCommand(self, DirList):
204 return [self._RD_TEMPLATE_[self._FileType] % {'dir':Dir} for Dir in DirList]
206 def PlaceMacro(self, Path, MacroDefinitions={}):
207 if Path.startswith("$
("):
210 PathLength = len(Path)
211 for MacroName in MacroDefinitions:
212 MacroValue = MacroDefinitions[MacroName]
213 MacroValueLength = len(MacroValue)
214 if MacroValueLength <= PathLength and Path.startswith(MacroValue):
215 Path = "$
(%s)%s" % (MacroName, Path[MacroValueLength:])
219 ## ModuleMakefile class
221 # This class encapsules makefie and its generation for module. It uses template to generate
222 # the content of makefile. The content of makefile will be got from ModuleAutoGen object.
224 class ModuleMakefile(BuildFile):
225 ## template used to generate the makefile for module
226 _TEMPLATE_ = TemplateString('''\
230 # Platform Macro Definition
232 PLATFORM_NAME = ${platform_name}
233 PLATFORM_GUID = ${platform_guid}
234 PLATFORM_VERSION = ${platform_version}
235 PLATFORM_RELATIVE_DIR = ${platform_relative_directory}
236 PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory}
237 PLATFORM_OUTPUT_DIR = ${platform_output_directory}
240 # Module Macro Definition
242 MODULE_NAME = ${module_name}
243 MODULE_GUID = ${module_guid}
244 MODULE_VERSION = ${module_version}
245 MODULE_TYPE = ${module_type}
246 MODULE_FILE = ${module_file}
247 MODULE_FILE_BASE_NAME = ${module_file_base_name}
248 BASE_NAME = $(MODULE_NAME)
249 MODULE_RELATIVE_DIR = ${module_relative_directory}
250 MODULE_DIR = $(WORKSPACE)${separator}${module_relative_directory}
252 MODULE_ENTRY_POINT = ${module_entry_point}
253 ARCH_ENTRY_POINT = ${arch_entry_point}
254 IMAGE_ENTRY_POINT = ${image_entry_point}
256 ${BEGIN}${module_extra_defines}
259 # Build Configuration Macro Definition
261 ARCH = ${architecture}
262 TOOLCHAIN = ${toolchain_tag}
263 TOOLCHAIN_TAG = ${toolchain_tag}
264 TARGET = ${build_target}
267 # Build Directory Macro Definition
269 # PLATFORM_BUILD_DIR = ${platform_build_directory}
270 BUILD_DIR = ${platform_build_directory}
271 BIN_DIR = $(BUILD_DIR)${separator}${architecture}
273 MODULE_BUILD_DIR = ${module_build_directory}
274 OUTPUT_DIR = ${module_output_directory}
275 DEBUG_DIR = ${module_debug_directory}
276 DEST_DIR_OUTPUT = $(OUTPUT_DIR)
277 DEST_DIR_DEBUG = $(DEBUG_DIR)
280 # Shell Command Macro
282 ${BEGIN}${shell_command_code} = ${shell_command}
286 # Tools definitions specific to this module
288 ${BEGIN}${module_tool_definitions}
290 MAKE_FILE = ${makefile_path}
295 ${BEGIN}${file_macro}
298 COMMON_DEPS = ${BEGIN}${common_dependency_file} \\
302 # Overridable Target Macro Definitions
304 FORCE_REBUILD = force_build
307 BC_TARGET = ${BEGIN}${backward_compatible_target} ${END}
308 CODA_TARGET = ${BEGIN}${remaining_build_target} \\
312 # Default target, which will build dependent libraries in addition to source files
319 # Target used when called from platform makefile, which will bypass the build of dependent libraries
322 pbuild: $(INIT_TARGET) $(BC_TARGET) $(PCH_TARGET) $(CODA_TARGET)
328 mbuild: $(INIT_TARGET) $(BC_TARGET) gen_libs $(PCH_TARGET) $(CODA_TARGET)
331 # Build Target used in multi-thread build mode, which will bypass the init and gen_libs targets
334 tbuild: $(BC_TARGET) $(PCH_TARGET) $(CODA_TARGET)
337 # Phony target which is used to force executing commands for a target
343 # Target to update the FD
349 # Initialization target: print build information and create necessary directories
354 \t-@echo Building ... $(MODULE_DIR)${separator}$(MODULE_FILE) [$(ARCH)]
357 ${BEGIN}\t-@${create_directory_command}\n${END}
360 \t-@$(CP) $(DEBUG_DIR)${separator}AutoGen.h $(DEBUG_DIR)${separator}$(MODULE_NAME)StrDefs.h
366 \t${BEGIN}@"$
(MAKE
)" $(MAKE_FLAGS) -f ${dependent_library_build_directory}${separator}${makefile_name}
367 \t${END}@cd $(MODULE_BUILD_DIR)
370 # Build Flash Device Image
373 \t@"$
(MAKE
)" $(MAKE_FLAGS) -f $(BUILD_DIR)${separator}${makefile_name} fds
374 \t@cd $(MODULE_BUILD_DIR)
377 # Individual Object Build Targets
379 ${BEGIN}${file_build_target}
383 # clean all intermediate files
386 \t${BEGIN}${clean_command}
390 # clean all generated files
393 ${BEGIN}\t${cleanall_command}
394 ${END}\t$(RM) *.pdb *.idb > NUL 2>&1
395 \t$(RM) $(BIN_DIR)${separator}$(MODULE_NAME).efi
398 # clean all dependent libraries built
401 \t${BEGIN}-@${library_build_command} cleanall
402 \t${END}@cd $(MODULE_BUILD_DIR)\n\n''')
404 _FILE_MACRO_TEMPLATE = TemplateString("${macro_name}
= ${BEGIN}
\\\n ${source_file}${END}
\n")
405 _BUILD_TARGET_TEMPLATE = TemplateString("${BEGIN}${target}
: ${deps}
\n${END}
\t${cmd}
\n")
407 ## Constructor of ModuleMakefile
409 # @param ModuleAutoGen Object of ModuleAutoGen class
411 def __init__(self, ModuleAutoGen):
412 BuildFile.__init__(self, ModuleAutoGen)
413 self.PlatformInfo = self._AutoGenObject.PlatformInfo
415 self.ResultFileList = []
416 self.IntermediateDirectoryList = ["$
(DEBUG_DIR
)", "$
(OUTPUT_DIR
)"]
418 self.SourceFileDatabase = {} # {file type : file path}
419 self.DestFileDatabase = {} # {file type : file path}
420 self.FileBuildTargetList = [] # [(src, target string)]
421 self.BuildTargetList = [] # [target string]
422 self.PendingBuildTargetList = [] # [FileBuildRule objects]
423 self.CommonFileDependency = []
424 self.FileListMacros = {}
425 self.ListFileMacros = {}
428 self.FileDependency = []
429 self.LibraryBuildCommandList = []
430 self.LibraryFileList = []
431 self.LibraryMakefileList = []
432 self.LibraryBuildDirectoryList = []
433 self.SystemLibraryList = []
434 self.Macros = sdict()
435 self.Macros["OUTPUT_DIR
" ] = self._AutoGenObject.Macros["OUTPUT_DIR
"]
436 self.Macros["DEBUG_DIR
" ] = self._AutoGenObject.Macros["DEBUG_DIR
"]
437 self.Macros["MODULE_BUILD_DIR
"] = self._AutoGenObject.Macros["MODULE_BUILD_DIR
"]
438 self.Macros["BIN_DIR
" ] = self._AutoGenObject.Macros["BIN_DIR
"]
439 self.Macros["BUILD_DIR
" ] = self._AutoGenObject.Macros["BUILD_DIR
"]
440 self.Macros["WORKSPACE
" ] = self._AutoGenObject.Macros["WORKSPACE
"]
442 # Compose a dict object containing information used to do replacement in template
443 def _CreateTemplateDict(self):
444 if self._FileType not in self._SEP_:
445 EdkLogger.error("build
", PARAMETER_INVALID, "Invalid Makefile
type [%s]" % self._FileType,
446 ExtraData="[%s]" % str(self._AutoGenObject))
447 Separator = self._SEP_[self._FileType]
449 # break build if no source files and binary files are found
450 if len(self._AutoGenObject.SourceFileList) == 0 and len(self._AutoGenObject.BinaryFileList) == 0:
451 EdkLogger.error("build
", AUTOGEN_ERROR, "No files to be built
in module
[%s, %s, %s]"
452 % (self._AutoGenObject.BuildTarget, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch),
453 ExtraData="[%s]" % str(self._AutoGenObject))
455 # convert dependent libraries to build command
456 self.ProcessDependentLibrary()
457 if len(self._AutoGenObject.Module.ModuleEntryPointList) > 0:
458 ModuleEntryPoint = self._AutoGenObject.Module.ModuleEntryPointList[0]
460 ModuleEntryPoint = "_ModuleEntryPoint
"
462 # Intel EBC compiler enforces EfiMain
463 if self._AutoGenObject.AutoGenVersion < 0x00010005 and self._AutoGenObject.Arch == "EBC
":
464 ArchEntryPoint = "EfiMain
"
466 ArchEntryPoint = ModuleEntryPoint
468 if self._AutoGenObject.Arch == "EBC
":
469 # EBC compiler always use "EfiStart
" as entry point. Only applies to EdkII modules
470 ImageEntryPoint = "EfiStart
"
471 elif self._AutoGenObject.AutoGenVersion < 0x00010005:
472 # Edk modules use entry point specified in INF file
473 ImageEntryPoint = ModuleEntryPoint
475 # EdkII modules always use "_ModuleEntryPoint
" as entry point
476 ImageEntryPoint = "_ModuleEntryPoint
"
480 IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]
481 for Tool in self._AutoGenObject.BuildOption:
482 for Attr in self._AutoGenObject.BuildOption[Tool]:
483 Value = self._AutoGenObject.BuildOption[Tool][Attr]
487 ToolsDef.append("%s = %s" % (Tool, Value))
489 # Don't generate MAKE_FLAGS in makefile. It's put in environment variable.
492 # Remove duplicated include path, if any
494 Value = RemoveDupOption(Value, IncPrefix, self._AutoGenObject.IncludePathList)
495 ToolsDef.append("%s_%s = %s" % (Tool, Attr, Value))
498 # convert source files and binary files to build targets
499 self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList]
500 if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0:
501 EdkLogger.error("build
", AUTOGEN_ERROR, "Nothing to build
",
502 ExtraData="[%s]" % str(self._AutoGenObject))
504 self.ProcessBuildTargetList()
506 # Generate macros used to represent input files
507 FileMacroList = [] # macro name = file list
508 for FileListMacro in self.FileListMacros:
509 FileMacro = self._FILE_MACRO_TEMPLATE.Replace(
511 "macro_name
" : FileListMacro,
512 "source_file
" : self.FileListMacros[FileListMacro]
515 FileMacroList.append(FileMacro)
517 # INC_LIST is special
520 for P in self._AutoGenObject.IncludePathList:
521 IncludePathList.append(IncPrefix+self.PlaceMacro(P, self.Macros))
522 if FileBuildRule.INC_LIST_MACRO in self.ListFileMacros:
523 self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(IncPrefix+P)
524 FileMacro += self._FILE_MACRO_TEMPLATE.Replace(
526 "macro_name
" : "INC
",
527 "source_file
" : IncludePathList
530 FileMacroList.append(FileMacro)
532 # Generate macros used to represent files containing list of input files
533 for ListFileMacro in self.ListFileMacros:
534 ListFileName = os.path.join(self._AutoGenObject.OutputDir, "%s.lst
" % ListFileMacro.lower()[:len(ListFileMacro)-5])
535 FileMacroList.append("%s = %s" % (ListFileMacro, ListFileName))
538 "\n".join(self.ListFileMacros[ListFileMacro]),
542 # Edk modules need <BaseName>StrDefs.h for string ID
543 #if self._AutoGenObject.AutoGenVersion < 0x00010005 and len(self._AutoGenObject.UnicodeFileList) > 0:
544 # BcTargetList = ['strdefs']
549 MakefileName = self._FILE_NAME_[self._FileType]
550 LibraryMakeCommandList = []
551 for D in self.LibraryBuildDirectoryList:
552 Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":os.path.join(D, MakefileName)}
553 LibraryMakeCommandList.append(Command)
555 MakefileTemplateDict = {
556 "makefile_header
" : self._FILE_HEADER_[self._FileType],
557 "makefile_path
" : os.path.join("$
(MODULE_BUILD_DIR
)", MakefileName),
558 "makefile_name
" : MakefileName,
559 "platform_name
" : self.PlatformInfo.Name,
560 "platform_guid
" : self.PlatformInfo.Guid,
561 "platform_version
" : self.PlatformInfo.Version,
562 "platform_relative_directory
": self.PlatformInfo.SourceDir,
563 "platform_output_directory
" : self.PlatformInfo.OutputDir,
565 "module_name
" : self._AutoGenObject.Name,
566 "module_guid
" : self._AutoGenObject.Guid,
567 "module_version
" : self._AutoGenObject.Version,
568 "module_type
" : self._AutoGenObject.ModuleType,
569 "module_file
" : self._AutoGenObject.MetaFile.Name,
570 "module_file_base_name
" : self._AutoGenObject.MetaFile.BaseName,
571 "module_relative_directory
" : self._AutoGenObject.SourceDir,
572 "module_extra_defines
" : ["%s = %s" % (k, v) for k,v in self._AutoGenObject.Module.Defines.iteritems()],
574 "architecture
" : self._AutoGenObject.Arch,
575 "toolchain_tag
" : self._AutoGenObject.ToolChain,
576 "build_target
" : self._AutoGenObject.BuildTarget,
578 "platform_build_directory
" : self.PlatformInfo.BuildDir,
579 "module_build_directory
" : self._AutoGenObject.BuildDir,
580 "module_output_directory
" : self._AutoGenObject.OutputDir,
581 "module_debug_directory
" : self._AutoGenObject.DebugDir,
583 "separator
" : Separator,
584 "module_tool_definitions
" : ToolsDef,
586 "shell_command_code
" : self._SHELL_CMD_[self._FileType].keys(),
587 "shell_command
" : self._SHELL_CMD_[self._FileType].values(),
589 "module_entry_point
" : ModuleEntryPoint,
590 "image_entry_point
" : ImageEntryPoint,
591 "arch_entry_point
" : ArchEntryPoint,
592 "remaining_build_target
" : self.ResultFileList,
593 "common_dependency_file
" : self.CommonFileDependency,
594 "create_directory_command
" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList),
595 "clean_command
" : self.GetRemoveDirectoryCommand(["$
(OUTPUT_DIR
)"]),
596 "cleanall_command
" : self.GetRemoveDirectoryCommand(["$
(DEBUG_DIR
)", "$
(OUTPUT_DIR
)"]),
597 "dependent_library_build_directory
" : self.LibraryBuildDirectoryList,
598 "library_build_command
" : LibraryMakeCommandList,
599 "file_macro
" : FileMacroList,
600 "file_build_target
" : self.BuildTargetList,
601 "backward_compatible_target
": BcTargetList,
604 return MakefileTemplateDict
606 def ProcessBuildTargetList(self):
608 # Search dependency file list for each source file
610 ForceIncludedFile = []
611 for File in self._AutoGenObject.AutoGenFileList:
613 ForceIncludedFile.append(File)
615 for Target in self._AutoGenObject.IntroTargetList:
616 SourceFileList.extend(Target.Inputs)
618 self.FileDependency = self.GetFileDependency(
621 self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList
624 for File in self.FileDependency:
625 if not self.FileDependency[File]:
626 self.FileDependency[File] = ['$(FORCE_REBUILD)']
629 if File.Ext not in [".c
", ".C
"] or File.Name == "AutoGen
.c
":
632 DepSet = set(self.FileDependency[File])
634 DepSet &= set(self.FileDependency[File])
635 # in case nothing in SourceFileList
639 # Extract common files list in the dependency files
642 self.CommonFileDependency.append(self.PlaceMacro(File.Path, self.Macros))
644 for File in self.FileDependency:
646 if File.Ext not in [".c
", ".C
"] or File.Name == "AutoGen
.c
":
648 NewDepSet = set(self.FileDependency[File])
650 self.FileDependency[File] = ["$
(COMMON_DEPS
)"] + list(NewDepSet)
652 # Convert target description object to target string in makefile
653 for Type in self._AutoGenObject.Targets:
654 for T in self._AutoGenObject.Targets[Type]:
655 # Generate related macros if needed
656 if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros:
657 self.FileListMacros[T.FileListMacro] = []
658 if T.GenListFile and T.ListFileMacro not in self.ListFileMacros:
659 self.ListFileMacros[T.ListFileMacro] = []
660 if T.GenIncListFile and T.IncListFileMacro not in self.ListFileMacros:
661 self.ListFileMacros[T.IncListFileMacro] = []
664 # Add force-dependencies
665 for Dep in T.Dependencies:
666 Deps.append(self.PlaceMacro(str(Dep), self.Macros))
667 # Add inclusion-dependencies
668 if len(T.Inputs) == 1 and T.Inputs[0] in self.FileDependency:
669 for F in self.FileDependency[T.Inputs[0]]:
670 Deps.append(self.PlaceMacro(str(F), self.Macros))
671 # Add source-dependencies
673 NewFile = self.PlaceMacro(str(F), self.Macros)
674 # In order to use file list macro as dependency
676 self.ListFileMacros[T.ListFileMacro].append(str(F))
677 self.FileListMacros[T.FileListMacro].append(NewFile)
678 elif T.GenFileListMacro:
679 self.FileListMacros[T.FileListMacro].append(NewFile)
683 # Use file list macro as dependency
684 if T.GenFileListMacro:
685 Deps.append("$
(%s)" % T.FileListMacro)
688 "target
" : self.PlaceMacro(T.Target.Path, self.Macros),
689 "cmd
" : "\n\t".join(T.Commands),
692 self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict))
694 ## For creating makefile targets for dependent libraries
695 def ProcessDependentLibrary(self):
696 for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList:
697 self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros))
699 ## Return a list containing source file's dependencies
701 # @param FileList The list of source files
702 # @param ForceInculeList The list of files which will be included forcely
703 # @param SearchPathList The list of search path
705 # @retval dict The mapping between source file path and its dependencies
707 def GetFileDependency(self, FileList, ForceInculeList, SearchPathList):
710 Dependency[F] = self.GetDependencyList(F, ForceInculeList, SearchPathList)
713 ## Find dependencies for one source file
715 # By searching recursively "#include" directive in file, find out all the
716 # files needed by given source file. The dependecies will be only searched
717 # in given search path list.
719 # @param File The source file
720 # @param ForceInculeList The list of files which will be included forcely
721 # @param SearchPathList The list of search path
723 # @retval list The list of files the given source file depends on
725 def GetDependencyList(self
, File
, ForceList
, SearchPathList
):
726 EdkLogger
.debug(EdkLogger
.DEBUG_1
, "Try to get dependency files for %s" % File
)
727 FileStack
= [File
] + ForceList
728 DependencySet
= set()
730 if self
._AutoGenObject
.Arch
not in gDependencyDatabase
:
731 gDependencyDatabase
[self
._AutoGenObject
.Arch
] = {}
732 DepDb
= gDependencyDatabase
[self
._AutoGenObject
.Arch
]
734 while len(FileStack
) > 0:
737 FullPathDependList
= []
738 if F
in self
.FileCache
:
739 for CacheFile
in self
.FileCache
[F
]:
740 FullPathDependList
.append(CacheFile
)
741 if CacheFile
not in DependencySet
:
742 FileStack
.append(CacheFile
)
743 DependencySet
.update(FullPathDependList
)
746 CurrentFileDependencyList
= []
748 CurrentFileDependencyList
= DepDb
[F
]
751 Fd
= open(F
.Path
, 'r')
752 except BaseException
, X
:
753 EdkLogger
.error("build", FILE_OPEN_FAILURE
, ExtraData
=F
.Path
+"\n\t"+str(X
))
755 FileContent
= Fd
.read()
757 if len(FileContent
) == 0:
760 if FileContent
[0] == 0xff or FileContent
[0] == 0xfe:
761 FileContent
= unicode(FileContent
, "utf-16")
762 IncludedFileList
= gIncludePattern
.findall(FileContent
)
764 for Inc
in IncludedFileList
:
766 # if there's macro used to reference header file, expand it
767 HeaderList
= gMacroPattern
.findall(Inc
)
768 if len(HeaderList
) == 1 and len(HeaderList
[0]) == 2:
769 HeaderType
= HeaderList
[0][0]
770 HeaderKey
= HeaderList
[0][1]
771 if HeaderType
in gIncludeMacroConversion
:
772 Inc
= gIncludeMacroConversion
[HeaderType
] % {"HeaderKey" : HeaderKey
}
774 # not known macro used in #include, always build the file by
775 # returning a empty dependency
776 self
.FileCache
[File
] = []
778 Inc
= os
.path
.normpath(Inc
)
779 CurrentFileDependencyList
.append(Inc
)
780 DepDb
[F
] = CurrentFileDependencyList
782 CurrentFilePath
= F
.Dir
783 PathList
= [CurrentFilePath
] + SearchPathList
784 for Inc
in CurrentFileDependencyList
:
785 for SearchPath
in PathList
:
786 FilePath
= os
.path
.join(SearchPath
, Inc
)
787 if FilePath
in gIsFileMap
:
788 if not gIsFileMap
[FilePath
]:
790 # If isfile is called too many times, the performance is slow down.
791 elif not os
.path
.isfile(FilePath
):
792 gIsFileMap
[FilePath
] = False
795 gIsFileMap
[FilePath
] = True
796 FilePath
= PathClass(FilePath
)
797 FullPathDependList
.append(FilePath
)
798 if FilePath
not in DependencySet
:
799 FileStack
.append(FilePath
)
802 EdkLogger
.debug(EdkLogger
.DEBUG_9
, "%s included by %s was not found "\
803 "in any given path:\n\t%s" % (Inc
, F
, "\n\t".join(SearchPathList
)))
805 self
.FileCache
[F
] = FullPathDependList
806 DependencySet
.update(FullPathDependList
)
808 DependencySet
.update(ForceList
)
809 if File
in DependencySet
:
810 DependencySet
.remove(File
)
811 DependencyList
= list(DependencySet
) # remove duplicate ones
813 return DependencyList
815 _TemplateDict
= property(_CreateTemplateDict
)
817 ## CustomMakefile class
819 # This class encapsules makefie and its generation for module. It uses template to generate
820 # the content of makefile. The content of makefile will be got from ModuleAutoGen object.
822 class CustomMakefile(BuildFile
):
823 ## template used to generate the makefile for module with custom makefile
824 _TEMPLATE_
= TemplateString('''\
828 # Platform Macro Definition
830 PLATFORM_NAME = ${platform_name}
831 PLATFORM_GUID = ${platform_guid}
832 PLATFORM_VERSION = ${platform_version}
833 PLATFORM_RELATIVE_DIR = ${platform_relative_directory}
834 PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory}
835 PLATFORM_OUTPUT_DIR = ${platform_output_directory}
838 # Module Macro Definition
840 MODULE_NAME = ${module_name}
841 MODULE_GUID = ${module_guid}
842 MODULE_VERSION = ${module_version}
843 MODULE_TYPE = ${module_type}
844 MODULE_FILE = ${module_file}
845 MODULE_FILE_BASE_NAME = ${module_file_base_name}
846 BASE_NAME = $(MODULE_NAME)
847 MODULE_RELATIVE_DIR = ${module_relative_directory}
848 MODULE_DIR = $(WORKSPACE)${separator}${module_relative_directory}
851 # Build Configuration Macro Definition
853 ARCH = ${architecture}
854 TOOLCHAIN = ${toolchain_tag}
855 TOOLCHAIN_TAG = ${toolchain_tag}
856 TARGET = ${build_target}
859 # Build Directory Macro Definition
861 # PLATFORM_BUILD_DIR = ${platform_build_directory}
862 BUILD_DIR = ${platform_build_directory}
863 BIN_DIR = $(BUILD_DIR)${separator}${architecture}
865 MODULE_BUILD_DIR = ${module_build_directory}
866 OUTPUT_DIR = ${module_output_directory}
867 DEBUG_DIR = ${module_debug_directory}
868 DEST_DIR_OUTPUT = $(OUTPUT_DIR)
869 DEST_DIR_DEBUG = $(DEBUG_DIR)
872 # Tools definitions specific to this module
874 ${BEGIN}${module_tool_definitions}
876 MAKE_FILE = ${makefile_path}
879 # Shell Command Macro
881 ${BEGIN}${shell_command_code} = ${shell_command}
884 ${custom_makefile_content}
887 # Target used when called from platform makefile, which will bypass the build of dependent libraries
900 # Build Target used in multi-thread build mode, which no init target is needed
906 # Initialization target: print build information and create necessary directories
909 \t-@echo Building ... $(MODULE_DIR)${separator}$(MODULE_FILE) [$(ARCH)]
910 ${BEGIN}\t-@${create_directory_command}\n${END}\
914 ## Constructor of CustomMakefile
916 # @param ModuleAutoGen Object of ModuleAutoGen class
918 def __init__(self
, ModuleAutoGen
):
919 BuildFile
.__init
__(self
, ModuleAutoGen
)
920 self
.PlatformInfo
= self
._AutoGenObject
.PlatformInfo
921 self
.IntermediateDirectoryList
= ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]
923 # Compose a dict object containing information used to do replacement in template
924 def _CreateTemplateDict(self
):
925 Separator
= self
._SEP
_[self
._FileType
]
926 if self
._FileType
not in self
._AutoGenObject
.CustomMakefile
:
927 EdkLogger
.error('build', OPTION_NOT_SUPPORTED
, "No custom makefile for %s" % self
._FileType
,
928 ExtraData
="[%s]" % str(self
._AutoGenObject
))
929 MakefilePath
= os
.path
.join(
930 self
._AutoGenObject
.WorkspaceDir
,
931 self
._AutoGenObject
.CustomMakefile
[self
._FileType
]
934 CustomMakefile
= open(MakefilePath
, 'r').read()
936 EdkLogger
.error('build', FILE_OPEN_FAILURE
, File
=str(self
._AutoGenObject
),
937 ExtraData
=self
._AutoGenObject
.CustomMakefile
[self
._FileType
])
941 for Tool
in self
._AutoGenObject
.BuildOption
:
942 # Don't generate MAKE_FLAGS in makefile. It's put in environment variable.
945 for Attr
in self
._AutoGenObject
.BuildOption
[Tool
]:
949 ToolsDef
.append("%s = %s" % (Tool
, self
._AutoGenObject
.BuildOption
[Tool
][Attr
]))
951 ToolsDef
.append("%s_%s = %s" % (Tool
, Attr
, self
._AutoGenObject
.BuildOption
[Tool
][Attr
]))
954 MakefileName
= self
._FILE
_NAME
_[self
._FileType
]
955 MakefileTemplateDict
= {
956 "makefile_header" : self
._FILE
_HEADER
_[self
._FileType
],
957 "makefile_path" : os
.path
.join("$(MODULE_BUILD_DIR)", MakefileName
),
958 "platform_name" : self
.PlatformInfo
.Name
,
959 "platform_guid" : self
.PlatformInfo
.Guid
,
960 "platform_version" : self
.PlatformInfo
.Version
,
961 "platform_relative_directory": self
.PlatformInfo
.SourceDir
,
962 "platform_output_directory" : self
.PlatformInfo
.OutputDir
,
964 "module_name" : self
._AutoGenObject
.Name
,
965 "module_guid" : self
._AutoGenObject
.Guid
,
966 "module_version" : self
._AutoGenObject
.Version
,
967 "module_type" : self
._AutoGenObject
.ModuleType
,
968 "module_file" : self
._AutoGenObject
.MetaFile
,
969 "module_file_base_name" : self
._AutoGenObject
.MetaFile
.BaseName
,
970 "module_relative_directory" : self
._AutoGenObject
.SourceDir
,
972 "architecture" : self
._AutoGenObject
.Arch
,
973 "toolchain_tag" : self
._AutoGenObject
.ToolChain
,
974 "build_target" : self
._AutoGenObject
.BuildTarget
,
976 "platform_build_directory" : self
.PlatformInfo
.BuildDir
,
977 "module_build_directory" : self
._AutoGenObject
.BuildDir
,
978 "module_output_directory" : self
._AutoGenObject
.OutputDir
,
979 "module_debug_directory" : self
._AutoGenObject
.DebugDir
,
981 "separator" : Separator
,
982 "module_tool_definitions" : ToolsDef
,
984 "shell_command_code" : self
._SHELL
_CMD
_[self
._FileType
].keys(),
985 "shell_command" : self
._SHELL
_CMD
_[self
._FileType
].values(),
987 "create_directory_command" : self
.GetCreateDirectoryCommand(self
.IntermediateDirectoryList
),
988 "custom_makefile_content" : CustomMakefile
991 return MakefileTemplateDict
993 _TemplateDict
= property(_CreateTemplateDict
)
995 ## PlatformMakefile class
997 # This class encapsules makefie and its generation for platform. It uses
998 # template to generate the content of makefile. The content of makefile will be
999 # got from PlatformAutoGen object.
1001 class PlatformMakefile(BuildFile
):
1002 ## template used to generate the makefile for platform
1003 _TEMPLATE_
= TemplateString('''\
1007 # Platform Macro Definition
1009 PLATFORM_NAME = ${platform_name}
1010 PLATFORM_GUID = ${platform_guid}
1011 PLATFORM_VERSION = ${platform_version}
1012 PLATFORM_FILE = ${platform_file}
1013 PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory}
1014 PLATFORM_OUTPUT_DIR = ${platform_output_directory}
1017 # Build Configuration Macro Definition
1019 TOOLCHAIN = ${toolchain_tag}
1020 TOOLCHAIN_TAG = ${toolchain_tag}
1021 TARGET = ${build_target}
1024 # Build Directory Macro Definition
1026 BUILD_DIR = ${platform_build_directory}
1027 FV_DIR = ${platform_build_directory}${separator}FV
1030 # Shell Command Macro
1032 ${BEGIN}${shell_command_code} = ${shell_command}
1036 MAKE_FILE = ${makefile_path}
1041 all: init build_libraries build_modules
1044 # Initialization target: print build information and create necessary directories
1047 \t-@echo Building ... $(PLATFORM_FILE) [${build_architecture_list}]
1048 \t${BEGIN}-@${create_directory_command}
1051 # library build target
1053 libraries: init build_libraries
1056 # module build target
1058 modules: init build_libraries build_modules
1061 # Build all libraries:
1064 ${BEGIN}\t@"$(MAKE)" $(MAKE_FLAGS) -f ${library_makefile_list} pbuild
1065 ${END}\t@cd $(BUILD_DIR)
1068 # Build all modules:
1071 ${BEGIN}\t@"$(MAKE)" $(MAKE_FLAGS) -f ${module_makefile_list} pbuild
1072 ${END}\t@cd $(BUILD_DIR)
1075 # Clean intermediate files
1078 \t${BEGIN}-@${library_build_command} clean
1079 \t${END}${BEGIN}-@${module_build_command} clean
1080 \t${END}@cd $(BUILD_DIR)
1083 # Clean all generated files except to makefile
1086 ${BEGIN}\t${cleanall_command}
1090 # Clean all library files
1093 \t${BEGIN}-@${library_build_command} cleanall
1094 \t${END}@cd $(BUILD_DIR)\n
1097 ## Constructor of PlatformMakefile
1099 # @param ModuleAutoGen Object of PlatformAutoGen class
1101 def __init__(self
, PlatformAutoGen
):
1102 BuildFile
.__init
__(self
, PlatformAutoGen
)
1103 self
.ModuleBuildCommandList
= []
1104 self
.ModuleMakefileList
= []
1105 self
.IntermediateDirectoryList
= []
1106 self
.ModuleBuildDirectoryList
= []
1107 self
.LibraryBuildDirectoryList
= []
1108 self
.LibraryMakeCommandList
= []
1110 # Compose a dict object containing information used to do replacement in template
1111 def _CreateTemplateDict(self
):
1112 Separator
= self
._SEP
_[self
._FileType
]
1114 PlatformInfo
= self
._AutoGenObject
1115 if "MAKE" not in PlatformInfo
.ToolDefinition
or "PATH" not in PlatformInfo
.ToolDefinition
["MAKE"]:
1116 EdkLogger
.error("build", OPTION_MISSING
, "No MAKE command defined. Please check your tools_def.txt!",
1117 ExtraData
="[%s]" % str(self
._AutoGenObject
))
1119 self
.IntermediateDirectoryList
= ["$(BUILD_DIR)"]
1120 self
.ModuleBuildDirectoryList
= self
.GetModuleBuildDirectoryList()
1121 self
.LibraryBuildDirectoryList
= self
.GetLibraryBuildDirectoryList()
1123 MakefileName
= self
._FILE
_NAME
_[self
._FileType
]
1124 LibraryMakefileList
= []
1125 LibraryMakeCommandList
= []
1126 for D
in self
.LibraryBuildDirectoryList
:
1127 D
= self
.PlaceMacro(D
, {"BUILD_DIR":PlatformInfo
.BuildDir
})
1128 Makefile
= os
.path
.join(D
, MakefileName
)
1129 Command
= self
._MAKE
_TEMPLATE
_[self
._FileType
] % {"file":Makefile
}
1130 LibraryMakefileList
.append(Makefile
)
1131 LibraryMakeCommandList
.append(Command
)
1132 self
.LibraryMakeCommandList
= LibraryMakeCommandList
1134 ModuleMakefileList
= []
1135 ModuleMakeCommandList
= []
1136 for D
in self
.ModuleBuildDirectoryList
:
1137 D
= self
.PlaceMacro(D
, {"BUILD_DIR":PlatformInfo
.BuildDir
})
1138 Makefile
= os
.path
.join(D
, MakefileName
)
1139 Command
= self
._MAKE
_TEMPLATE
_[self
._FileType
] % {"file":Makefile
}
1140 ModuleMakefileList
.append(Makefile
)
1141 ModuleMakeCommandList
.append(Command
)
1143 MakefileTemplateDict
= {
1144 "makefile_header" : self
._FILE
_HEADER
_[self
._FileType
],
1145 "makefile_path" : os
.path
.join("$(BUILD_DIR)", MakefileName
),
1146 "make_path" : PlatformInfo
.ToolDefinition
["MAKE"]["PATH"],
1147 "makefile_name" : MakefileName
,
1148 "platform_name" : PlatformInfo
.Name
,
1149 "platform_guid" : PlatformInfo
.Guid
,
1150 "platform_version" : PlatformInfo
.Version
,
1151 "platform_file" : self
._AutoGenObject
.MetaFile
,
1152 "platform_relative_directory": PlatformInfo
.SourceDir
,
1153 "platform_output_directory" : PlatformInfo
.OutputDir
,
1154 "platform_build_directory" : PlatformInfo
.BuildDir
,
1156 "toolchain_tag" : PlatformInfo
.ToolChain
,
1157 "build_target" : PlatformInfo
.BuildTarget
,
1158 "shell_command_code" : self
._SHELL
_CMD
_[self
._FileType
].keys(),
1159 "shell_command" : self
._SHELL
_CMD
_[self
._FileType
].values(),
1160 "build_architecture_list" : self
._AutoGenObject
.Arch
,
1161 "architecture" : self
._AutoGenObject
.Arch
,
1162 "separator" : Separator
,
1163 "create_directory_command" : self
.GetCreateDirectoryCommand(self
.IntermediateDirectoryList
),
1164 "cleanall_command" : self
.GetRemoveDirectoryCommand(self
.IntermediateDirectoryList
),
1165 "library_makefile_list" : LibraryMakefileList
,
1166 "module_makefile_list" : ModuleMakefileList
,
1167 "library_build_command" : LibraryMakeCommandList
,
1168 "module_build_command" : ModuleMakeCommandList
,
1171 return MakefileTemplateDict
1173 ## Get the root directory list for intermediate files of all modules build
1175 # @retval list The list of directory
1177 def GetModuleBuildDirectoryList(self
):
1179 for ModuleAutoGen
in self
._AutoGenObject
.ModuleAutoGenList
:
1180 DirList
.append(os
.path
.join(self
._AutoGenObject
.BuildDir
, ModuleAutoGen
.BuildDir
))
1183 ## Get the root directory list for intermediate files of all libraries build
1185 # @retval list The list of directory
1187 def GetLibraryBuildDirectoryList(self
):
1189 for LibraryAutoGen
in self
._AutoGenObject
.LibraryAutoGenList
:
1190 DirList
.append(os
.path
.join(self
._AutoGenObject
.BuildDir
, LibraryAutoGen
.BuildDir
))
1193 _TemplateDict
= property(_CreateTemplateDict
)
1195 ## TopLevelMakefile class
1197 # This class encapsules makefie and its generation for entrance makefile. It
1198 # uses template to generate the content of makefile. The content of makefile
1199 # will be got from WorkspaceAutoGen object.
1201 class TopLevelMakefile(BuildFile
):
1202 ## template used to generate toplevel makefile
1203 _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}''')
1205 ## Constructor of TopLevelMakefile
1207 # @param Workspace Object of WorkspaceAutoGen class
1209 def __init__(self
, Workspace
):
1210 BuildFile
.__init
__(self
, Workspace
)
1211 self
.IntermediateDirectoryList
= []
1213 # Compose a dict object containing information used to do replacement in template
1214 def _CreateTemplateDict(self
):
1215 Separator
= self
._SEP
_[self
._FileType
]
1217 # any platform autogen object is ok because we just need common information
1218 PlatformInfo
= self
._AutoGenObject
1220 if "MAKE" not in PlatformInfo
.ToolDefinition
or "PATH" not in PlatformInfo
.ToolDefinition
["MAKE"]:
1221 EdkLogger
.error("build", OPTION_MISSING
, "No MAKE command defined. Please check your tools_def.txt!",
1222 ExtraData
="[%s]" % str(self
._AutoGenObject
))
1224 for Arch
in PlatformInfo
.ArchList
:
1225 self
.IntermediateDirectoryList
.append(Separator
.join(["$(BUILD_DIR)", Arch
]))
1226 self
.IntermediateDirectoryList
.append("$(FV_DIR)")
1228 # TRICK: for not generating GenFds call in makefile if no FDF file
1230 if PlatformInfo
.FdfFile
!= None and PlatformInfo
.FdfFile
!= "":
1231 FdfFileList
= [PlatformInfo
.FdfFile
]
1232 # macros passed to GenFds
1233 MacroList
.append('"%s=%s"' % ("EFI_SOURCE", GlobalData
.gEfiSource
.replace('\\', '\\\\')))
1234 MacroList
.append('"%s=%s"' % ("EDK_SOURCE", GlobalData
.gEdkSource
.replace('\\', '\\\\')))
1236 MacroDict
.update(GlobalData
.gGlobalDefines
)
1237 MacroDict
.update(GlobalData
.gCommandLineDefines
)
1238 MacroDict
.pop("EFI_SOURCE", "dummy")
1239 MacroDict
.pop("EDK_SOURCE", "dummy")
1240 for MacroName
in MacroDict
:
1241 if MacroDict
[MacroName
] != "":
1242 MacroList
.append('"%s=%s"' % (MacroName
, MacroDict
[MacroName
].replace('\\', '\\\\')))
1244 MacroList
.append('"%s"' % MacroName
)
1248 # pass extra common options to external program called in makefile, currently GenFds.exe
1250 LogLevel
= EdkLogger
.GetLevel()
1251 if LogLevel
== EdkLogger
.VERBOSE
:
1252 ExtraOption
+= " -v"
1253 elif LogLevel
<= EdkLogger
.DEBUG_9
:
1254 ExtraOption
+= " -d %d" % (LogLevel
- 1)
1255 elif LogLevel
== EdkLogger
.QUIET
:
1256 ExtraOption
+= " -q"
1258 if GlobalData
.gCaseInsensitive
:
1259 ExtraOption
+= " -c"
1261 MakefileName
= self
._FILE
_NAME
_[self
._FileType
]
1262 SubBuildCommandList
= []
1263 for A
in PlatformInfo
.ArchList
:
1264 Command
= self
._MAKE
_TEMPLATE
_[self
._FileType
] % {"file":os
.path
.join("$(BUILD_DIR)", A
, MakefileName
)}
1265 SubBuildCommandList
.append(Command
)
1267 MakefileTemplateDict
= {
1268 "makefile_header" : self
._FILE
_HEADER
_[self
._FileType
],
1269 "makefile_path" : os
.path
.join("$(BUILD_DIR)", MakefileName
),
1270 "make_path" : PlatformInfo
.ToolDefinition
["MAKE"]["PATH"],
1271 "platform_name" : PlatformInfo
.Name
,
1272 "platform_guid" : PlatformInfo
.Guid
,
1273 "platform_version" : PlatformInfo
.Version
,
1274 "platform_build_directory" : PlatformInfo
.BuildDir
,
1276 "toolchain_tag" : PlatformInfo
.ToolChain
,
1277 "build_target" : PlatformInfo
.BuildTarget
,
1278 "shell_command_code" : self
._SHELL
_CMD
_[self
._FileType
].keys(),
1279 "shell_command" : self
._SHELL
_CMD
_[self
._FileType
].values(),
1280 'arch' : list(PlatformInfo
.ArchList
),
1281 "build_architecture_list" : ','.join(PlatformInfo
.ArchList
),
1282 "separator" : Separator
,
1283 "create_directory_command" : self
.GetCreateDirectoryCommand(self
.IntermediateDirectoryList
),
1284 "cleanall_command" : self
.GetRemoveDirectoryCommand(self
.IntermediateDirectoryList
),
1285 "sub_build_command" : SubBuildCommandList
,
1286 "fdf_file" : FdfFileList
,
1287 "active_platform" : str(PlatformInfo
),
1288 "fd" : PlatformInfo
.FdTargetList
,
1289 "fv" : PlatformInfo
.FvTargetList
,
1290 "cap" : PlatformInfo
.CapTargetList
,
1291 "extra_options" : ExtraOption
,
1292 "macro" : MacroList
,
1295 return MakefileTemplateDict
1297 ## Get the root directory list for intermediate files of all modules build
1299 # @retval list The list of directory
1301 def GetModuleBuildDirectoryList(self
):
1303 for ModuleAutoGen
in self
._AutoGenObject
.ModuleAutoGenList
:
1304 DirList
.append(os
.path
.join(self
._AutoGenObject
.BuildDir
, ModuleAutoGen
.BuildDir
))
1307 ## Get the root directory list for intermediate files of all libraries build
1309 # @retval list The list of directory
1311 def GetLibraryBuildDirectoryList(self
):
1313 for LibraryAutoGen
in self
._AutoGenObject
.LibraryAutoGenList
:
1314 DirList
.append(os
.path
.join(self
._AutoGenObject
.BuildDir
, LibraryAutoGen
.BuildDir
))
1317 _TemplateDict
= property(_CreateTemplateDict
)
1319 # This acts like the main() function for the script, unless it is 'import'ed into another script.
1320 if __name__
== '__main__':