summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-12-10 15:31:55 +0000
committer[email protected] <[email protected]>2011-12-10 15:31:55 +0000
commita5a7c47d04fa8f2669252798a772b5010c557955 (patch)
tree5ed92828c796d56ca9b33c2a0a41e4fc93ee865c /tools
parent7dc3ec9b75bc2604b22e389a8b3ae6af9d61edaa (diff)
add merge group function.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1832 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'tools')
-rw-r--r--tools/building.py43
1 files changed, 40 insertions, 3 deletions
diff --git a/tools/building.py b/tools/building.py
index ef77d7760f..ed278b83ba 100644
--- a/tools/building.py
+++ b/tools/building.py
@@ -17,7 +17,7 @@ def _get_filetype(fn):
if fn.rfind('.c') != -1 or fn.rfind('.C') != -1 or fn.rfind('.cpp') != -1:
return 1
- # assimble file type
+ # assemble file type
if fn.rfind('.s') != -1 or fn.rfind('.S') != -1:
return 2
@@ -279,6 +279,7 @@ def MDK4Project(target, script):
paths.add(inc) #.replace('\\', '/')
paths = [i for i in paths]
+ paths.sort()
CPPPATH = string.join(paths, ';')
definitions = [i for i in set(CPPDEFINES)]
@@ -552,6 +553,34 @@ def GetDepend(depend):
def AddDepend(option):
BuildOptions[option] = 1
+def MergeGroup(src_group, group):
+ src_group['src'] = src_group['src'] + group['src']
+ if group.has_key('CCFLAGS'):
+ if src_group.has_key('CCFLAGS'):
+ src_group['CCFLAGS'] = src_group['CCFLAGS'] + group['CCFLAGS']
+ else:
+ src_group['CCFLAGS'] = group['CCFLAGS']
+ if group.has_key('CPPPATH'):
+ if src_group.has_key('CPPPATH'):
+ src_group['CPPPATH'] = src_group['CPPPATH'] + group['CPPPATH']
+ else:
+ src_group['CPPPATH'] = group['CPPPATH']
+ if group.has_key('CPPDEFINES'):
+ if src_group.has_key('CPPDEFINES'):
+ src_group['CPPDEFINES'] = src_group['CPPDEFINES'] + group['CPPDEFINES']
+ else:
+ src_group['CPPDEFINES'] = group['CPPDEFINES']
+ if group.has_key('LINKFLAGS'):
+ if src_group.has_key('LINKFLAGS'):
+ src_group['LINKFLAGS'] = src_group['LINKFLAGS'] + group['LINKFLAGS']
+ else:
+ src_group['LINKFLAGS'] = group['LINKFLAGS']
+ if group.has_key('LIBRARY'):
+ if src_group['LIBRARY'].has_key('LIBRARY'):
+ src_group['LIBRARY'] = src_group['LIBRARY'] + group['LIBRARY']
+ else:
+ src_group['LIBRARY'] = group['LIBRARY']
+
def DefineGroup(name, src, depend, **parameters):
global Env
if not GetDepend(depend):
@@ -564,8 +593,6 @@ def DefineGroup(name, src, depend, **parameters):
else:
group['src'] = src
- Projects.append(group)
-
if group.has_key('CCFLAGS'):
Env.Append(CCFLAGS = group['CCFLAGS'])
if group.has_key('CPPPATH'):
@@ -580,6 +607,16 @@ def DefineGroup(name, src, depend, **parameters):
if group.has_key('LIBRARY'):
objs = Env.Library(name, objs)
+ # merge group
+ for g in Projects:
+ if g['name'] == name:
+ # merge to this group
+ MergeGroup(g, group)
+ return objs
+
+ # add a new group
+ Projects.append(group)
+
return objs
def GetCurrentDir():