@@ -336,16 +336,6 @@ def build_library(src_paths, build_path, target, toolchain_name,
336336 for path in src_paths :
337337 # Scan resources
338338 resource = toolchain .scan_resources (path )
339-
340- # Copy headers, objects and static libraries - all files needed for static lib
341- toolchain .copy_files (resource .headers , build_path , rel_path = resource .base_path )
342- toolchain .copy_files (resource .objects , build_path , rel_path = resource .base_path )
343- toolchain .copy_files (resource .libraries , build_path , rel_path = resource .base_path )
344- if resource .linker_script :
345- toolchain .copy_files (resource .linker_script , build_path , rel_path = resource .base_path )
346-
347- if resource .hex_files :
348- toolchain .copy_files (resource .hex_files , build_path , rel_path = resource .base_path )
349339
350340 # Extend resources collection
351341 if not resources :
@@ -404,6 +394,16 @@ def build_library(src_paths, build_path, target, toolchain_name,
404394 # And add the configuration macros to the toolchain
405395 toolchain .add_macros (config .get_config_data_macros ())
406396
397+ # Copy headers, objects and static libraries - all files needed for static lib
398+ toolchain .copy_files (resources .headers , build_path , resources = resources )
399+ toolchain .copy_files (resources .objects , build_path , resources = resources )
400+ toolchain .copy_files (resources .libraries , build_path , resources = resources )
401+ if resources .linker_script :
402+ toolchain .copy_files (resources .linker_script , build_path , resources = resources )
403+
404+ if resource .hex_files :
405+ toolchain .copy_files (resources .hex_files , build_path , resources = resources )
406+
407407 # Compile Sources
408408 objects = toolchain .compile_sources (resources , abspath (tmp_path ), resources .inc_dirs )
409409 resources .objects .extend (objects )
@@ -544,7 +544,7 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean
544544
545545 # Copy Headers
546546 for resource in resources :
547- toolchain .copy_files (resource .headers , build_path , rel_path = resource . base_path )
547+ toolchain .copy_files (resource .headers , build_path , resources = resource )
548548
549549 dependencies_include_dir .extend (toolchain .scan_resources (build_path ).inc_dirs )
550550
@@ -643,7 +643,7 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
643643 # Target specific sources
644644 HAL_SRC = join (MBED_TARGETS_PATH , "hal" )
645645 hal_implementation = toolchain .scan_resources (HAL_SRC )
646- toolchain .copy_files (hal_implementation .headers + hal_implementation .hex_files + hal_implementation .libraries , BUILD_TARGET , HAL_SRC )
646+ toolchain .copy_files (hal_implementation .headers + hal_implementation .hex_files + hal_implementation .libraries , BUILD_TARGET , resources = hal_implementation )
647647 incdirs = toolchain .scan_resources (BUILD_TARGET ).inc_dirs
648648 objects = toolchain .compile_sources (hal_implementation , TMP_PATH , [MBED_LIBRARIES ] + incdirs )
649649
@@ -821,7 +821,7 @@ def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORM
821821 hal_implementation = toolchain .scan_resources (HAL_SRC )
822822
823823 # Copy files before analysis
824- toolchain .copy_files (hal_implementation .headers + hal_implementation .hex_files , BUILD_TARGET , HAL_SRC )
824+ toolchain .copy_files (hal_implementation .headers + hal_implementation .hex_files , BUILD_TARGET , resources = hal_implementation )
825825 incdirs = toolchain .scan_resources (BUILD_TARGET )
826826
827827 target_includes = ["-I%s" % i for i in incdirs .inc_dirs ]
@@ -925,7 +925,7 @@ def static_analysis_scan_library(src_paths, build_path, target, toolchain_name,
925925
926926 # Copy Headers
927927 for resource in resources :
928- toolchain .copy_files (resource .headers , build_path , rel_path = resource . base_path )
928+ toolchain .copy_files (resource .headers , build_path , resources = resource )
929929 includes += ["-I%s" % i for i in resource .inc_dirs ]
930930 c_sources += " " .join (resource .c_sources ) + " "
931931 cpp_sources += " " .join (resource .cpp_sources ) + " "
0 commit comments