mirror of https://github.com/acidanthera/audk.git
Python script for generating build files for platform and modules, which uses the enhanced XmlRoutines.py written by Bruce.
The functionalities include: - parse all packages(.spd) and modules(.msa) - parse active platform(.fpd). You must set active platform in target.txt otherwise nothing will be parsed. - parse tools_def.txt and target.txt - generate Ant build files for active platform and its modules. The generated build file is re-designed and can be called separately once generated. - multi-thread build The functionalities which haven't been implemented include: - AutoGen. No AutoGen.h and AutoGen.c will be generated. If you want run the build file, you have to run the "build" command in advance to generate the AutoGen.h/.c files and remove the any other intermediate files. - generate FFS and FV files. Only compiling will be done by the generated build file. Usage: - type "python ${WORKSPACE}/Tools/Python/buildgen/BuildFile.py" in shell to generate build file - goto "${WORKSPACE}/Build/${platform}/${target}_${toolchaintag}/", type "ant" to run the build file git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2278 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
41ac48e930
commit
2897231803
|
@ -0,0 +1,84 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright (c) 2007, Intel Corporation
|
||||||
|
# All rights reserved. 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
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
"""Ant Tasks Dom Element"""
|
||||||
|
|
||||||
|
import xml.dom.minidom, os
|
||||||
|
|
||||||
|
class AntTask:
|
||||||
|
def __init__(self, document, _name, _body=None, **_attributes):
|
||||||
|
"""Instantiate an Ant task element
|
||||||
|
document, _name=task name, _body=task body, **_attributes=task attributes
|
||||||
|
"""
|
||||||
|
self.Document = document
|
||||||
|
self.Root = ""
|
||||||
|
|
||||||
|
if _name == None or _name == "":
|
||||||
|
raise Exception("No Ant task name")
|
||||||
|
|
||||||
|
taskElement = self.Document.createElement(_name)
|
||||||
|
for name in _attributes:
|
||||||
|
taskElement.setAttribute(name, _attributes[name])
|
||||||
|
|
||||||
|
if _body != None:
|
||||||
|
if isinstance(_body, str):
|
||||||
|
text = self.Document.createTextNode(_body)
|
||||||
|
taskElement.appendChild(text)
|
||||||
|
elif isinstance(_body, list):
|
||||||
|
for subtask in _body:
|
||||||
|
taskElement.appendChild(subtask)
|
||||||
|
|
||||||
|
self.Root = taskElement
|
||||||
|
|
||||||
|
def SubTask(self, _name, _body=None, **_attributes):
|
||||||
|
"""Insert a sub-task into this task"""
|
||||||
|
newTask = AntTask(self.Document, _name , _body, **_attributes)
|
||||||
|
self.Root.appendChild(newTask.Root)
|
||||||
|
return newTask
|
||||||
|
|
||||||
|
def AddSubTask(self, subTask):
|
||||||
|
"""Insert a existing sub-task into this task"""
|
||||||
|
self.Root.appendChild(subTask.Root.cloneNode(True))
|
||||||
|
return subTask
|
||||||
|
|
||||||
|
def Comment(self, string):
|
||||||
|
"""Generate a XML comment"""
|
||||||
|
self.Root.appendChild(self.Document.createComment(string))
|
||||||
|
|
||||||
|
def Blankline(self):
|
||||||
|
"""Generate a blank line"""
|
||||||
|
self.Root.appendChild(self.Document.createTextNode(""))
|
||||||
|
|
||||||
|
|
||||||
|
class AntBuildFile(AntTask):
|
||||||
|
_FileComment = "DO NOT EDIT\nThis file is auto-generated by the build utility\n\nAbstract:\nAuto-generated ANT build file for building Framework modules and platforms\n"
|
||||||
|
|
||||||
|
def __init__(self, name, basedir=".", default="all"):
|
||||||
|
"""Instantiate an Ant build.xml
|
||||||
|
name=project name, basedir=project default directory, default=default target of this project
|
||||||
|
"""
|
||||||
|
self.Document = xml.dom.minidom.getDOMImplementation().createDocument(None, "project", None)
|
||||||
|
self.Root = self.Document.documentElement
|
||||||
|
|
||||||
|
self.Document.insertBefore(self.Document.createComment(self._FileComment), self.Root)
|
||||||
|
self.Root.setAttribute("name", name)
|
||||||
|
self.Root.setAttribute("basedir", basedir)
|
||||||
|
self.Root.setAttribute("default", default)
|
||||||
|
|
||||||
|
def Create(self, file):
|
||||||
|
"""Generate the build.xml using given file path"""
|
||||||
|
buildFileDir = os.path.dirname(file)
|
||||||
|
if not os.path.exists(buildFileDir):
|
||||||
|
os.makedirs(buildFileDir)
|
||||||
|
|
||||||
|
f = open(file, "w")
|
||||||
|
f.write(self.Document.toprettyxml(2*" ", encoding="UTF-8"))
|
||||||
|
f.close()
|
|
@ -0,0 +1,185 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright (c) 2007, Intel Corporation
|
||||||
|
# All rights reserved. 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
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
"""Tools and build configuration"""
|
||||||
|
|
||||||
|
from sets import Set
|
||||||
|
|
||||||
|
class Config(dict):
|
||||||
|
def __init__(self, file):
|
||||||
|
"""file (target configuration file)"""
|
||||||
|
configFile = open(file)
|
||||||
|
while True:
|
||||||
|
line = configFile.readline()
|
||||||
|
if line == "": break ## no more line
|
||||||
|
|
||||||
|
line = line.strip()
|
||||||
|
# skip blank line
|
||||||
|
if line == "": continue
|
||||||
|
# skip comment line
|
||||||
|
if line[0] == '#': continue
|
||||||
|
# skip invalid line
|
||||||
|
if line[0] == '=':
|
||||||
|
print "! invalid configuration:", line
|
||||||
|
continue
|
||||||
|
|
||||||
|
defStrings = line.split('=', 1)
|
||||||
|
name = defStrings[0].strip()
|
||||||
|
value = defStrings[1].strip()
|
||||||
|
self[name] = value
|
||||||
|
|
||||||
|
configFile.close()
|
||||||
|
|
||||||
|
def __getitem__(self, attr):
|
||||||
|
if attr not in self:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
value = dict.__getitem__(self, attr)
|
||||||
|
if value == None:
|
||||||
|
value = ""
|
||||||
|
return value
|
||||||
|
|
||||||
|
class ToolConfig(dict):
|
||||||
|
def __init__(self, file):
|
||||||
|
"""file (tools configuration file path)"""
|
||||||
|
self.Targets = Set()
|
||||||
|
self.Toolchains = Set()
|
||||||
|
self.Archs = Set()
|
||||||
|
self.ToolCodes = Set()
|
||||||
|
self.Families = Set()
|
||||||
|
self.Attributes = Set(["FAMILY", "NAME", "PATH", "FLAGS", "EXT", "DPATH", "SPATH", "LIBPATH", "INCLUDEPATH"])
|
||||||
|
|
||||||
|
configFile = open(file)
|
||||||
|
while True:
|
||||||
|
line = configFile.readline()
|
||||||
|
if line == "": break
|
||||||
|
|
||||||
|
line = line.strip()
|
||||||
|
# skip blank line
|
||||||
|
if line == "": continue
|
||||||
|
# skip comment line
|
||||||
|
if line[0] == '#': continue
|
||||||
|
# skip invalid line
|
||||||
|
if line[0] == '=':
|
||||||
|
print "! invalid definition:", line
|
||||||
|
continue
|
||||||
|
|
||||||
|
# split the definition at the first "="
|
||||||
|
tool_def = line.split('=', 1)
|
||||||
|
name = tool_def[0].strip()
|
||||||
|
value = tool_def[1].strip()
|
||||||
|
|
||||||
|
# the name of a tool definition must have five parts concatenated by "_"
|
||||||
|
keys = name.split('_')
|
||||||
|
# skip non-definition line
|
||||||
|
if len(keys) < 5: continue
|
||||||
|
|
||||||
|
keys = (keys[1], keys[0], keys[2], keys[3], keys[4])
|
||||||
|
self[keys] = value
|
||||||
|
|
||||||
|
###############################################
|
||||||
|
## statistics
|
||||||
|
###############################################
|
||||||
|
if keys[0] != '*': self.Toolchains.add(keys[0])
|
||||||
|
if keys[1] != '*': self.Targets.add(keys[1])
|
||||||
|
if keys[2] != '*': self.Archs.add(keys[2])
|
||||||
|
if keys[3] != '*': self.ToolCodes.add(keys[3])
|
||||||
|
if keys[4] == "FAMILY": self.Families.add(value)
|
||||||
|
elif keys[4] == '*': raise Exception("No * allowed in ATTRIBUTE field")
|
||||||
|
|
||||||
|
configFile.close()
|
||||||
|
# expand the "*" in each field
|
||||||
|
self.expand()
|
||||||
|
|
||||||
|
def __getitem__(self, attrs):
|
||||||
|
if len(attrs) != 5:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if attrs not in self:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
value = dict.__getitem__(self, attrs)
|
||||||
|
if value == None:
|
||||||
|
value = ""
|
||||||
|
return value
|
||||||
|
|
||||||
|
def expand(self):
|
||||||
|
summary = {}
|
||||||
|
toolchains = []
|
||||||
|
targets = []
|
||||||
|
archs = []
|
||||||
|
toolcodes = []
|
||||||
|
for key in self:
|
||||||
|
value = self[key]
|
||||||
|
if key[0] == '*':
|
||||||
|
toolchains = self.Toolchains
|
||||||
|
else:
|
||||||
|
toolchains = [key[0]]
|
||||||
|
|
||||||
|
for toolchain in toolchains:
|
||||||
|
if key[1] == '*':
|
||||||
|
targets = self.Targets
|
||||||
|
else:
|
||||||
|
targets = [key[1]]
|
||||||
|
|
||||||
|
for target in targets:
|
||||||
|
if key[2] == '*':
|
||||||
|
archs = self.Archs
|
||||||
|
else:
|
||||||
|
archs = [key[2]]
|
||||||
|
|
||||||
|
for arch in archs:
|
||||||
|
if key[3] == '*':
|
||||||
|
toolcodes = self.ToolCodes
|
||||||
|
else:
|
||||||
|
toolcodes = [key[3]]
|
||||||
|
|
||||||
|
for toolcode in toolcodes:
|
||||||
|
attribute = key[4]
|
||||||
|
summary[(toolchain, target, arch, toolcode, attribute)] = value
|
||||||
|
self.clear()
|
||||||
|
for toolchain in self.Toolchains:
|
||||||
|
for target in self.Targets:
|
||||||
|
for arch in self.Archs:
|
||||||
|
for toolcode in self.ToolCodes:
|
||||||
|
key = (toolchain, target, arch, toolcode, "NAME")
|
||||||
|
if key not in summary: continue
|
||||||
|
for attr in self.Attributes:
|
||||||
|
key = (toolchain, target, arch, toolcode, attr)
|
||||||
|
if key not in summary: continue
|
||||||
|
self[key] = summary[key]
|
||||||
|
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
s = ""
|
||||||
|
for entry in self:
|
||||||
|
s += entry[0] + "_" + entry[1] + "_" + entry[2] + "_" + entry[3] + "_" + entry[4]
|
||||||
|
s += " = " + self[entry] + "\n"
|
||||||
|
return s
|
||||||
|
|
||||||
|
class TargetConfig(Config):
|
||||||
|
pass
|
||||||
|
|
||||||
|
## for test
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import os
|
||||||
|
if "WORKSPACE" not in os.environ:
|
||||||
|
raise "No WORKSPACE given"
|
||||||
|
cfg = ToolConfig(os.path.join(os.environ["WORKSPACE"], "Tools", "Conf", "tools_def.txt"))
|
||||||
|
tgt = TargetConfig(os.path.join(os.environ["WORKSPACE"], "Tools", "Conf", "target.txt"))
|
||||||
|
|
||||||
|
for key in cfg:
|
||||||
|
print key,"=",cfg[key]
|
||||||
|
|
||||||
|
print
|
||||||
|
for name in tgt:
|
||||||
|
print name,"=",tgt[name]
|
||||||
|
|
|
@ -0,0 +1,574 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright (c) 2007, Intel Corporation
|
||||||
|
# All rights reserved. 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
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
"""Generate build file for given platform"""
|
||||||
|
|
||||||
|
import os, sys, copy
|
||||||
|
import xml.dom.minidom, pprint
|
||||||
|
import FrameworkElement
|
||||||
|
|
||||||
|
from SurfaceAreaElement import *
|
||||||
|
from XmlRoutines import *
|
||||||
|
from AntTasks import *
|
||||||
|
from sets import Set
|
||||||
|
|
||||||
|
class BuildFile:
|
||||||
|
def __init__(self, workspace, platform, toolchain, target):
|
||||||
|
if workspace == None or workspace == "":
|
||||||
|
raise Exception("No workspace, no build")
|
||||||
|
if platform == None or platform == "":
|
||||||
|
raise Exception("No platform, no build")
|
||||||
|
if toolchain == None or toolchain == "":
|
||||||
|
raise Exception("No toolchain, no build")
|
||||||
|
if target == None or target == "":
|
||||||
|
raise Exception("No target, no build")
|
||||||
|
|
||||||
|
self.Workspace = workspace
|
||||||
|
self.Platform = platform
|
||||||
|
self.Toolchain = toolchain
|
||||||
|
self.Target = target
|
||||||
|
self.Path = ""
|
||||||
|
|
||||||
|
def Generate(self):
|
||||||
|
"""Generate the build file"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
# generating build.xml for platform
|
||||||
|
class AntPlatformBuildFile(BuildFile):
|
||||||
|
def __init__(self, workspace, platform, toolchain, target):
|
||||||
|
BuildFile.__init__(self, workspace, platform, toolchain, target)
|
||||||
|
# Form the build file path, hard-coded at present. It should be specified by a configuration file
|
||||||
|
self.Path = os.path.join(self.Workspace.Path, self.Platform.OutputPath, target + "_" + toolchain, "build.xml")
|
||||||
|
print ""
|
||||||
|
# Generate a common build option property file in the format of Java's property file
|
||||||
|
self.DefaultBuildOptions()
|
||||||
|
|
||||||
|
# new a build file object
|
||||||
|
self.BuildXml = AntBuildFile(name="platform", basedir=".", default="all")
|
||||||
|
|
||||||
|
# generate the top level properties, tasks, etc.
|
||||||
|
self.Header()
|
||||||
|
|
||||||
|
# generate "prebuild" target
|
||||||
|
self.PreBuild()
|
||||||
|
|
||||||
|
# generate "libraries" target for building library modules
|
||||||
|
self.Libraries()
|
||||||
|
|
||||||
|
# generate "modules" target for building non-library modules
|
||||||
|
self.Modules()
|
||||||
|
|
||||||
|
# generate "fvs" target for building firmware volume. (not supported yet)
|
||||||
|
|
||||||
|
# generate "fds" target for building FlashDevice. (not supported yet)
|
||||||
|
|
||||||
|
# generate "postbuild" target
|
||||||
|
self.PostBuild()
|
||||||
|
|
||||||
|
def Generate(self):
|
||||||
|
print "Generating platform build file ...", self.Path
|
||||||
|
self.BuildXml.Create(self.Path)
|
||||||
|
|
||||||
|
def Header(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
# import external tasks
|
||||||
|
_topLevel.SubTask("taskdef", resource="GenBuild.tasks")
|
||||||
|
_topLevel.SubTask("taskdef", resource="frameworktasks.tasks")
|
||||||
|
_topLevel.SubTask("taskdef", resource="net/sf/antcontrib/antlib.xml")
|
||||||
|
|
||||||
|
# platform wide properties
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment("WORKSPACE wide attributes")
|
||||||
|
_topLevel.SubTask("property", environment="env")
|
||||||
|
_topLevel.SubTask("property", name="WORKSPACE_DIR", value="${env.WORKSPACE}")
|
||||||
|
_topLevel.SubTask("property", name="CONFIG_DIR", value="${WORKSPACE_DIR}/Tools/Conf")
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment("Common build attributes")
|
||||||
|
_topLevel.SubTask("property", name="THREAD_COUNT", value=self.Workspace.ThreadCount)
|
||||||
|
_topLevel.SubTask("property", name="SINGLE_MODULE_BUILD", value="no")
|
||||||
|
_topLevel.SubTask("property", name="MODULE_BUILD_TARGET", value="platform_module_build")
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("property", name="TOOLCHAIN", value=self.Toolchain)
|
||||||
|
_topLevel.SubTask("property", name="TARGET", value=self.Target)
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment("Platform attributes")
|
||||||
|
_topLevel.SubTask("property", name="PLATFORM", value=self.Platform.Name)
|
||||||
|
_topLevel.SubTask("property", name="PLATFORM_GUID", value=self.Platform.GuidValue)
|
||||||
|
_topLevel.SubTask("property", name="PLATFORM_VERSION", value=self.Platform.Version)
|
||||||
|
_topLevel.SubTask("property", name="PLATFORM_RELATIVE_DIR", value=self.Platform.Dir)
|
||||||
|
_topLevel.SubTask("property", name="PLATFORM_DIR", value="${WORKSPACE_DIR}/${PLATFORM_RELATIVE_DIR}")
|
||||||
|
_topLevel.SubTask("property", name="PLATFORM_OUTPUT_DIR", value=self.Platform.OutputPath)
|
||||||
|
|
||||||
|
# user configurable build path for platform
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment("Common path definition for platform build")
|
||||||
|
_topLevel.SubTask("property", file="${WORKSPACE_DIR}/Tools/Python/buildgen/platform_build_path.txt")
|
||||||
|
|
||||||
|
# common build tasks in the form of Ant macro
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment("Task Macros for Compiling, Assembling, Linking, etc.")
|
||||||
|
_topLevel.SubTask("import", file="${CONFIG_DIR}/BuildMacro.xml")
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("echo", message="${PLATFORM}-${PLATFORM_VERSION} (${PLATFORM_RELATIVE_DIR})", level="info")
|
||||||
|
|
||||||
|
# define the targets execution sequence
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment("Default target")
|
||||||
|
_topLevel.SubTask("target", name="all", depends="prebuild, libraries, modules, postbuild")
|
||||||
|
|
||||||
|
def PreBuild(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: prebuild ")
|
||||||
|
|
||||||
|
# prebuild is defined by user in the fpd file through <UserExtionsion> element,
|
||||||
|
# which has attribute "identifier=0" or "identifier=prebuild"
|
||||||
|
prebuildTasks = []
|
||||||
|
if self.Platform.UserExtensions.has_key("0"):
|
||||||
|
prebuildTasks = self.Platform.UserExtensions["0"]
|
||||||
|
elif self.Platform.UserExtensions.has_key("postbuild"):
|
||||||
|
prebuildTasks = self.Platform.UserExtensions["prebuild"]
|
||||||
|
|
||||||
|
_topLevel.SubTask("target", prebuildTasks, name="prebuild")
|
||||||
|
|
||||||
|
def Libraries(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: libraries ")
|
||||||
|
|
||||||
|
librariesTarget = _topLevel.SubTask("target", name="libraries")
|
||||||
|
parallelBuild = librariesTarget.SubTask("parallel", threadCount="${THREAD_COUNT}")
|
||||||
|
|
||||||
|
libraryNumber = 0
|
||||||
|
for arch in self.Platform.Libraries:
|
||||||
|
libraryNumber += len(self.Platform.Libraries[arch])
|
||||||
|
libraryIndex = 0
|
||||||
|
for arch in self.Platform.Libraries:
|
||||||
|
for lib in self.Platform.Libraries[arch]:
|
||||||
|
libraryIndex += 1
|
||||||
|
print "Generating library build files ... %d%%\r" % int((float(libraryIndex) / float(libraryNumber)) * 100),
|
||||||
|
buildFile = AntModuleBuildFile(self.Workspace, self.Platform, lib, self.Toolchain, self.Target, arch)
|
||||||
|
buildFile.Generate()
|
||||||
|
buildDir = os.path.join("${TARGET_DIR}", arch, lib.Module.Package.SubPath(lib.Module.Dir),
|
||||||
|
lib.Module.FileBaseName)
|
||||||
|
parallelBuild.SubTask("ant", dir=buildDir,
|
||||||
|
#antfile="build.xml",
|
||||||
|
inheritAll="true",
|
||||||
|
target="${MODULE_BUILD_TARGET}")
|
||||||
|
print ""
|
||||||
|
|
||||||
|
def Modules(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: modules ")
|
||||||
|
|
||||||
|
modulesTarget = _topLevel.SubTask("target", name="modules")
|
||||||
|
parallelBuild = modulesTarget.SubTask("parallel", threadCount="${THREAD_COUNT}")
|
||||||
|
|
||||||
|
moduleNumber = 0
|
||||||
|
for arch in self.Platform.Modules:
|
||||||
|
moduleNumber += len(self.Platform.Modules[arch])
|
||||||
|
|
||||||
|
moduleIndex = 0
|
||||||
|
for arch in self.Platform.Modules:
|
||||||
|
for module in self.Platform.Modules[arch]:
|
||||||
|
moduleIndex += 1
|
||||||
|
print "Generating module build files ... %d%%\r" % int((float(moduleIndex) / float(moduleNumber)) * 100),
|
||||||
|
|
||||||
|
buildDir = os.path.join("${TARGET_DIR}", arch, module.Module.Package.SubPath(module.Module.Dir),
|
||||||
|
module.Module.FileBaseName)
|
||||||
|
parallelBuild.SubTask("ant", dir=buildDir,
|
||||||
|
#antfile="build.xml",
|
||||||
|
inheritAll="true",
|
||||||
|
target="${MODULE_BUILD_TARGET}")
|
||||||
|
buildFile = AntModuleBuildFile(self.Workspace, self.Platform, module, self.Toolchain, self.Target, arch)
|
||||||
|
buildFile.Generate()
|
||||||
|
print ""
|
||||||
|
|
||||||
|
def Fvs(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def Fds(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def PostBuild(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: postbuild ")
|
||||||
|
|
||||||
|
# postbuild is defined by user in the fpd file through <UserExtionsion> element,
|
||||||
|
# which has attribute "identifier=1" or "identifier=postbuild"
|
||||||
|
postbuildTasks = []
|
||||||
|
if self.Platform.UserExtensions.has_key("1"):
|
||||||
|
postbuildTasks = self.Platform.UserExtensions["1"]
|
||||||
|
elif self.Platform.UserExtensions.has_key("postbuild"):
|
||||||
|
postbuildTasks = self.Platform.UserExtensions["postbuild"]
|
||||||
|
|
||||||
|
_topLevel.SubTask("target", postbuildTasks, name="postbuild")
|
||||||
|
|
||||||
|
def Clean(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def CleanAll(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def UserExtensions(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def DefaultBuildOptions(self):
|
||||||
|
"""Generate ${ARCH}_build.opt which contains the default build&tool definitions"""
|
||||||
|
tools = self.Workspace.ToolConfig.ToolCodes
|
||||||
|
for arch in self.Workspace.ActiveArchs:
|
||||||
|
optFileDir = os.path.join(self.Workspace.Path, self.Platform.OutputPath,
|
||||||
|
self.Target + "_" + self.Toolchain)
|
||||||
|
optFileName = arch + "_build.opt"
|
||||||
|
if not os.path.exists(optFileDir): os.makedirs(optFileDir)
|
||||||
|
f = open(os.path.join(optFileDir, optFileName), "w")
|
||||||
|
for tool in tools:
|
||||||
|
key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
|
||||||
|
flag = self.Workspace.ToolConfig[key]
|
||||||
|
f.write("DEFAULT_%s_FLAGS=%s\n" % (tool, flag))
|
||||||
|
|
||||||
|
f.write("\n")
|
||||||
|
for tool in tools:
|
||||||
|
key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
|
||||||
|
if key in self.Platform.BuildOptions:
|
||||||
|
flag = self.Platform.BuildOptions[key]
|
||||||
|
else:
|
||||||
|
key = (self.Toolchain, self.Target, arch, tool, "FAMILY")
|
||||||
|
family = self.Workspace.ToolConfig[key]
|
||||||
|
key = (family, self.Target, arch, tool, "FLAGS")
|
||||||
|
if key in self.Platform.BuildOptions:
|
||||||
|
flag = self.Platform.BuildOptions[key]
|
||||||
|
else:
|
||||||
|
flag = ""
|
||||||
|
f.write("PLATFORM_%s_FLAGS=%s\n" % (tool, flag))
|
||||||
|
|
||||||
|
f.write("\n")
|
||||||
|
for tool in tools:
|
||||||
|
for attr in self.Workspace.ToolConfig.Attributes:
|
||||||
|
if attr == "FLAGS": continue
|
||||||
|
key = (self.Toolchain, self.Target, arch, tool, attr)
|
||||||
|
value = self.Workspace.ToolConfig[key]
|
||||||
|
if attr == "NAME":
|
||||||
|
f.write("%s=%s\n" % (tool, value))
|
||||||
|
else:
|
||||||
|
f.write("%s_%s=%s\n" % (tool, attr, value))
|
||||||
|
f.write("%s_FLAGS=${DEFAULT_%s_FLAGS} ${DEFAULT_MODULE_%s_FLAGS} ${PLATFORM_%s_FLAGS} ${MODULE_%s_FLAGS}\n" %
|
||||||
|
(tool, tool, tool, tool, tool))
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
class AntModuleBuildFile(BuildFile):
|
||||||
|
def __init__(self, workspace, platform, module, toolchain, target, arch):
|
||||||
|
BuildFile.__init__(self, workspace, platform, toolchain, target)
|
||||||
|
self.Module = module
|
||||||
|
self.Arch = arch
|
||||||
|
self.Path = os.path.join(self.Workspace.Path, self.Platform.OutputPath,
|
||||||
|
target + "_" + toolchain, arch, self.Module.Module.Package.Dir,
|
||||||
|
self.Module.Module.Dir, self.Module.Module.FileBaseName, "build.xml")
|
||||||
|
self.BuildXml = AntBuildFile(self.Module.Module.Name)
|
||||||
|
|
||||||
|
self.SourceFiles = self.GetSourceFiles()
|
||||||
|
|
||||||
|
self.Header()
|
||||||
|
self.PreBuild()
|
||||||
|
self.Libraries()
|
||||||
|
self.Sourcefiles()
|
||||||
|
self.Sections()
|
||||||
|
self.Ffs()
|
||||||
|
self.PostBuild()
|
||||||
|
|
||||||
|
def Generate(self):
|
||||||
|
# print self.Path,"\r",
|
||||||
|
self.BuildXml.Create(self.Path)
|
||||||
|
|
||||||
|
def Header(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.SubTask("taskdef", resource="frameworktasks.tasks")
|
||||||
|
_topLevel.SubTask("taskdef", resource="cpptasks.tasks")
|
||||||
|
_topLevel.SubTask("taskdef", resource="cpptasks.types")
|
||||||
|
_topLevel.SubTask("taskdef", resource="net/sf/antcontrib/antlib.xml")
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TODO ")
|
||||||
|
_topLevel.SubTask("property", environment="env")
|
||||||
|
_topLevel.SubTask("property", name="WORKSPACE_DIR", value="${env.WORKSPACE}")
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment("Common build attributes")
|
||||||
|
_topLevel.SubTask("property", name="SINGLE_MODULE_BUILD", value="yes")
|
||||||
|
_topLevel.SubTask("property", name="MODULE_BUILD_TARGET", value="single_module_build")
|
||||||
|
_topLevel.SubTask("property", name="PLATFORM_PREBUILD", value="yes")
|
||||||
|
_topLevel.SubTask("property", name="PLATFORM_POSTBUILD", value="no")
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TODO ")
|
||||||
|
ifTask = _topLevel.SubTask("if")
|
||||||
|
ifTask.SubTask("istrue", value="${SINGLE_MODULE_BUILD}")
|
||||||
|
thenTask = ifTask.SubTask("then")
|
||||||
|
platformBuildFile = os.path.join("${WORKSPACE_DIR}", self.Platform.OutputPath,
|
||||||
|
self.Target + "_" + self.Toolchain, "build.xml")
|
||||||
|
thenTask.SubTask("import", file=platformBuildFile)
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("property", name="ARCH", value=self.Arch)
|
||||||
|
|
||||||
|
module = self.Module.Module
|
||||||
|
package = module.Package
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("property", name="PACKAGE", value=package.Name)
|
||||||
|
_topLevel.SubTask("property", name="PACKAGE_GUID", value=package.GuidValue)
|
||||||
|
_topLevel.SubTask("property", name="PACKAGE_VERSION", value=package.Version)
|
||||||
|
_topLevel.SubTask("property", name="PACKAGE_RELATIVE_DIR", value=package.Dir)
|
||||||
|
_topLevel.SubTask("property", name="PACKAGE_DIR", value=os.path.join("${WORKSPACE_DIR}","${PACKAGE_RELATIVE_DIR}"))
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("property", name="MODULE", value=module.Name)
|
||||||
|
_topLevel.SubTask("property", name="MODULE_GUID", value=module.GuidValue)
|
||||||
|
_topLevel.SubTask("property", name="MODULE_VERSION", value=module.Version)
|
||||||
|
_topLevel.SubTask("property", name="MODULE_TYPE", value=module.Type)
|
||||||
|
_topLevel.SubTask("property", name="MODULE_FILE_BASE_NAME", value=module.FileBaseName)
|
||||||
|
_topLevel.SubTask("property", name="MODULE_RELATIVE_DIR", value=module.Dir)
|
||||||
|
_topLevel.SubTask("property", name="MODULE_DIR", value=os.path.join("${PACKAGE_DIR}", "${MODULE_RELATIVE_DIR}"))
|
||||||
|
_topLevel.SubTask("property", name="BASE_NAME", value=module.BaseName)
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("property", file="${WORKSPACE_DIR}/Tools/Python/buildgen/module_build_path.txt")
|
||||||
|
|
||||||
|
self._BuildOption()
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("property", name="ENTRYPOINT", value="_ModuleEntryPoint")
|
||||||
|
|
||||||
|
_topLevel.SubTask("property", name="SOURCE_FILES", value="\n ".join(self._GetSourceFileList()))
|
||||||
|
_topLevel.SubTask("property", name="LIBS", value="\n ".join(self._GetLibList()))
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("property", file="${PLATFORM_BUILD_DIR}/%s_build.opt" % self.Arch)
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.SubTask("echo", message="${MODULE}-${MODULE_VERSION} [${ARCH}] from package ${PACKAGE}-${PACKAGE_VERSION} (${MODULE_RELATIVE_DIR})", level="info")
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment("Default target")
|
||||||
|
_topLevel.SubTask("target", name="all", depends="single_module_build")
|
||||||
|
_topLevel.SubTask("target", name="platform_module_build", depends="prebuild, sourcefiles, sections, output, postbuild")
|
||||||
|
_topLevel.SubTask("target", name="single_module_build", depends="prebuild, libraries, sourcefiles, sections, output, postbuild")
|
||||||
|
|
||||||
|
def _BuildOption(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
baseModule = self.Module.Module
|
||||||
|
tools = self.Workspace.ToolConfig.ToolCodes
|
||||||
|
|
||||||
|
for tool in tools:
|
||||||
|
key = (self.Toolchain, self.Target, self.Arch, tool, "FLAGS")
|
||||||
|
flag = ""
|
||||||
|
if key in baseModule.BuildOptions:
|
||||||
|
flag = baseModule.BuildOptions[key]
|
||||||
|
_topLevel.SubTask("property", name="DEFAULT_MODULE_%s_FLAGS" % tool, value=flag)
|
||||||
|
|
||||||
|
_topLevel.Blankline()
|
||||||
|
for tool in tools:
|
||||||
|
key = (self.Toolchain, self.Target, self.Arch, tool, "FLAGS")
|
||||||
|
flag = ""
|
||||||
|
if key in self.Module.BuildOptions:
|
||||||
|
flag = self.Module.BuildOptions[key]
|
||||||
|
_topLevel.SubTask("property", name="MODULE_%s_FLAGS" % tool, value=flag)
|
||||||
|
|
||||||
|
def PreBuild(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: prebuild ")
|
||||||
|
|
||||||
|
prebuildTasks = []
|
||||||
|
module = self.Module.Module
|
||||||
|
if module.UserExtensions.has_key("0"):
|
||||||
|
prebuildTasks = module.UserExtensions["0"]
|
||||||
|
elif module.UserExtensions.has_key("postbuild"):
|
||||||
|
prebuildTasks = module.UserExtensions["prebuild"]
|
||||||
|
|
||||||
|
_topLevel.SubTask("target", prebuildTasks, name="prebuild")
|
||||||
|
|
||||||
|
|
||||||
|
def Libraries(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: libraries ")
|
||||||
|
|
||||||
|
librariesTarget = _topLevel.SubTask("target", name="libraries")
|
||||||
|
parallelBuild = librariesTarget.SubTask("parallel", threadCount="${THREAD_COUNT}")
|
||||||
|
for lib in self.Module.Libraries:
|
||||||
|
module = lib.Module
|
||||||
|
buildDir = os.path.join("${BIN_DIR}", module.Package.SubPath(module.Dir), module.FileBaseName)
|
||||||
|
libTask = parallelBuild.SubTask("ant", dir=buildDir,
|
||||||
|
inheritAll="false",
|
||||||
|
target="${MODULE_BUILD_TARGET}")
|
||||||
|
libTask.SubTask("property", name="PLATFORM_PREBUILD", value="false")
|
||||||
|
libTask.SubTask("property", name="PLATFORM_POSTBUILD", value="false")
|
||||||
|
|
||||||
|
def Sourcefiles(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: sourcefiles ")
|
||||||
|
_sourcefilesTarget = _topLevel.SubTask("target", name="sourcefiles")
|
||||||
|
|
||||||
|
_incTask = AntTask(self.BuildXml.Document, "EXTRA.INC")
|
||||||
|
_incTask.SubTask("includepath", path="${WORKSPACE_DIR}")
|
||||||
|
_incTask.SubTask("includepath", path="${MODULE_DIR}")
|
||||||
|
_incTask.SubTask("includepath", path=os.path.join("${MODULE_DIR}", self.Arch.capitalize()))
|
||||||
|
_incTask.SubTask("includepath", path="${DEST_DIR_DEBUG}")
|
||||||
|
if self.Arch in self.Module.Module.IncludePaths:
|
||||||
|
for inc in self.Module.Module.IncludePaths[self.Arch]:
|
||||||
|
_incTask.SubTask("includepath", path=os.path.join("${WORKSPACE_DIR}", inc))
|
||||||
|
|
||||||
|
# init
|
||||||
|
if not self.Module.Module.IsBinary:
|
||||||
|
_buildTask = _sourcefilesTarget.SubTask("Build_Init")
|
||||||
|
_buildTask.AddSubTask(_incTask)
|
||||||
|
|
||||||
|
# AutoGen firt
|
||||||
|
_buildTask = _sourcefilesTarget.SubTask("Build_AUTOGEN", FILEEXT="c", FILENAME="AutoGen", FILEPATH=".")
|
||||||
|
_buildTask.AddSubTask(_incTask)
|
||||||
|
|
||||||
|
# uni file follows
|
||||||
|
type = "UNI"
|
||||||
|
if type in self.SourceFiles:
|
||||||
|
for srcpath in self.SourceFiles[type]:
|
||||||
|
taskName = "Build_" + type
|
||||||
|
fileDir = os.path.dirname(srcpath)
|
||||||
|
if fileDir == "": fileDir = "."
|
||||||
|
fileBaseName,fileExt = os.path.basename(srcpath).rsplit(".", 1)
|
||||||
|
_buildTask = _sourcefilesTarget.SubTask(taskName, FILENAME=fileBaseName, FILEEXT=fileExt, FILEPATH=fileDir)
|
||||||
|
_buildTask.AddSubTask(_incTask)
|
||||||
|
|
||||||
|
# others: c, vfr, ...
|
||||||
|
for type in self.SourceFiles:
|
||||||
|
if type == "Unicode": continue
|
||||||
|
for srcpath in self.SourceFiles[type]:
|
||||||
|
taskName = "Build_" + type
|
||||||
|
fileDir = os.path.dirname(srcpath)
|
||||||
|
if fileDir == "": fileDir = "."
|
||||||
|
fileBaseName,fileExt = os.path.basename(srcpath).rsplit(".", 1)
|
||||||
|
_buildTask = _sourcefilesTarget.SubTask(taskName, FILENAME=fileBaseName, FILEEXT=fileExt, FILEPATH=fileDir)
|
||||||
|
_buildTask.AddSubTask(_incTask)
|
||||||
|
|
||||||
|
def Sections(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: sections ")
|
||||||
|
_sectionsTarget = _topLevel.SubTask("target", name="sections")
|
||||||
|
|
||||||
|
def Ffs(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: output ")
|
||||||
|
_sectionsTarget = _topLevel.SubTask("target", name="output")
|
||||||
|
|
||||||
|
def PostBuild(self):
|
||||||
|
_topLevel = self.BuildXml
|
||||||
|
_topLevel.Blankline()
|
||||||
|
_topLevel.Comment(" TARGET: postbuild ")
|
||||||
|
|
||||||
|
postbuildTasks = []
|
||||||
|
module = self.Module.Module
|
||||||
|
if module.UserExtensions.has_key("1"):
|
||||||
|
postbuildTasks = module.UserExtensions["1"]
|
||||||
|
elif module.UserExtensions.has_key("postbuild"):
|
||||||
|
postbuildTasks = module.UserExtensions["postbuild"]
|
||||||
|
|
||||||
|
_topLevel.SubTask("target", postbuildTasks, name="postbuild")
|
||||||
|
|
||||||
|
def Clean(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def CleanAll(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def UserExtensions(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def GetSourceFiles(self):
|
||||||
|
## check arch, toolchain, family, toolcode, ext
|
||||||
|
## if the arch of source file supports active arch
|
||||||
|
## if the toolchain of source file supports active toolchain
|
||||||
|
## if the toolchain family of source file supports active toolchain family
|
||||||
|
## if the ext of the source file is supported by the toolcode
|
||||||
|
module = self.Module.Module
|
||||||
|
files = {} # file type -> src
|
||||||
|
for type in module.SourceFiles[self.Arch]:
|
||||||
|
if not module.IsBuildable(type):
|
||||||
|
# print type,"is not buildable"
|
||||||
|
continue
|
||||||
|
|
||||||
|
if type not in files:
|
||||||
|
files[type] = []
|
||||||
|
for src in module.SourceFiles[self.Arch][type]:
|
||||||
|
if self.Toolchain not in src.Toolchains:
|
||||||
|
# print self.Toolchain,"not in ",src.Toolchains
|
||||||
|
continue
|
||||||
|
if not self.IsCompatible(src.Families, self.Workspace.ActiveFamilies):
|
||||||
|
# print src.Families,"not compatible with",self.Workspace.ActiveFamilies
|
||||||
|
continue
|
||||||
|
toolcode = src.GetToolCode(src.Type)
|
||||||
|
if toolcode != "":
|
||||||
|
ext = self.Workspace.GetToolDef(self.Toolchain, self.Target, self.Arch, toolcode, "EXT")
|
||||||
|
if ext != "" and ext != src.Ext:
|
||||||
|
# print ext,"in tools_def.txt is not the same as",src.Ext
|
||||||
|
continue
|
||||||
|
## fileFullPath = os.path.join("${MODULE_DIR}", )
|
||||||
|
## print fileFullPath
|
||||||
|
files[type].append(src.Path)
|
||||||
|
|
||||||
|
return files
|
||||||
|
|
||||||
|
def Intersection(self, list1, list2):
|
||||||
|
return list(Set(list1) & Set(list2))
|
||||||
|
|
||||||
|
def IsCompatible(self, list1, list2):
|
||||||
|
return len(self.Intersection(list1, list2)) > 0
|
||||||
|
|
||||||
|
def _GetLibList(self):
|
||||||
|
libList = []
|
||||||
|
for lib in self.Module.Libraries:
|
||||||
|
module = lib.Module
|
||||||
|
libList.append(os.path.join("${BIN_DIR}", module.Name + ".lib"))
|
||||||
|
return libList
|
||||||
|
|
||||||
|
def _GetSourceFileList(self):
|
||||||
|
srcList = []
|
||||||
|
for type in self.SourceFiles:
|
||||||
|
srcList.extend(self.SourceFiles[type])
|
||||||
|
return srcList
|
||||||
|
|
||||||
|
class NmakeFile(BuildFile):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class GmakeFile(BuildFile):
|
||||||
|
pass
|
||||||
|
|
||||||
|
# for test
|
||||||
|
if __name__ == "__main__":
|
||||||
|
workspacePath = os.getenv("WORKSPACE", os.getcwd())
|
||||||
|
startTime = time.clock()
|
||||||
|
ws = Workspace(workspacePath, [], [])
|
||||||
|
|
||||||
|
# generate build.xml
|
||||||
|
ap = ws.ActivePlatform
|
||||||
|
for target in ws.ActiveTargets:
|
||||||
|
ant = AntPlatformBuildFile(ws, ap, ws.ActiveToolchain, target)
|
||||||
|
ant.Generate()
|
||||||
|
|
||||||
|
print "\n[Finished in %fs]" % (time.clock() - startTime)
|
|
@ -0,0 +1,523 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright (c) 2007, Intel Corporation
|
||||||
|
# All rights reserved. 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
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
"""Framework Element Classes
|
||||||
|
|
||||||
|
TODO
|
||||||
|
"""
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Element class: base class for representing framework elements
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Element:
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""(Name, GuidValue, Version, Path, Dir, Archs, Usage, Features, Signature)"""
|
||||||
|
## The path and directory where the information of the element comes from
|
||||||
|
self.Path = "."
|
||||||
|
self.Dir = "."
|
||||||
|
|
||||||
|
## Element name, guid and version
|
||||||
|
self.Name = ""
|
||||||
|
self.GuidValue = ""
|
||||||
|
self.Version = ""
|
||||||
|
|
||||||
|
## The element supported architecture
|
||||||
|
self.Archs = []
|
||||||
|
|
||||||
|
## Indiciate how the element is used
|
||||||
|
self.Usage = "ALWAYS_CONSUMED"
|
||||||
|
|
||||||
|
## Indicate what kind of features this element is bound
|
||||||
|
self.Features = []
|
||||||
|
|
||||||
|
## Element signature, used to check the its integerity
|
||||||
|
self.Signature = 0
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.Name + "-" + self.Version + " " + " [" + self.GuidValue + "]"
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if not isinstance(other, Element):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.GuidValue != other.GuidValue:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.Version != other.Version:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.GuidValue + self.Version)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## ToolOption: build tool option
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class ToolOption(Element):
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Prefix, Value, Tool, Toolchains, Families, Targets"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Prefix = "/"
|
||||||
|
self.Value = ""
|
||||||
|
self.Tool = ""
|
||||||
|
self.Toolchains = ""
|
||||||
|
self.Families = "MSFT"
|
||||||
|
self.Targets = "DEBUG"
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## BuildTool: build tool
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class BuildTool(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Options, Toolchains, Families, Targets"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Options = []
|
||||||
|
self.Toolchains = []
|
||||||
|
self.Families = []
|
||||||
|
self.Targets = []
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## SourceFile: files in a module for build
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class SourceFile(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""BaseName, Ext, Type, Toolchains, Families, Targets"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.BaseName = ""
|
||||||
|
self.Ext = ""
|
||||||
|
self.Type = ""
|
||||||
|
self.Toolchains = []
|
||||||
|
self.Families = []
|
||||||
|
self.Targets = []
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## IncludeFile: header file
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class IncludeFile(SourceFile):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Type, Package, ModuleType"""
|
||||||
|
SourceFile.__init__(self)
|
||||||
|
|
||||||
|
self.Type = "HeaderFile"
|
||||||
|
self.Package = ""
|
||||||
|
self.ModuleType = ""
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## IncludePath:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class IncludePath(IncludeFile):
|
||||||
|
pass
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## LibraryInterface: library class interface
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class LibraryInterface(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Package, FavoriteInstance, Instances, ModuleTypes, Consumers"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Package = ""
|
||||||
|
self.FavoriteInstance = ""
|
||||||
|
self.Instances = []
|
||||||
|
self.ModuleTypes = []
|
||||||
|
self.Consumers = []
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if not isinstance(other, LibraryInterface):
|
||||||
|
return False
|
||||||
|
return self.Name == other.Name
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.Name)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## LibraryClass: library class
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class LibraryClass(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""
|
||||||
|
()
|
||||||
|
"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Interface = ""
|
||||||
|
self.FavoriteInstance = ""
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if not isinstance(other, LibraryClass):
|
||||||
|
return False
|
||||||
|
return self.Name == other.Name
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.Name)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Guid:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Guid(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""CName, Types, ModuleTypes"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.CName = ""
|
||||||
|
self.Types = []
|
||||||
|
self.ModuleTypes= []
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Protocol:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Protocol(Guid):
|
||||||
|
pass
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## ProtocolNotify:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class ProtocolNotify(Protocol):
|
||||||
|
pass
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Ppi:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Ppi(Guid):
|
||||||
|
pass
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## PpiNotify:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class PpiNotify(Ppi):
|
||||||
|
pass
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Extern:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Extern(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Specifications, ModuleEntryPoints, ModuleUnloadImages, Constructors, Destructors, DriverBindings, ComponentNames, DriverConfigs, DriverDiags, SetVirtualAddressMapCallBacks, ExitBootServicesCallBacks"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Specifications = []
|
||||||
|
self.ModuleEntryPoints = []
|
||||||
|
self.ModuleUnloadImages = []
|
||||||
|
self.Constructors = []
|
||||||
|
self.Destructors = []
|
||||||
|
self.DriverBindings = []
|
||||||
|
self.ComponentNames = []
|
||||||
|
self.DriverConfigs = []
|
||||||
|
self.DriverDiags = []
|
||||||
|
self.SetVirtualAddressMapCallBacks = []
|
||||||
|
self.ExitBootServicesCallBacks = []
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Sku:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Sku(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Id, Value"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Id = 0
|
||||||
|
self.Value = ""
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Pcd:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Pcd(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Types, CName, Value, Token, TokenSpace, DatumType, Sku, ModuleTypes"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Types = []
|
||||||
|
self.CName = ""
|
||||||
|
self.Value = ""
|
||||||
|
self.Token = ""
|
||||||
|
self.TokenSpace = ""
|
||||||
|
self.DatumType = ""
|
||||||
|
self.Default = ""
|
||||||
|
self.Sku = ""
|
||||||
|
self.ModuleTypes= []
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Module: framework module
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Module(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Workspace, Package, Type, BaseName, FileBaseName, IsLibrary, PcdIsDriver,
|
||||||
|
NeedsFlashMap_h, SourceFiles, IncludePaths, IncludeFiles, NonProcessedFiles,
|
||||||
|
LibraryClasses, Guids, Protocols, Ppis, Externs, Pcds,
|
||||||
|
UserExtensions, BuildOptions, Environment
|
||||||
|
"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Workspace = ""
|
||||||
|
self.Package = ""
|
||||||
|
self.Type = ""
|
||||||
|
self.BaseName = ""
|
||||||
|
self.FileBaseName = ""
|
||||||
|
self.IsLibrary = False
|
||||||
|
self.IsBinary = False
|
||||||
|
self.PcdIsDriver = False
|
||||||
|
self.NeedsFlashMap_h = False
|
||||||
|
self.SourceFiles = {} # arch -> {file type -> [source file list]}
|
||||||
|
self.IncludePaths = {} # arch -> [path list]
|
||||||
|
self.IncludeFiles = {}
|
||||||
|
|
||||||
|
self.NonProcessedFiles = []
|
||||||
|
self.LibraryClasses = {} # arch -> [library class list]
|
||||||
|
|
||||||
|
self.Guids = {} # arch -> [guid object list]
|
||||||
|
self.Protocols = {} # arch -> []
|
||||||
|
self.Ppis = {} # arch -> []
|
||||||
|
|
||||||
|
self.Externs = {} # arch -> []
|
||||||
|
self.Pcds = {} # arch -> []
|
||||||
|
|
||||||
|
self.UserExtensions = {} # identifier -> ...
|
||||||
|
self.BuildOptions = {} # (toolchain, target, arch, toolcode, "FLAGS") -> flag
|
||||||
|
self.Environment = {}
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if not isinstance(other, Module):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.GuidValue != other.GuidValue:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.Version != other.Version:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.Package != other.Package:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.GuidValue + self.Version + hash(self.Package))
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## PlatformModule: module for build
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class PlatformModule(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Workspace, Platform, Module, Libraries, Pcds, FfsLayouts, FvBindings
|
||||||
|
BuildOptions, BuildType, BuildFile, BuildPath, Sections, FfsFile, Environment
|
||||||
|
"""
|
||||||
|
Element.__init__(self)
|
||||||
|
self.Workspace = ""
|
||||||
|
self.Platform = ""
|
||||||
|
self.Module = ""
|
||||||
|
self.Libraries = []
|
||||||
|
self.Pcds = []
|
||||||
|
self.FfsLayouts = []
|
||||||
|
self.FvBindings = []
|
||||||
|
self.BuildOptions = {}
|
||||||
|
|
||||||
|
self.BuildType = "efi" ## efi or lib
|
||||||
|
self.BuildFile = "build.xml"
|
||||||
|
self.BuildPath = "${MODULE_BUILD_DIR}"
|
||||||
|
self.Sections = []
|
||||||
|
self.FfsFile = ""
|
||||||
|
|
||||||
|
self.Environment = {} # name/value pairs
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if not isinstance(other, PlatformModule):
|
||||||
|
if not isinstance(other, Module):
|
||||||
|
return False
|
||||||
|
elif self.Module != other:
|
||||||
|
return False
|
||||||
|
elif self.Module != other.Module:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.Module)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Package: framework package
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Package(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Workspace, ReadOnly, Repackage, Modules, PackageIncludes, StandardIncludes,
|
||||||
|
LibraryInterfaces, Guids, Protocols, Ppis, Pcds, Environment
|
||||||
|
"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Workspace = ""
|
||||||
|
self.ReadOnly = True
|
||||||
|
self.Repackage = True
|
||||||
|
self.Modules = []
|
||||||
|
self.PackageIncludes = {} # module type -> [include file list]
|
||||||
|
self.StandardIncludes = []
|
||||||
|
self.LibraryInterfaces = {} # class name -> include file
|
||||||
|
self.Guids = {} # cname -> guid object
|
||||||
|
self.Protocols = {} # cname -> protocol object
|
||||||
|
self.Ppis = {} # cname -> ppi object
|
||||||
|
self.Pcds = {} # token -> pcd object
|
||||||
|
|
||||||
|
self.Environment = {}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## PackageDependency:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class PackageDependency(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Package"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Package = ""
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Platform:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Platform(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Targets, OutputPath, Images, Modules, DynamicPcds, Fvs, Libraries
|
||||||
|
BuildFile, BuildPath, BuildOptions, UserExtensions
|
||||||
|
"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Targets = []
|
||||||
|
self.OutputPath = ""
|
||||||
|
self.Images = []
|
||||||
|
self.Modules = {} # arch -> [module list]
|
||||||
|
self.DynamicPcds = []
|
||||||
|
self.FfsLayouts = {}
|
||||||
|
self.Fvs = {}
|
||||||
|
|
||||||
|
self.Libraries = {} # arch -> [library instance]
|
||||||
|
self.BuildFile = "build.xml"
|
||||||
|
self.BuildPath = "${PLATFORM_BUILD_DIR}"
|
||||||
|
self.BuildOptions = {}
|
||||||
|
self.UserExtensions = {}
|
||||||
|
|
||||||
|
self.Environment = {} # name/value pairs
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## Workspace:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
class Workspace(Element):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Packages, Platforms, Fars, Modules, PlatformIndex, PackageIndex"""
|
||||||
|
Element.__init__(self)
|
||||||
|
|
||||||
|
self.Packages = []
|
||||||
|
self.Platforms = []
|
||||||
|
self.Fars = []
|
||||||
|
self.Modules = []
|
||||||
|
|
||||||
|
## "GUID" : {guid : {version : platform}}
|
||||||
|
## "PATH" : {path : platform}
|
||||||
|
## "NAME" : {name : [platform]}
|
||||||
|
self.PlatformXref = {
|
||||||
|
"GUID" : {},
|
||||||
|
"PATH" : {},
|
||||||
|
"NAME" : {},
|
||||||
|
}
|
||||||
|
## "GUID" : {guid : {version : package}}
|
||||||
|
## "PATH" : {path : package}
|
||||||
|
## "NAME" : {name : package}
|
||||||
|
self.PackageXref = {
|
||||||
|
"GUID" : {},
|
||||||
|
"PATH" : {},
|
||||||
|
"NAME" : {},
|
||||||
|
}
|
||||||
|
## "GUID" : {guid : {version : [module]}}
|
||||||
|
## "PATH" : {path : module}
|
||||||
|
## "NAME" : {name : module}
|
||||||
|
self.ModuleXref = {
|
||||||
|
"GUID" : {},
|
||||||
|
"PATH" : {},
|
||||||
|
"NAME" : {},
|
||||||
|
}
|
||||||
|
## "NAME" : {name : library interface}
|
||||||
|
## "PATH" : {path : library interface}
|
||||||
|
self.LibraryInterfaceXref = {
|
||||||
|
"PATH" : {},
|
||||||
|
"NAME" : {},
|
||||||
|
}
|
||||||
|
## TODO
|
||||||
|
self.FarIndex = {}
|
||||||
|
|
||||||
|
# from target.txt
|
||||||
|
self.TargetConfig = {}
|
||||||
|
# from tools_def.txt
|
||||||
|
self.ToolConfig = {}
|
||||||
|
|
||||||
|
self.ActivePlatform = ""
|
||||||
|
self.ActiveToolchain = ""
|
||||||
|
self.ActiveFamilies = []
|
||||||
|
self.ActiveModules = []
|
||||||
|
self.ActiveTargets = []
|
||||||
|
self.ActiveArchs = []
|
||||||
|
|
||||||
|
self.IndividualModuleBuild = False
|
||||||
|
self.MultiThreadBuild = False
|
||||||
|
self.ThreadCount = "2"
|
||||||
|
|
||||||
|
self.Environment = {}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## For test:
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
if __name__ == "__main__":
|
||||||
|
pass
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,104 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright (c) 2007, Intel Corporation
|
||||||
|
# All rights reserved. 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
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
"""This is an XML API that uses a syntax similar to XPath, but it is written in
|
||||||
|
standard python so that no extra python packages are required to use it."""
|
||||||
|
|
||||||
|
import xml.dom.minidom
|
||||||
|
|
||||||
|
def XmlList(Dom, String):
|
||||||
|
"""Get a list of XML Elements using XPath style syntax."""
|
||||||
|
if String == "" or Dom == None or not isinstance(Dom, xml.dom.Node):
|
||||||
|
return []
|
||||||
|
|
||||||
|
if String[0] == "/":
|
||||||
|
String = String[1:]
|
||||||
|
|
||||||
|
if Dom.nodeType==Dom.DOCUMENT_NODE:
|
||||||
|
Dom = Dom.documentElement
|
||||||
|
|
||||||
|
tagList = String.split('/')
|
||||||
|
nodes = [Dom]
|
||||||
|
childNodes = []
|
||||||
|
index = 0
|
||||||
|
end = len(tagList) - 1
|
||||||
|
while index <= end:
|
||||||
|
for node in nodes:
|
||||||
|
if node.nodeType == node.ELEMENT_NODE and node.tagName == tagList[index]:
|
||||||
|
if index < end:
|
||||||
|
childNodes.extend(node.childNodes)
|
||||||
|
else:
|
||||||
|
childNodes.append(node)
|
||||||
|
|
||||||
|
nodes = childNodes
|
||||||
|
childNodes = []
|
||||||
|
index += 1
|
||||||
|
|
||||||
|
return nodes
|
||||||
|
|
||||||
|
def XmlElement (Dom, String):
|
||||||
|
"""Return a single element that matches the String which is XPath style syntax."""
|
||||||
|
if String == "" or Dom == None or not isinstance(Dom, xml.dom.Node):
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if String[0] == "/":
|
||||||
|
String = String[1:]
|
||||||
|
|
||||||
|
if Dom.nodeType==Dom.DOCUMENT_NODE:
|
||||||
|
Dom = Dom.documentElement
|
||||||
|
|
||||||
|
tagList = String.split('/')
|
||||||
|
childNodes = [Dom]
|
||||||
|
index = 0
|
||||||
|
end = len(tagList) - 1
|
||||||
|
while index <= end:
|
||||||
|
for node in childNodes:
|
||||||
|
if node.nodeType == node.ELEMENT_NODE and node.tagName == tagList[index]:
|
||||||
|
if index < end:
|
||||||
|
childNodes = node.childNodes
|
||||||
|
else:
|
||||||
|
return node
|
||||||
|
break
|
||||||
|
|
||||||
|
index += 1
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def XmlElementData (Dom):
|
||||||
|
"""Get the text for this element."""
|
||||||
|
if Dom == None or Dom == '' or Dom.firstChild == None:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
return Dom.firstChild.data.strip(' ')
|
||||||
|
|
||||||
|
def XmlAttribute (Dom, String):
|
||||||
|
"""Return a single attribute that named by String."""
|
||||||
|
if Dom == None or Dom == '':
|
||||||
|
return ''
|
||||||
|
|
||||||
|
try:
|
||||||
|
return Dom.getAttribute(String).strip(' ')
|
||||||
|
except:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
def XmlTopTag(Dom):
|
||||||
|
"""Return the name of the Root or top tag in the XML tree."""
|
||||||
|
if Dom == None or Dom == '' or Dom.firstChild == None:
|
||||||
|
return ''
|
||||||
|
return Dom.firstChild.nodeName
|
||||||
|
|
||||||
|
|
||||||
|
# This acts like the main() function for the script, unless it is 'import'ed into another
|
||||||
|
# script.
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
# Nothing to do here. Could do some unit tests.
|
||||||
|
pass
|
|
@ -0,0 +1,5 @@
|
||||||
|
BIN_DIR=${PLATFORM_BUILD_DIR}/${ARCH}
|
||||||
|
MODULE_BUILD_DIR=${BIN_DIR}/${PACKAGE_RELATIVE_DIR}/${MODULE_RELATIVE_DIR}/${MODULE_FILE_BASE_NAME}
|
||||||
|
DEST_DIR_OUTPUT=${MODULE_BUILD_DIR}/OUTPUT
|
||||||
|
DEST_DIR_DEBUG=${MODULE_BUILD_DIR}/DEBUG
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
BUILD_DIR=${WORKSPACE_DIR}/${PLATFORM_OUTPUT_DIR}
|
||||||
|
PLATFORM_BUILD_DIR=${BUILD_DIR}/${TARGET}_${TOOLCHAIN}
|
||||||
|
TARGET_DIR=${PLATFORM_BUILD_DIR}
|
||||||
|
FV_DIR=${TARGET_DIR}/FV
|
||||||
|
|
Loading…
Reference in New Issue