diff options
| author | [email protected] <[email protected]> | 2011-11-09 02:42:48 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2011-11-09 02:42:48 +0000 |
| commit | f8bbcf9aef8d82fa802fbb0b06e6453cb435c768 (patch) | |
| tree | 37551b5fb4e37f79cb9633d10c58b3ff61b711a1 /tools/building.py | |
| parent | 4e8d6639f001bcf3939bfe8012943f287289d287 (diff) | |
if --target is set, adjust CROSS_TOOL and PLATFORM automatically
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1792 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'tools/building.py')
| -rw-r--r-- | tools/building.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/tools/building.py b/tools/building.py index 5cf225428c..9167581644 100644 --- a/tools/building.py +++ b/tools/building.py @@ -476,17 +476,28 @@ def PrepareBuilding(env, root_directory, has_libcpu=False): PreProcessor.process_contents(contents)
BuildOptions = PreProcessor.cpp_namespace
- if (GetDepend('RT_USING_NEWLIB') == False and GetDepend('RT_USING_NOLIBC') == False) and rtconfig.PLATFORM == 'gcc':
- AddDepend('RT_USING_MINILIBC')
-
# add target option
AddOption('--target',
dest='target',
type='string',
help='set target project: mdk')
- if GetOption('target'):
+ #{target_name:(CROSS_TOOL, PLATFORM)}
+ tgt_dict = {'mdk':('keil', 'armcc'),
+ 'mdk4':('keil', 'armcc'),
+ 'iar':('iar', 'iar')}
+ tgt_name = GetOption('target')
+ if tgt_name:
SetOption('no_exec', 1)
+ try:
+ rtconfig.CROSS_TOOL, rtconfig.PLATFORM = tgt_dict[tgt_name]
+ except KeyError:
+ print 'Unknow target: %s. Avaible targets: %s' % \
+ (tgt_name, ', '.join(tgt_dict.keys()))
+ sys.exit(1)
+ elif (GetDepend('RT_USING_NEWLIB') == False and GetDepend('RT_USING_NOLIBC') == False) \
+ and rtconfig.PLATFORM == 'gcc':
+ AddDepend('RT_USING_MINILIBC')
#env['CCCOMSTR'] = "CC $TARGET"
#env['ASCOMSTR'] = "AS $TARGET"
@@ -584,10 +595,6 @@ def EndBuilding(target): if GetOption('target') == 'mdk':
template = os.path.isfile('template.Uv2')
- if rtconfig.CROSS_TOOL != 'keil':
- print 'Please use Keil MDK compiler in rtconfig.py'
- return
-
if template:
MDKProject('project.Uv2', Projects)
else:
@@ -598,13 +605,7 @@ def EndBuilding(target): print 'No template project file found.'
if GetOption('target') == 'mdk4':
- if rtconfig.CROSS_TOOL != 'keil':
- print 'Please use Keil MDK compiler in rtconfig.py'
- return
MDK4Project('project.uvproj', Projects)
-
+
if GetOption('target') == 'iar':
- if rtconfig.CROSS_TOOL != 'iar':
- print 'Please use IAR compiler in rtconfig.py'
- return
IARProject('project.ewp', Projects)
|
