summaryrefslogtreecommitdiff
path: root/components/libc/compilers/newlib/SConscript
diff options
context:
space:
mode:
Diffstat (limited to 'components/libc/compilers/newlib/SConscript')
-rw-r--r--components/libc/compilers/newlib/SConscript32
1 files changed, 21 insertions, 11 deletions
diff --git a/components/libc/compilers/newlib/SConscript b/components/libc/compilers/newlib/SConscript
index d0868bbdea..8076a73727 100644
--- a/components/libc/compilers/newlib/SConscript
+++ b/components/libc/compilers/newlib/SConscript
@@ -1,21 +1,31 @@
+import os
from building import *
+from gcc import *
Import('rtconfig')
-src = Glob('*.c')
+src = []
cwd = GetCurrentDir()
group = []
-
+LIBS = ['m'] # link libm
CPPPATH = [cwd]
-CPPDEFINES = ['RT_USING_NEWLIB']
-
-# link with libc and libm:
-# libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
-# recent GCC tool chains. The linker would just link in the functions that have
-# been referenced. So setting this won't result in bigger text size.
-LIBS = ['c', 'm']
if rtconfig.PLATFORM == 'gcc':
- group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
- CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
+ LIBS += ['c'] # link libc
+ src += Glob('*.c')
+
+ #report newlib version
+ print('Newlib version:' + GetNewLibVersion(rtconfig))
+
+ # identify this is Newlib, and only enable POSIX.1-1990
+ CPPDEFINES = ['RT_USING_NEWLIB', '_POSIX_C_SOURCE=1']
+
+ group = DefineGroup('Compiler', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
+
+
+list = os.listdir(cwd)
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ group = group + SConscript(os.path.join(d, 'SConscript'))
Return('group')