@@ -731,6 +731,9 @@ def build_library(src_paths, build_path, target, toolchain_name,
731
731
### Legacy methods ###
732
732
######################
733
733
734
+ def mbed2_obj_path (target_name , toolchain_name ):
735
+ return join ("TARGET_" + target_name , "TOOLCHAIN_" + toolchain_name )
736
+
734
737
def build_lib (lib_id , target , toolchain_name , verbose = False ,
735
738
clean = False , macros = None , notify = None , jobs = 1 , silent = False ,
736
739
report = None , properties = None , extra_verbose = False ,
@@ -807,20 +810,23 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
807
810
808
811
try :
809
812
# Toolchain instance
810
- toolchain = TOOLCHAIN_CLASSES [toolchain_name ](
811
- target , macros = macros , notify = notify , silent = silent ,
812
- extra_verbose = extra_verbose , build_profile = build_profile )
813
- toolchain .VERBOSE = verbose
814
- toolchain .jobs = jobs
815
- toolchain .build_all = clean
816
- toolchain .build_dir = build_path
813
+ # Create the desired build directory structure
814
+ bin_path = join (build_path , mbed2_obj_path (target .name , toolchain_name ))
815
+ mkdir (bin_path )
816
+ tmp_path = join (build_path , '.temp' , mbed2_obj_path (target .name ,
817
+ toolchain_name ))
818
+ mkdir (tmp_path )
819
+
820
+ toolchain = prepare_toolchain (
821
+ src_paths , tmp_path , target , toolchain_name , macros = macros ,
822
+ notify = notify , silent = silent , extra_verbose = extra_verbose ,
823
+ build_profile = build_profile , jobs = jobs , clean = clean )
817
824
818
825
toolchain .info ("Building library %s (%s, %s)" %
819
826
(name .upper (), target .name , toolchain_name ))
820
827
821
828
# Take into account the library configuration (MBED_CONFIG_FILE)
822
- config = Config (target )
823
- toolchain .config = config
829
+ config = toolchain .config
824
830
config .add_config_files ([MBED_CONFIG_FILE ])
825
831
826
832
# Scan Resources
@@ -851,11 +857,6 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
851
857
config .load_resources (res )
852
858
toolchain .set_config_data (toolchain .config .get_config_data ())
853
859
854
- # Create the desired build directory structure
855
- bin_path = join (build_path , toolchain .obj_path )
856
- mkdir (bin_path )
857
- tmp_path = join (build_path , '.temp' , toolchain .obj_path )
858
- mkdir (tmp_path )
859
860
860
861
# Copy Headers
861
862
for resource in resources :
@@ -952,31 +953,25 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
952
953
return False
953
954
954
955
try :
955
- # Toolchain
956
- toolchain = TOOLCHAIN_CLASSES [toolchain_name ](
957
- target , macros = macros , notify = notify , silent = silent ,
958
- extra_verbose = extra_verbose , build_profile = build_profile )
959
- toolchain .VERBOSE = verbose
960
- toolchain .jobs = jobs
961
- toolchain .build_all = clean
956
+ # Source and Build Paths
957
+ build_target = join (MBED_LIBRARIES , "TARGET_" + target .name )
958
+ build_toolchain = join (build_target , "TOOLCHAIN_" + toolchain_name )
959
+ mkdir (build_toolchain )
962
960
963
- tmp_path = join (MBED_LIBRARIES , '.temp' , toolchain .obj_path )
961
+ # Toolchain
962
+ tmp_path = join (MBED_LIBRARIES , '.temp' , mbed2_obj_path (target .name , toolchain_name ))
964
963
mkdir (tmp_path )
965
964
966
- toolchain .build_dir = tmp_path
965
+ toolchain = prepare_toolchain (
966
+ ["" ], tmp_path , target , toolchain_name , macros = macros ,
967
+ notify = notify , silent = silent , extra_verbose = extra_verbose ,
968
+ build_profile = build_profile , jobs = jobs , clean = clean )
967
969
968
970
# Take into account the library configuration (MBED_CONFIG_FILE)
969
- config = Config (target )
970
- toolchain .config = config
971
+ config = toolchain .config
971
972
config .add_config_files ([MBED_CONFIG_FILE ])
972
973
toolchain .set_config_data (toolchain .config .get_config_data ())
973
974
974
- # Source and Build Paths
975
- build_target = join (MBED_LIBRARIES , "TARGET_" + target .name )
976
- build_toolchain = join (build_target , "TOOLCHAIN_" + toolchain .name )
977
- mkdir (build_toolchain )
978
-
979
-
980
975
# CMSIS
981
976
toolchain .info ("Building library %s (%s, %s)" %
982
977
('CMSIS' , target .name , toolchain_name ))
0 commit comments