@@ -124,27 +124,28 @@ def spawn(self, sh, escape, cmd, args, env):
124124# generate cconfig.h file
125125def GenCconfigFile (env , BuildOptions ):
126126
127- if rtconfig .PLATFORM in ['gcc' ]:
128- contents = ''
129- if not os .path .isfile ('cconfig.h' ):
130- import gcc
131- gcc .GenerateGCCConfig (rtconfig )
127+ # if rtconfig.PLATFORM in ['gcc']:
128+ # contents = ''
129+ # if not os.path.isfile('cconfig.h'):
130+ # import gcc
131+ # gcc.GenerateGCCConfig(rtconfig)
132132
133- # try again
134- if os .path .isfile ('cconfig.h' ):
135- f = open ('cconfig.h' , 'r' )
136- if f :
137- contents = f .read ()
138- f .close ()
133+ # # try again
134+ # if os.path.isfile('cconfig.h'):
135+ # f = open('cconfig.h', 'r')
136+ # if f:
137+ # contents = f.read()
138+ # f.close()
139139
140- prep = PatchedPreProcessor ()
141- prep .process_contents (contents )
142- options = prep .cpp_namespace
140+ # prep = PatchedPreProcessor()
141+ # prep.process_contents(contents)
142+ # options = prep.cpp_namespace
143143
144- BuildOptions .update (options )
144+ # BuildOptions.update(options)
145145
146- # add HAVE_CCONFIG_H definition
147- env .AppendUnique (CPPDEFINES = ['HAVE_CCONFIG_H' ])
146+ # # add HAVE_CCONFIG_H definition
147+ # env.AppendUnique(CPPDEFINES = ['HAVE_CCONFIG_H'])
148+ pass
148149
149150def PrepareBuilding (env , root_directory , has_libcpu = False , remove_components = []):
150151
@@ -202,22 +203,36 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
202203 rtconfig .CROSS_TOOL , rtconfig .PLATFORM = tgt_dict [tgt_name ]
203204 # replace the 'RTT_CC' to 'CROSS_TOOL'
204205 os .environ ['RTT_CC' ] = rtconfig .CROSS_TOOL
205- utils .ReloadModule (rtconfig )
206206 except KeyError :
207207 print ('Unknow target: ' + tgt_name + '. Avaible targets: ' + ', ' .join (tgt_dict .keys ()))
208208 sys .exit (1 )
209209
210+ exec_prefix = GetOption ('exec-prefix' )
211+ if exec_prefix :
212+ os .environ ['RTT_EXEC_PREFIX' ] = exec_prefix
213+
210214 # auto change the 'RTT_EXEC_PATH' when 'rtconfig.EXEC_PATH' get failed
211215 if not os .path .exists (rtconfig .EXEC_PATH ):
212216 if 'RTT_EXEC_PATH' in os .environ :
213217 # del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
214218 del os .environ ['RTT_EXEC_PATH' ]
215- utils .ReloadModule (rtconfig )
216219
217220 exec_path = GetOption ('exec-path' )
218221 if exec_path :
219222 os .environ ['RTT_EXEC_PATH' ] = exec_path
220- utils .ReloadModule (rtconfig )
223+
224+ utils .ReloadModule (rtconfig ) # update environment variables to rtconfig.py
225+
226+ # some env variables have loaded in SConsctruct Environment() before re-load rtconfig.py;
227+ # after update rtconfig.py's variables, those env variables need to synchronize
228+ if exec_prefix :
229+ env ['CC' ] = rtconfig .CC
230+ env ['CXX' ] = rtconfig .CXX
231+ env ['AS' ] = rtconfig .AS
232+ env ['AR' ] = rtconfig .AR
233+ env ['LINK' ] = rtconfig .LINK
234+ if exec_path :
235+ env .PrependENVPath ('PATH' , rtconfig .EXEC_PATH )
221236
222237 # add compability with Keil MDK 4.6 which changes the directory of armcc.exe
223238 if rtconfig .PLATFORM in ['armcc' , 'armclang' ]:
@@ -313,12 +328,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
313328
314329 if GetOption ('pyconfig_silent' ):
315330 from menuconfig import guiconfig_silent
316-
317331 guiconfig_silent (Rtt_Root )
318332 exit (0 )
333+
319334 elif GetOption ('pyconfig' ):
320335 from menuconfig import guiconfig
321-
322336 guiconfig (Rtt_Root )
323337 exit (0 )
324338
0 commit comments