17
17
18
18
import re
19
19
import sys
20
- from os import stat , walk
20
+ from os import stat , walk , getcwd
21
21
from copy import copy
22
22
from time import time , sleep
23
23
from types import ListType
@@ -216,6 +216,9 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
216
216
self .CHROOT = None
217
217
218
218
self .mp_pool = None
219
+
220
+ if 'UVISOR_PRESENT' in self .macros :
221
+ self .target .core = re .sub (r"F$" , '' , self .target .core )
219
222
220
223
def get_output (self ):
221
224
return self .output
@@ -363,7 +366,8 @@ def scan_resources(self, path):
363
366
364
367
if ((d .startswith ('.' ) or d in self .legacy_ignore_dirs ) or
365
368
(d .startswith ('TARGET_' ) and d [7 :] not in labels ['TARGET' ]) or
366
- (d .startswith ('TOOLCHAIN_' ) and d [10 :] not in labels ['TOOLCHAIN' ])):
369
+ (d .startswith ('TOOLCHAIN_' ) and d [10 :] not in labels ['TOOLCHAIN' ]) or
370
+ (d == 'TESTS' )):
367
371
dirs .remove (d )
368
372
369
373
# Add root to include paths
@@ -456,7 +460,13 @@ def copy_files(self, files_paths, trg_path, rel_path=None):
456
460
457
461
def relative_object_path (self , build_path , base_dir , source ):
458
462
source_dir , name , _ = split_path (source )
459
- obj_dir = join (build_path , relpath (source_dir , base_dir ))
463
+
464
+ if build_path .startswith (base_dir ):
465
+ # absolute path
466
+ obj_dir = join (build_path , relpath (source_dir , base_dir ))
467
+ else :
468
+ # relative path
469
+ obj_dir = join (base_dir , build_path )
460
470
mkdir (obj_dir )
461
471
return join (obj_dir , name + '.o' )
462
472
@@ -481,16 +491,12 @@ def compile_sources(self, resources, build_path, inc_dirs=None):
481
491
# The dependency checking for C/C++ is delegated to the compiler
482
492
base_path = resources .base_path
483
493
files_to_compile .sort ()
494
+ work_dir = getcwd ()
495
+
484
496
for source in files_to_compile :
485
497
_ , name , _ = split_path (source )
486
498
object = self .relative_object_path (build_path , base_path , source )
487
499
488
- # Avoid multiple mkdir() calls on same work directory
489
- work_dir = dirname (object )
490
- if work_dir is not prev_dir :
491
- prev_dir = work_dir
492
- mkdir (work_dir )
493
-
494
500
# Queue mode (multiprocessing)
495
501
commands = self .compile_command (source , object , inc_paths )
496
502
if commands is not None :
0 commit comments