19
19
import tempfile
20
20
from types import ListType
21
21
from shutil import rmtree
22
- from os .path import join , exists , basename , abspath , normpath
22
+ from os .path import join , exists , dirname , basename , abspath , normpath
23
23
from os import linesep , remove
24
24
from time import time
25
25
@@ -755,6 +755,7 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
755
755
for path in dependencies_paths :
756
756
lib_resources = toolchain .scan_resources (path )
757
757
dependencies_include_dir .extend (lib_resources .inc_dirs )
758
+ dependencies_include_dir .extend (map (dirname , lib_resources .inc_dirs ))
758
759
759
760
if inc_dirs :
760
761
dependencies_include_dir .extend (inc_dirs )
@@ -774,8 +775,6 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
774
775
for resource in resources :
775
776
toolchain .copy_files (resource .headers , build_path ,
776
777
resources = resource )
777
- toolchain .copy_files (resource .headers , join (build_path , name ),
778
- resources = resource )
779
778
780
779
dependencies_include_dir .extend (
781
780
toolchain .scan_resources (build_path ).inc_dirs )
@@ -909,12 +908,14 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
909
908
910
909
# Common Headers
911
910
toolchain .copy_files ([MBED_HEADER ], MBED_LIBRARIES )
911
+ library_incdirs = [dirname (MBED_LIBRARIES ), MBED_LIBRARIES ]
912
+
912
913
for dir , dest in [(MBED_DRIVERS , MBED_LIBRARIES_DRIVERS ),
913
914
(MBED_PLATFORM , MBED_LIBRARIES_PLATFORM ),
914
915
(MBED_HAL , MBED_LIBRARIES_HAL )]:
915
916
resources = toolchain .scan_resources (dir )
916
- toolchain .copy_files (resources .headers , MBED_LIBRARIES )
917
917
toolchain .copy_files (resources .headers , dest )
918
+ library_incdirs .append (dest )
918
919
919
920
# Target specific sources
920
921
hal_src = MBED_TARGETS_PATH
@@ -926,15 +927,15 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
926
927
build_target , resources = hal_implementation )
927
928
incdirs = toolchain .scan_resources (build_target ).inc_dirs
928
929
objects = toolchain .compile_sources (hal_implementation , tmp_path ,
929
- [ MBED_LIBRARIES ] + incdirs )
930
+ library_incdirs + incdirs )
930
931
931
932
# Common Sources
932
933
mbed_resources = None
933
934
for dir in [MBED_DRIVERS , MBED_PLATFORM , MBED_HAL ]:
934
935
mbed_resources += toolchain .scan_resources (dir )
935
936
936
937
objects += toolchain .compile_sources (mbed_resources , tmp_path ,
937
- [ MBED_LIBRARIES ] + incdirs )
938
+ library_incdirs + incdirs )
938
939
939
940
# A number of compiled files need to be copied as objects as opposed to
940
941
# way the linker search for symbols in archives. These are:
0 commit comments