]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Python/buildgen/BuildFile.py
9a2aae30b235e365d8ffe14b4e93844e319d898f
3 # Copyright (c) 2007, Intel Corporation
4 # All rights reserved. This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 """Generate build file for given platform"""
15 import xml
.dom
.minidom
, pprint
16 import FrameworkElement
18 from SurfaceAreaElement
import *
19 from XmlRoutines
import *
20 from AntTasks
import *
24 def __init__(self
, workspace
, platform
, toolchain
, target
):
25 if workspace
== None or workspace
== "":
26 raise Exception("No workspace, no build")
27 if platform
== None or platform
== "":
28 raise Exception("No platform, no build")
29 if toolchain
== None or toolchain
== "":
30 raise Exception("No toolchain, no build")
31 if target
== None or target
== "":
32 raise Exception("No target, no build")
34 self
.Workspace
= workspace
35 self
.Platform
= platform
36 self
.Toolchain
= toolchain
41 """Generate the build file"""
44 # generating build.xml for platform
45 class AntPlatformBuildFile(BuildFile
):
46 def __init__(self
, workspace
, platform
, toolchain
, target
):
47 BuildFile
.__init
__(self
, workspace
, platform
, toolchain
, target
)
48 # Form the build file path, hard-coded at present. It should be specified by a configuration file
49 self
.Path
= os
.path
.join(self
.Workspace
.Path
, self
.Platform
.OutputPath
, target
+ "_" + toolchain
, "build.xml")
51 # Generate a common build option property file in the format of Java's property file
52 self
.DefaultBuildOptions()
54 # new a build file object
55 self
.BuildXml
= AntBuildFile(name
="platform", basedir
=".", default
="all")
57 # generate the top level properties, tasks, etc.
60 # generate "prebuild" target
63 # generate "libraries" target for building library modules
66 # generate "modules" target for building non-library modules
69 # generate "fvs" target for building firmware volume. (not supported yet)
71 # generate "fds" target for building FlashDevice. (not supported yet)
73 # generate "postbuild" target
77 print "Generating platform build file ...", self
.Path
78 self
.BuildXml
.Create(self
.Path
)
81 _topLevel
= self
.BuildXml
82 # import external tasks
83 _topLevel
.SubTask("taskdef", resource
="GenBuild.tasks")
84 _topLevel
.SubTask("taskdef", resource
="frameworktasks.tasks")
85 _topLevel
.SubTask("taskdef", resource
="net/sf/antcontrib/antlib.xml")
87 # platform wide properties
89 _topLevel
.Comment("WORKSPACE wide attributes")
90 _topLevel
.SubTask("property", environment
="env")
91 _topLevel
.SubTask("property", name
="WORKSPACE_DIR", value
="${env.WORKSPACE}")
92 _topLevel
.SubTask("property", name
="CONFIG_DIR", value
="${WORKSPACE_DIR}/Tools/Conf")
95 _topLevel
.Comment("Common build attributes")
96 _topLevel
.SubTask("property", name
="THREAD_COUNT", value
=self
.Workspace
.ThreadCount
)
97 _topLevel
.SubTask("property", name
="SINGLE_MODULE_BUILD", value
="no")
98 _topLevel
.SubTask("property", name
="MODULE_BUILD_TARGET", value
="platform_module_build")
100 _topLevel
.Blankline()
101 _topLevel
.SubTask("property", name
="TOOLCHAIN", value
=self
.Toolchain
)
102 _topLevel
.SubTask("property", name
="TARGET", value
=self
.Target
)
104 _topLevel
.Blankline()
105 _topLevel
.Comment("Platform attributes")
106 _topLevel
.SubTask("property", name
="PLATFORM", value
=self
.Platform
.Name
)
107 _topLevel
.SubTask("property", name
="PLATFORM_GUID", value
=self
.Platform
.GuidValue
)
108 _topLevel
.SubTask("property", name
="PLATFORM_VERSION", value
=self
.Platform
.Version
)
109 _topLevel
.SubTask("property", name
="PLATFORM_RELATIVE_DIR", value
=self
.Platform
.Dir
)
110 _topLevel
.SubTask("property", name
="PLATFORM_DIR", value
="${WORKSPACE_DIR}/${PLATFORM_RELATIVE_DIR}")
111 _topLevel
.SubTask("property", name
="PLATFORM_OUTPUT_DIR", value
=self
.Platform
.OutputPath
)
113 # user configurable build path for platform
114 _topLevel
.Blankline()
115 _topLevel
.Comment("Common path definition for platform build")
116 _topLevel
.SubTask("property", file="${WORKSPACE_DIR}/Tools/Python/buildgen/platform_build_path.txt")
118 # common build tasks in the form of Ant macro
119 _topLevel
.Blankline()
120 _topLevel
.Comment("Task Macros for Compiling, Assembling, Linking, etc.")
121 _topLevel
.SubTask("import", file="${CONFIG_DIR}/BuildMacro.xml")
122 _topLevel
.Blankline()
123 _topLevel
.SubTask("echo", message
="${PLATFORM}-${PLATFORM_VERSION} (${PLATFORM_RELATIVE_DIR})", level
="info")
125 # define the targets execution sequence
126 _topLevel
.Blankline()
127 _topLevel
.Comment("Default target")
128 _topLevel
.SubTask("target", name
="all", depends
="prebuild, libraries, modules, postbuild")
131 _topLevel
= self
.BuildXml
132 _topLevel
.Blankline()
133 _topLevel
.Comment(" TARGET: prebuild ")
135 # prebuild is defined by user in the fpd file through <UserExtionsion> element,
136 # which has attribute "identifier=0" or "identifier=prebuild"
138 if self
.Platform
.UserExtensions
.has_key("0"):
139 prebuildTasks
= self
.Platform
.UserExtensions
["0"]
140 elif self
.Platform
.UserExtensions
.has_key("postbuild"):
141 prebuildTasks
= self
.Platform
.UserExtensions
["prebuild"]
143 _topLevel
.SubTask("target", prebuildTasks
, name
="prebuild")
146 _topLevel
= self
.BuildXml
147 _topLevel
.Blankline()
148 _topLevel
.Comment(" TARGET: libraries ")
150 librariesTarget
= _topLevel
.SubTask("target", name
="libraries")
151 parallelBuild
= librariesTarget
.SubTask("parallel", threadCount
="${THREAD_COUNT}")
154 for arch
in self
.Platform
.Libraries
:
155 libraryNumber
+= len(self
.Platform
.Libraries
[arch
])
157 for arch
in self
.Platform
.Libraries
:
158 for lib
in self
.Platform
.Libraries
[arch
]:
160 print "Generating library build files ... %d%%\r" % int((float(libraryIndex
) / float(libraryNumber
)) * 100),
161 buildFile
= AntModuleBuildFile(self
.Workspace
, self
.Platform
, lib
, self
.Toolchain
, self
.Target
, arch
)
163 buildDir
= os
.path
.join("${TARGET_DIR}", arch
, lib
.Module
.Package
.SubPath(lib
.Module
.Dir
),
164 lib
.Module
.FileBaseName
)
165 parallelBuild
.SubTask("ant", dir=buildDir
,
166 #antfile="build.xml",
168 target
="${MODULE_BUILD_TARGET}")
172 _topLevel
= self
.BuildXml
173 _topLevel
.Blankline()
174 _topLevel
.Comment(" TARGET: modules ")
176 modulesTarget
= _topLevel
.SubTask("target", name
="modules")
177 parallelBuild
= modulesTarget
.SubTask("parallel", threadCount
="${THREAD_COUNT}")
180 for arch
in self
.Platform
.Modules
:
181 moduleNumber
+= len(self
.Platform
.Modules
[arch
])
184 for arch
in self
.Platform
.Modules
:
185 for module
in self
.Platform
.Modules
[arch
]:
187 print "Generating module build files ... %d%%\r" % int((float(moduleIndex
) / float(moduleNumber
)) * 100),
189 buildDir
= os
.path
.join("${TARGET_DIR}", arch
, module
.Module
.Package
.SubPath(module
.Module
.Dir
),
190 module
.Module
.FileBaseName
)
191 parallelBuild
.SubTask("ant", dir=buildDir
,
192 #antfile="build.xml",
194 target
="${MODULE_BUILD_TARGET}")
195 buildFile
= AntModuleBuildFile(self
.Workspace
, self
.Platform
, module
, self
.Toolchain
, self
.Target
, arch
)
206 _topLevel
= self
.BuildXml
207 _topLevel
.Blankline()
208 _topLevel
.Comment(" TARGET: postbuild ")
210 # postbuild is defined by user in the fpd file through <UserExtionsion> element,
211 # which has attribute "identifier=1" or "identifier=postbuild"
213 if self
.Platform
.UserExtensions
.has_key("1"):
214 postbuildTasks
= self
.Platform
.UserExtensions
["1"]
215 elif self
.Platform
.UserExtensions
.has_key("postbuild"):
216 postbuildTasks
= self
.Platform
.UserExtensions
["postbuild"]
218 _topLevel
.SubTask("target", postbuildTasks
, name
="postbuild")
226 def UserExtensions(self
):
229 def DefaultBuildOptions(self
):
230 """Generate ${ARCH}_build.opt which contains the default build&tool definitions"""
231 tools
= self
.Workspace
.ToolConfig
.ToolCodes
232 for arch
in self
.Workspace
.ActiveArchs
:
235 key
= (self
.Toolchain
, self
.Target
, arch
, tool
, "NAME")
236 if self
.Workspace
.ToolConfig
[key
] == "": continue
237 validTools
.append(tool
)
239 optFileDir
= os
.path
.join(self
.Workspace
.Path
, self
.Platform
.OutputPath
,
240 self
.Target
+ "_" + self
.Toolchain
)
241 optFileName
= arch
+ "_build.opt"
242 if not os
.path
.exists(optFileDir
): os
.makedirs(optFileDir
)
243 f
= open(os
.path
.join(optFileDir
, optFileName
), "w")
245 for tool
in validTools
:
246 key
= (self
.Toolchain
, self
.Target
, arch
, tool
, "FLAGS")
247 if key
in self
.Platform
.BuildOptions
:
248 flag
= self
.Platform
.BuildOptions
[key
]
250 key
= (self
.Toolchain
, self
.Target
, arch
, tool
, "FAMILY")
251 family
= self
.Workspace
.ToolConfig
[key
]
252 key
= (family
, self
.Target
, arch
, tool
, "FLAGS")
253 if key
in self
.Platform
.BuildOptions
:
254 flag
= self
.Platform
.BuildOptions
[key
]
257 f
.write("PLATFORM_%s_FLAGS=%s\n" % (tool
, flag
))
260 for tool
in validTools
:
261 key
= (self
.Toolchain
, self
.Target
, arch
, tool
, "FLAGS")
262 flag
= self
.Workspace
.ToolConfig
[key
]
263 f
.write("DEFAULT_%s_FLAGS=%s\n" % (tool
, flag
))
266 for tool
in validTools
:
267 for attr
in self
.Workspace
.ToolConfig
.Attributes
:
268 if attr
== "FLAGS": continue
269 key
= (self
.Toolchain
, self
.Target
, arch
, tool
, attr
)
270 value
= self
.Workspace
.ToolConfig
[key
]
272 path
= self
.Workspace
.ToolConfig
[(self
.Toolchain
, self
.Target
, arch
, tool
, "PATH")]
273 f
.write("%s=%s\n" % (tool
, os
.path
.join(path
, value
)))
275 f
.write("%s_%s=%s\n" % (tool
, attr
, value
))
276 f
.write("%s_FLAGS=${DEFAULT_%s_FLAGS} ${DEFAULT_MODULE_%s_FLAGS} ${PLATFORM_%s_FLAGS} ${MODULE_%s_FLAGS}\n" %
277 (tool
, tool
, tool
, tool
, tool
))
282 class AntModuleBuildFile(BuildFile
):
283 def __init__(self
, workspace
, platform
, module
, toolchain
, target
, arch
):
284 BuildFile
.__init
__(self
, workspace
, platform
, toolchain
, target
)
287 self
.Path
= os
.path
.join(self
.Workspace
.Path
, self
.Platform
.OutputPath
,
288 target
+ "_" + toolchain
, arch
, self
.Module
.Module
.Package
.Dir
,
289 self
.Module
.Module
.Dir
, self
.Module
.Module
.FileBaseName
, "build.xml")
290 self
.BuildXml
= AntBuildFile(self
.Module
.Module
.Name
)
292 self
.SourceFiles
= self
.GetSourceFiles()
303 # print self.Path,"\r",
304 self
.BuildXml
.Create(self
.Path
)
307 _topLevel
= self
.BuildXml
308 _topLevel
.SubTask("taskdef", resource
="frameworktasks.tasks")
309 _topLevel
.SubTask("taskdef", resource
="cpptasks.tasks")
310 _topLevel
.SubTask("taskdef", resource
="cpptasks.types")
311 _topLevel
.SubTask("taskdef", resource
="net/sf/antcontrib/antlib.xml")
313 _topLevel
.Blankline()
314 _topLevel
.Comment(" TODO ")
315 _topLevel
.SubTask("property", environment
="env")
316 _topLevel
.SubTask("property", name
="WORKSPACE_DIR", value
="${env.WORKSPACE}")
318 _topLevel
.Blankline()
319 _topLevel
.Comment("Common build attributes")
320 _topLevel
.SubTask("property", name
="SINGLE_MODULE_BUILD", value
="yes")
321 _topLevel
.SubTask("property", name
="MODULE_BUILD_TARGET", value
="single_module_build")
322 _topLevel
.SubTask("property", name
="PLATFORM_PREBUILD", value
="yes")
323 _topLevel
.SubTask("property", name
="PLATFORM_POSTBUILD", value
="no")
325 _topLevel
.Blankline()
326 _topLevel
.Comment(" TODO ")
327 ifTask
= _topLevel
.SubTask("if")
328 ifTask
.SubTask("istrue", value
="${SINGLE_MODULE_BUILD}")
329 thenTask
= ifTask
.SubTask("then")
330 platformBuildFile
= os
.path
.join("${WORKSPACE_DIR}", self
.Platform
.OutputPath
,
331 self
.Target
+ "_" + self
.Toolchain
, "build.xml")
332 thenTask
.SubTask("import", file=platformBuildFile
)
334 _topLevel
.Blankline()
335 _topLevel
.SubTask("property", name
="ARCH", value
=self
.Arch
)
337 module
= self
.Module
.Module
338 package
= module
.Package
339 _topLevel
.Blankline()
340 _topLevel
.SubTask("property", name
="PACKAGE", value
=package
.Name
)
341 _topLevel
.SubTask("property", name
="PACKAGE_GUID", value
=package
.GuidValue
)
342 _topLevel
.SubTask("property", name
="PACKAGE_VERSION", value
=package
.Version
)
343 _topLevel
.SubTask("property", name
="PACKAGE_RELATIVE_DIR", value
=package
.Dir
)
344 _topLevel
.SubTask("property", name
="PACKAGE_DIR", value
=os
.path
.join("${WORKSPACE_DIR}","${PACKAGE_RELATIVE_DIR}"))
346 _topLevel
.Blankline()
347 _topLevel
.SubTask("property", name
="MODULE", value
=module
.Name
)
348 _topLevel
.SubTask("property", name
="MODULE_GUID", value
=module
.GuidValue
)
349 _topLevel
.SubTask("property", name
="MODULE_VERSION", value
=module
.Version
)
350 _topLevel
.SubTask("property", name
="MODULE_TYPE", value
=module
.Type
)
351 _topLevel
.SubTask("property", name
="MODULE_FILE_BASE_NAME", value
=module
.FileBaseName
)
352 _topLevel
.SubTask("property", name
="MODULE_RELATIVE_DIR", value
=module
.Dir
)
353 _topLevel
.SubTask("property", name
="MODULE_DIR", value
=os
.path
.join("${PACKAGE_DIR}", "${MODULE_RELATIVE_DIR}"))
354 _topLevel
.SubTask("property", name
="BASE_NAME", value
=module
.BaseName
)
356 _topLevel
.Blankline()
357 _topLevel
.SubTask("property", file="${WORKSPACE_DIR}/Tools/Python/buildgen/module_build_path.txt")
361 _topLevel
.Blankline()
362 _topLevel
.SubTask("property", name
="ENTRYPOINT", value
="_ModuleEntryPoint")
364 _topLevel
.SubTask("property", name
="SOURCE_FILES", value
="\n ".join(self
._GetSourceFileList
()))
365 _topLevel
.SubTask("property", name
="LIBS", value
="\n ".join(self
._GetLibList
()))
367 _topLevel
.Blankline()
368 _topLevel
.SubTask("property", file="${PLATFORM_BUILD_DIR}/%s_build.opt" % self
.Arch
)
369 _topLevel
.Blankline()
370 _topLevel
.SubTask("echo", message
="${MODULE}-${MODULE_VERSION} [${ARCH}] from package ${PACKAGE}-${PACKAGE_VERSION} (${MODULE_RELATIVE_DIR})", level
="info")
372 _topLevel
.Blankline()
373 _topLevel
.Comment("Default target")
374 _topLevel
.SubTask("target", name
="all", depends
="single_module_build")
375 _topLevel
.SubTask("target", name
="platform_module_build", depends
="prebuild, sourcefiles, sections, output, postbuild")
376 _topLevel
.SubTask("target", name
="single_module_build", depends
="prebuild, libraries, sourcefiles, sections, output, postbuild")
378 def _BuildOption(self
):
379 _topLevel
= self
.BuildXml
380 _topLevel
.Blankline()
381 baseModule
= self
.Module
.Module
382 tools
= self
.Workspace
.ToolConfig
.ToolCodes
385 key
= (self
.Toolchain
, self
.Target
, self
.Arch
, tool
, "FLAGS")
387 if key
in baseModule
.BuildOptions
:
388 flag
= baseModule
.BuildOptions
[key
]
389 _topLevel
.SubTask("property", name
="DEFAULT_MODULE_%s_FLAGS" % tool
, value
=flag
)
391 _topLevel
.Blankline()
393 key
= (self
.Toolchain
, self
.Target
, self
.Arch
, tool
, "FLAGS")
395 if key
in self
.Module
.BuildOptions
:
396 flag
= self
.Module
.BuildOptions
[key
]
397 _topLevel
.SubTask("property", name
="MODULE_%s_FLAGS" % tool
, value
=flag
)
400 _topLevel
= self
.BuildXml
401 _topLevel
.Blankline()
402 _topLevel
.Comment(" TARGET: prebuild ")
405 module
= self
.Module
.Module
406 if module
.UserExtensions
.has_key("0"):
407 prebuildTasks
= module
.UserExtensions
["0"]
408 elif module
.UserExtensions
.has_key("postbuild"):
409 prebuildTasks
= module
.UserExtensions
["prebuild"]
411 _topLevel
.SubTask("target", prebuildTasks
, name
="prebuild")
415 _topLevel
= self
.BuildXml
416 _topLevel
.Blankline()
417 _topLevel
.Comment(" TARGET: libraries ")
419 librariesTarget
= _topLevel
.SubTask("target", name
="libraries")
420 parallelBuild
= librariesTarget
.SubTask("parallel", threadCount
="${THREAD_COUNT}")
421 for lib
in self
.Module
.Libraries
:
423 buildDir
= os
.path
.join("${BIN_DIR}", module
.Package
.SubPath(module
.Dir
), module
.FileBaseName
)
424 libTask
= parallelBuild
.SubTask("ant", dir=buildDir
,
426 target
="${MODULE_BUILD_TARGET}")
427 libTask
.SubTask("property", name
="PLATFORM_PREBUILD", value
="false")
428 libTask
.SubTask("property", name
="PLATFORM_POSTBUILD", value
="false")
430 def Sourcefiles(self
):
431 _topLevel
= self
.BuildXml
432 _topLevel
.Blankline()
433 _topLevel
.Comment(" TARGET: sourcefiles ")
434 _sourcefilesTarget
= _topLevel
.SubTask("target", name
="sourcefiles")
436 _incTask
= AntTask(self
.BuildXml
.Document
, "EXTRA.INC")
437 _incTask
.SubTask("includepath", path
="${WORKSPACE_DIR}")
438 _incTask
.SubTask("includepath", path
="${MODULE_DIR}")
439 _incTask
.SubTask("includepath", path
=os
.path
.join("${MODULE_DIR}", self
.Arch
.capitalize()))
440 _incTask
.SubTask("includepath", path
="${DEST_DIR_DEBUG}")
441 if self
.Arch
in self
.Module
.Module
.IncludePaths
:
442 for inc
in self
.Module
.Module
.IncludePaths
[self
.Arch
]:
443 _incTask
.SubTask("includepath", path
=os
.path
.join("${WORKSPACE_DIR}", inc
))
446 if not self
.Module
.Module
.IsBinary
:
447 _buildTask
= _sourcefilesTarget
.SubTask("Build_Init")
448 _buildTask
.AddSubTask(_incTask
)
451 _buildTask
= _sourcefilesTarget
.SubTask("Build_AUTOGEN", FILEEXT
="c", FILENAME
="AutoGen", FILEPATH
=".")
452 _buildTask
.AddSubTask(_incTask
)
456 if type in self
.SourceFiles
:
457 for srcpath
in self
.SourceFiles
[type]:
458 taskName
= "Build_" + type
459 fileDir
= os
.path
.dirname(srcpath
)
460 if fileDir
== "": fileDir
= "."
461 fileBaseName
,fileExt
= os
.path
.basename(srcpath
).rsplit(".", 1)
462 _buildTask
= _sourcefilesTarget
.SubTask(taskName
, FILENAME
=fileBaseName
, FILEEXT
=fileExt
, FILEPATH
=fileDir
)
463 _buildTask
.AddSubTask(_incTask
)
465 # others: c, vfr, ...
466 for type in self
.SourceFiles
:
467 if type == "Unicode": continue
468 for srcpath
in self
.SourceFiles
[type]:
469 taskName
= "Build_" + type
470 fileDir
= os
.path
.dirname(srcpath
)
471 if fileDir
== "": fileDir
= "."
472 fileBaseName
,fileExt
= os
.path
.basename(srcpath
).rsplit(".", 1)
473 _buildTask
= _sourcefilesTarget
.SubTask(taskName
, FILENAME
=fileBaseName
, FILEEXT
=fileExt
, FILEPATH
=fileDir
)
474 _buildTask
.AddSubTask(_incTask
)
477 _topLevel
= self
.BuildXml
478 _topLevel
.Blankline()
479 _topLevel
.Comment(" TARGET: sections ")
480 _sectionsTarget
= _topLevel
.SubTask("target", name
="sections")
483 _topLevel
= self
.BuildXml
484 _topLevel
.Blankline()
485 _topLevel
.Comment(" TARGET: output ")
486 _sectionsTarget
= _topLevel
.SubTask("target", name
="output")
489 _topLevel
= self
.BuildXml
490 _topLevel
.Blankline()
491 _topLevel
.Comment(" TARGET: postbuild ")
494 module
= self
.Module
.Module
495 if module
.UserExtensions
.has_key("1"):
496 postbuildTasks
= module
.UserExtensions
["1"]
497 elif module
.UserExtensions
.has_key("postbuild"):
498 postbuildTasks
= module
.UserExtensions
["postbuild"]
500 _topLevel
.SubTask("target", postbuildTasks
, name
="postbuild")
508 def UserExtensions(self
):
511 def GetSourceFiles(self
):
512 ## check arch, toolchain, family, toolcode, ext
513 ## if the arch of source file supports active arch
514 ## if the toolchain of source file supports active toolchain
515 ## if the toolchain family of source file supports active toolchain family
516 ## if the ext of the source file is supported by the toolcode
517 module
= self
.Module
.Module
518 files
= {} # file type -> src
519 for type in module
.SourceFiles
[self
.Arch
]:
520 if not module
.IsBuildable(type):
521 # print type,"is not buildable"
524 if type not in files
:
526 for src
in module
.SourceFiles
[self
.Arch
][type]:
527 if self
.Toolchain
not in src
.Toolchains
:
528 # print self.Toolchain,"not in ",src.Toolchains
530 if not self
.IsCompatible(src
.Families
, self
.Workspace
.ActiveFamilies
):
531 # print src.Families,"not compatible with",self.Workspace.ActiveFamilies
533 toolcode
= src
.GetToolCode(src
.Type
)
535 ext
= self
.Workspace
.GetToolDef(self
.Toolchain
, self
.Target
, self
.Arch
, toolcode
, "EXT")
536 if ext
!= "" and ext
!= src
.Ext
:
537 # print ext,"in tools_def.txt is not the same as",src.Ext
539 ## fileFullPath = os.path.join("${MODULE_DIR}", )
540 ## print fileFullPath
541 files
[type].append(src
.Path
)
545 def Intersection(self
, list1
, list2
):
546 return list(Set(list1
) & Set(list2
))
548 def IsCompatible(self
, list1
, list2
):
549 return len(self
.Intersection(list1
, list2
)) > 0
551 def _GetLibList(self
):
553 for lib
in self
.Module
.Libraries
:
555 libList
.append(os
.path
.join("${BIN_DIR}", module
.Name
+ ".lib"))
558 def _GetSourceFileList(self
):
560 for type in self
.SourceFiles
:
561 srcList
.extend(self
.SourceFiles
[type])
564 class NmakeFile(BuildFile
):
567 class GmakeFile(BuildFile
):
571 if __name__
== "__main__":
572 workspacePath
= os
.getenv("WORKSPACE", os
.getcwd())
573 startTime
= time
.clock()
574 ws
= Workspace(workspacePath
, [], [])
577 ap
= ws
.ActivePlatform
578 for target
in ws
.ActiveTargets
:
579 ant
= AntPlatformBuildFile(ws
, ap
, ws
.ActiveToolchain
, target
)
582 print "\n[Finished in %fs]" % (time
.clock() - startTime
)