[LIBC] Use RT_USING_LIBC instead of libs option for each compiler

This commit is contained in:
Bernard Xiong 2014-10-28 03:45:43 +00:00
parent 372926477b
commit 802c768475
4 changed files with 28 additions and 32 deletions

View File

@ -1,13 +1,18 @@
# for libc component
import os
Import('RTT_ROOT')
Import('rtconfig')
from building import *
objs = []
list = os.listdir(os.path.join(RTT_ROOT, 'components', 'libc'))
for d in list:
path = os.path.join(RTT_ROOT, 'components', 'libc', d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
if GetDepend('RT_USING_LIBC'):
if rtconfig.PLATFORM == 'gcc':
objs = objs + SConscript('newlib/SConscript')
elif rtconfig.PLATFORM == 'armcc':
objs = objs + SConscript('armlibc/SConscript')
else:
if rtconfig.PLATFORM == 'gcc':
objs = objs + SConscript('minilibc/SConscript')
Return('objs')

View File

@ -1,16 +1,12 @@
Import('rtconfig')
from building import *
if GetDepend('RT_USING_ARM_LIBC') and rtconfig.CROSS_TOOL != 'keil':
print '================ERROR=============================='
print 'Please use ARM CC compiler if using ARM C library'
print '==================================================='
exit(0)
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
cwd = GetCurrentDir()
group = DefineGroup('libc', src, depend = ['RT_USING_ARM_LIBC'], CPPPATH = CPPPATH)
CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_ARM_LIBC']
group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')

View File

@ -2,12 +2,12 @@ Import('RTT_ROOT')
from building import *
src = Glob('*.c')
CPPPATH = [RTT_ROOT + '/components/libc/minilibc']
cwd = GetCurrentDir()
CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_MINILIBC']
group = DefineGroup('minilibc', src,
depend = ['RT_USING_MINILIBC'],
CPPPATH = CPPPATH,
CPPDEFINES = CPPDEFINES
)
group = DefineGroup('libc', src, depend = ['RT_USING_MINILIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')

View File

@ -1,15 +1,10 @@
Import('rtconfig')
from building import *
if GetDepend('RT_USING_NEWLIB') and rtconfig.CROSS_TOOL != 'gcc':
print '================ERROR============================'
print 'Please use GNU GCC compiler if using newlib'
print '================================================='
exit(0)
src = Glob('*.c')
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_NEWLIB']
# link with libc and libm:
# libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
@ -17,7 +12,7 @@ CPPPATH = [cwd]
# been referenced. So setting this won't result in bigger text size.
LIBS = ['c', 'm']
group = DefineGroup('newlib', src, depend = ['RT_USING_NEWLIB'],
CPPPATH = CPPPATH, LIBS = LIBS)
group = DefineGroup('newlib', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
Return('group')