2727import os
2828import sys
2929import string
30+ import utils
3031
3132from SCons .Script import *
3233from utils import _make_path_relative
@@ -233,7 +234,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
233234 rtconfig .CROSS_TOOL , rtconfig .PLATFORM = tgt_dict [tgt_name ]
234235 # replace the 'RTT_CC' to 'CROSS_TOOL'
235236 os .environ ['RTT_CC' ] = rtconfig .CROSS_TOOL
236- reload (rtconfig )
237+ utils . ReloadModule (rtconfig )
237238 except KeyError :
238239 print ('Unknow target: ' + tgt_name + '. Avaible targets: ' + ', ' .join (tgt_dict .keys ()))
239240 sys .exit (1 )
@@ -246,7 +247,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
246247 if 'RTT_EXEC_PATH' in os .environ :
247248 # del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
248249 del os .environ ['RTT_EXEC_PATH' ]
249- reload (rtconfig )
250+ utils . ReloadModule (rtconfig )
250251
251252 # add compability with Keil MDK 4.6 which changes the directory of armcc.exe
252253 if rtconfig .PLATFORM == 'armcc' :
@@ -407,7 +408,7 @@ def PrepareModuleBuilding(env, root_directory, bsp_directory):
407408
408409 # parse bsp rtconfig.h to get used component
409410 PreProcessor = PatchedPreProcessor ()
410- f = file (bsp_directory + '/rtconfig.h' , 'r' )
411+ f = open (bsp_directory + '/rtconfig.h' , 'r' )
411412 contents = f .read ()
412413 f .close ()
413414 PreProcessor .process_contents (contents )
@@ -458,7 +459,7 @@ def LocalOptions(config_filename):
458459 # parse wiced_config.h to get used component
459460 PreProcessor = SCons .cpp .PreProcessor ()
460461
461- f = file (config_filename , 'r' )
462+ f = open (config_filename , 'r' )
462463 contents = f .read ()
463464 f .close ()
464465
@@ -573,13 +574,29 @@ def DefineGroup(name, src, depend, **parameters):
573574 if 'CCFLAGS' in group :
574575 Env .AppendUnique (CCFLAGS = group ['CCFLAGS' ])
575576 if 'CPPPATH' in group :
577+ paths = []
578+ for item in group ['CPPPATH' ]:
579+ paths .append (os .path .abspath (item ))
580+ group ['CPPPATH' ] = paths
576581 Env .AppendUnique (CPPPATH = group ['CPPPATH' ])
577582 if 'CPPDEFINES' in group :
578583 Env .AppendUnique (CPPDEFINES = group ['CPPDEFINES' ])
579584 if 'LINKFLAGS' in group :
580585 Env .AppendUnique (LINKFLAGS = group ['LINKFLAGS' ])
581586 if 'ASFLAGS' in group :
582587 Env .AppendUnique (ASFLAGS = group ['ASFLAGS' ])
588+ if 'LOCAL_CPPPATH' in group :
589+ paths = []
590+ for item in group ['LOCAL_CPPPATH' ]:
591+ paths .append (os .path .abspath (item ))
592+ group ['LOCAL_CPPPATH' ] = paths
593+
594+ import rtconfig
595+ if rtconfig .PLATFORM == 'gcc' :
596+ if 'CCFLAGS' in group :
597+ group ['CCFLAGS' ] = utils .GCCC99Patch (group ['CCFLAGS' ])
598+ if 'LOCAL_CCFLAGS' in group :
599+ group ['LOCAL_CCFLAGS' ] = utils .GCCC99Patch (group ['LOCAL_CCFLAGS' ])
583600
584601 # check whether to clean up library
585602 if GetOption ('cleanlib' ) and os .path .exists (os .path .join (group ['path' ], GroupLibFullName (name , Env ))):
@@ -863,7 +880,7 @@ def GetVersion():
863880
864881 # parse rtdef.h to get RT-Thread version
865882 prepcessor = PatchedPreProcessor ()
866- f = file (rtdef , 'r' )
883+ f = open (rtdef , 'r' )
867884 contents = f .read ()
868885 f .close ()
869886 prepcessor .process_contents (contents )
0 commit comments