1717
1818import re
1919import sys
20- from os import stat , walk
20+ from os import stat , walk , getcwd
2121from copy import copy
2222from time import time , sleep
2323from types import ListType
@@ -216,6 +216,9 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
216216 self .CHROOT = None
217217
218218 self .mp_pool = None
219+
220+ if 'UVISOR_PRESENT' in self .macros :
221+ self .target .core = re .sub (r"F$" , '' , self .target .core )
219222
220223 def get_output (self ):
221224 return self .output
@@ -363,7 +366,8 @@ def scan_resources(self, path):
363366
364367 if ((d .startswith ('.' ) or d in self .legacy_ignore_dirs ) or
365368 (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' )):
367371 dirs .remove (d )
368372
369373 # Add root to include paths
@@ -456,7 +460,13 @@ def copy_files(self, files_paths, trg_path, rel_path=None):
456460
457461 def relative_object_path (self , build_path , base_dir , source ):
458462 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 )
460470 mkdir (obj_dir )
461471 return join (obj_dir , name + '.o' )
462472
@@ -481,16 +491,12 @@ def compile_sources(self, resources, build_path, inc_dirs=None):
481491 # The dependency checking for C/C++ is delegated to the compiler
482492 base_path = resources .base_path
483493 files_to_compile .sort ()
494+ work_dir = getcwd ()
495+
484496 for source in files_to_compile :
485497 _ , name , _ = split_path (source )
486498 object = self .relative_object_path (build_path , base_path , source )
487499
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-
494500 # Queue mode (multiprocessing)
495501 commands = self .compile_command (source , object , inc_paths )
496502 if commands is not None :
0 commit comments