- Remove the TOOL without NAME defined and its definition in ARCH_build.opt
- Prefix the tool path to its name in ARCH_build.opt - Support the same library class in different package git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2325 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
149127db68
commit
d59f2c721b
|
@ -230,18 +230,19 @@ class AntPlatformBuildFile(BuildFile):
|
||||||
"""Generate ${ARCH}_build.opt which contains the default build&tool definitions"""
|
"""Generate ${ARCH}_build.opt which contains the default build&tool definitions"""
|
||||||
tools = self.Workspace.ToolConfig.ToolCodes
|
tools = self.Workspace.ToolConfig.ToolCodes
|
||||||
for arch in self.Workspace.ActiveArchs:
|
for arch in self.Workspace.ActiveArchs:
|
||||||
|
validTools = []
|
||||||
|
for tool in tools:
|
||||||
|
key = (self.Toolchain, self.Target, arch, tool, "NAME")
|
||||||
|
if self.Workspace.ToolConfig[key] == "": continue
|
||||||
|
validTools.append(tool)
|
||||||
|
|
||||||
optFileDir = os.path.join(self.Workspace.Path, self.Platform.OutputPath,
|
optFileDir = os.path.join(self.Workspace.Path, self.Platform.OutputPath,
|
||||||
self.Target + "_" + self.Toolchain)
|
self.Target + "_" + self.Toolchain)
|
||||||
optFileName = arch + "_build.opt"
|
optFileName = arch + "_build.opt"
|
||||||
if not os.path.exists(optFileDir): os.makedirs(optFileDir)
|
if not os.path.exists(optFileDir): os.makedirs(optFileDir)
|
||||||
f = open(os.path.join(optFileDir, optFileName), "w")
|
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 validTools:
|
||||||
for tool in tools:
|
|
||||||
key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
|
key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
|
||||||
if key in self.Platform.BuildOptions:
|
if key in self.Platform.BuildOptions:
|
||||||
flag = self.Platform.BuildOptions[key]
|
flag = self.Platform.BuildOptions[key]
|
||||||
|
@ -254,15 +255,22 @@ class AntPlatformBuildFile(BuildFile):
|
||||||
else:
|
else:
|
||||||
flag = ""
|
flag = ""
|
||||||
f.write("PLATFORM_%s_FLAGS=%s\n" % (tool, flag))
|
f.write("PLATFORM_%s_FLAGS=%s\n" % (tool, flag))
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
for tool in validTools:
|
||||||
|
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")
|
f.write("\n")
|
||||||
for tool in tools:
|
for tool in validTools:
|
||||||
for attr in self.Workspace.ToolConfig.Attributes:
|
for attr in self.Workspace.ToolConfig.Attributes:
|
||||||
if attr == "FLAGS": continue
|
if attr == "FLAGS": continue
|
||||||
key = (self.Toolchain, self.Target, arch, tool, attr)
|
key = (self.Toolchain, self.Target, arch, tool, attr)
|
||||||
value = self.Workspace.ToolConfig[key]
|
value = self.Workspace.ToolConfig[key]
|
||||||
if attr == "NAME":
|
if attr == "NAME":
|
||||||
f.write("%s=%s\n" % (tool, value))
|
path = self.Workspace.ToolConfig[(self.Toolchain, self.Target, arch, tool, "PATH")]
|
||||||
|
f.write("%s=%s\n" % (tool, os.path.join(path, value)))
|
||||||
else:
|
else:
|
||||||
f.write("%s_%s=%s\n" % (tool, attr, value))
|
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" %
|
f.write("%s_FLAGS=${DEFAULT_%s_FLAGS} ${DEFAULT_MODULE_%s_FLAGS} ${PLATFORM_%s_FLAGS} ${MODULE_%s_FLAGS}\n" %
|
||||||
|
|
|
@ -487,7 +487,7 @@ class Workspace(Element):
|
||||||
"PATH" : {},
|
"PATH" : {},
|
||||||
"NAME" : {},
|
"NAME" : {},
|
||||||
}
|
}
|
||||||
## "NAME" : {name : library interface}
|
## "NAME" : {name : [library interface]}
|
||||||
## "PATH" : {path : library interface}
|
## "PATH" : {path : library interface}
|
||||||
self.LibraryInterfaceXref = {
|
self.LibraryInterfaceXref = {
|
||||||
"PATH" : {},
|
"PATH" : {},
|
||||||
|
|
|
@ -284,9 +284,6 @@ class LibraryClass(FrameworkElement.LibraryClass, SurfaceAreaElement):
|
||||||
self.FavoriteIntance = FrameworkElement.Module()
|
self.FavoriteIntance = FrameworkElement.Module()
|
||||||
self.FavoriteIntance.Version = attribute
|
self.FavoriteIntance.Version = attribute
|
||||||
|
|
||||||
def Postprocess(self):
|
|
||||||
self.Interface = self._Workspace.GetLibraryInterface(self.Name)
|
|
||||||
|
|
||||||
class SourceFile(FrameworkElement.SourceFile, SurfaceAreaElement):
|
class SourceFile(FrameworkElement.SourceFile, SurfaceAreaElement):
|
||||||
def __init__(self, workspace, module, dom):
|
def __init__(self, workspace, module, dom):
|
||||||
FrameworkElement.SourceFile.__init__(self)
|
FrameworkElement.SourceFile.__init__(self)
|
||||||
|
@ -758,7 +755,7 @@ class ModuleSurfaceArea(FrameworkElement.Module, SurfaceAreaElement):
|
||||||
# resolve library class
|
# resolve library class
|
||||||
if self._Elements.has_key("LibraryClassDefinitions"):
|
if self._Elements.has_key("LibraryClassDefinitions"):
|
||||||
for lc in self._Elements["LibraryClassDefinitions"]:
|
for lc in self._Elements["LibraryClassDefinitions"]:
|
||||||
lc.Interface = self._Workspace.GetLibraryInterface(lc.Name)
|
lc.Interface = self.GetLibraryInterface(lc.Name)
|
||||||
if "ALWAYS_PRODUCED" in lc.Usage:
|
if "ALWAYS_PRODUCED" in lc.Usage:
|
||||||
self.IsLibrary = True
|
self.IsLibrary = True
|
||||||
lc.Interface.Instances.append(self)
|
lc.Interface.Instances.append(self)
|
||||||
|
@ -811,6 +808,14 @@ class ModuleSurfaceArea(FrameworkElement.Module, SurfaceAreaElement):
|
||||||
if arch not in self.Externs:
|
if arch not in self.Externs:
|
||||||
self.Externs[arch] = []
|
self.Externs[arch] = []
|
||||||
self.Externs[arch].append(extern)
|
self.Externs[arch].append(extern)
|
||||||
|
|
||||||
|
def GetLibraryInterface(self, name):
|
||||||
|
if name in self.Package.LibraryInterfaces:
|
||||||
|
return self.Package.LibraryInterfaces[name]
|
||||||
|
for pd in self._Elements["PackageDependencies"]:
|
||||||
|
if name in pd.Package.LibraryInterfaces:
|
||||||
|
return pd.Package.LibraryInterfaces[name]
|
||||||
|
return ""
|
||||||
## def SetupEnvironment(self):
|
## def SetupEnvironment(self):
|
||||||
## self.Environment["MODULE"] = self.Name
|
## self.Environment["MODULE"] = self.Name
|
||||||
## self.Environment["MODULE_GUID"] = self.GuidValue
|
## self.Environment["MODULE_GUID"] = self.GuidValue
|
||||||
|
@ -1027,10 +1032,14 @@ class Workspace(FrameworkElement.Workspace, SurfaceAreaElement):
|
||||||
return platform
|
return platform
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def GetLibraryInterface(self, name):
|
def GetLibraryInterface(self, name, package):
|
||||||
if name not in self.LibraryInterfaceXref["NAME"]:
|
if name not in self.LibraryInterfaceXref["NAME"]:
|
||||||
return ""
|
return ""
|
||||||
return self.LibraryInterfaceXref["NAME"][name]
|
liList = self.LibraryInterfaceXref["NAME"][name]
|
||||||
|
for li in liList:
|
||||||
|
if li.Package == package:
|
||||||
|
return li
|
||||||
|
return ""
|
||||||
|
|
||||||
def SubPath(self, *relativePathList):
|
def SubPath(self, *relativePathList):
|
||||||
return os.path.normpath(os.path.join(self.Path, *relativePathList))
|
return os.path.normpath(os.path.join(self.Path, *relativePathList))
|
||||||
|
@ -1084,14 +1093,17 @@ class Workspace(FrameworkElement.Workspace, SurfaceAreaElement):
|
||||||
## library class name -> library class object
|
## library class name -> library class object
|
||||||
##
|
##
|
||||||
for lcname in p.LibraryInterfaces:
|
for lcname in p.LibraryInterfaces:
|
||||||
if lcname in self.LibraryInterfaceXref["NAME"]:
|
if lcname not in self.LibraryInterfaceXref["NAME"]:
|
||||||
raise Exception("Duplicate library class: %s in package %s" % (lcname, name))
|
# raise Exception("Duplicate library class: %s in package %s" % (lcname, name))
|
||||||
|
self.LibraryInterfaceXref["NAME"][lcname] = []
|
||||||
lcInterface = p.LibraryInterfaces[lcname]
|
lcInterface = p.LibraryInterfaces[lcname]
|
||||||
self.LibraryInterfaceXref["NAME"][lcname] = lcInterface
|
self.LibraryInterfaceXref["NAME"][lcname].append(lcInterface)
|
||||||
|
|
||||||
if lcInterface not in self.LibraryInterfaceXref["PATH"]:
|
lcHeader = p.SubPath(lcInterface.Path)
|
||||||
self.LibraryInterfaceXref["PATH"][lcInterface] = []
|
if lcHeader not in self.LibraryInterfaceXref["PATH"]:
|
||||||
self.LibraryInterfaceXref["PATH"][lcInterface].append(lcname)
|
# raise Exception("Duplicate library class interface: %s in package %s" % (lcInterface, name))
|
||||||
|
self.LibraryInterfaceXref["PATH"][lcHeader] = []
|
||||||
|
self.LibraryInterfaceXref["PATH"][lcHeader].append(lcInterface)
|
||||||
|
|
||||||
##
|
##
|
||||||
## setup package cross reference as nest-dict
|
## setup package cross reference as nest-dict
|
||||||
|
@ -1111,7 +1123,10 @@ class Workspace(FrameworkElement.Workspace, SurfaceAreaElement):
|
||||||
if guid not in moduleGuidIndex:
|
if guid not in moduleGuidIndex:
|
||||||
moduleGuidIndex[guid] = {}
|
moduleGuidIndex[guid] = {}
|
||||||
else:
|
else:
|
||||||
print "! Duplicate module GUID found:", guid, path
|
print "! Duplicate module GUID found:", guid, p.SubPath(path)
|
||||||
|
dm = moduleGuidIndex[guid].values()[0][0]
|
||||||
|
print " ", dm.GuidValue,\
|
||||||
|
dm.Package.SubPath(dm.Path)
|
||||||
|
|
||||||
if version not in moduleGuidIndex[guid]:
|
if version not in moduleGuidIndex[guid]:
|
||||||
moduleGuidIndex[guid][version] = []
|
moduleGuidIndex[guid][version] = []
|
||||||
|
@ -1483,7 +1498,8 @@ def PrintWorkspace(ws):
|
||||||
print "\n"
|
print "\n"
|
||||||
print "\nLibrary Classes:"
|
print "\nLibrary Classes:"
|
||||||
for name in ws.LibraryInterfaceXref["NAME"]:
|
for name in ws.LibraryInterfaceXref["NAME"]:
|
||||||
lc = ws.LibraryInterfaceXref["NAME"][name]
|
lcList = ws.LibraryInterfaceXref["NAME"][name]
|
||||||
|
for lc in lcList:
|
||||||
pkgPath = os.path.dirname(lc.Package.Path)
|
pkgPath = os.path.dirname(lc.Package.Path)
|
||||||
print "\n [%s] <%s>" % (lc.Name, pkgPath + os.path.sep + lc.Path)
|
print "\n [%s] <%s>" % (lc.Name, pkgPath + os.path.sep + lc.Path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue