@@ -731,6 +731,9 @@ def build_library(src_paths, build_path, target, toolchain_name,
731731### Legacy methods ###
732732######################
733733
734+ def mbed2_obj_path (target_name , toolchain_name ):
735+ return join ("TARGET_" + target_name , "TOOLCHAIN_" + toolchain_name )
736+
734737def build_lib (lib_id , target , toolchain_name , verbose = False ,
735738 clean = False , macros = None , notify = None , jobs = 1 , silent = False ,
736739 report = None , properties = None , extra_verbose = False ,
@@ -807,20 +810,23 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
807810
808811 try :
809812 # 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 )
817824
818825 toolchain .info ("Building library %s (%s, %s)" %
819826 (name .upper (), target .name , toolchain_name ))
820827
821828 # Take into account the library configuration (MBED_CONFIG_FILE)
822- config = Config (target )
823- toolchain .config = config
829+ config = toolchain .config
824830 config .add_config_files ([MBED_CONFIG_FILE ])
825831
826832 # Scan Resources
@@ -851,11 +857,6 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
851857 config .load_resources (res )
852858 toolchain .set_config_data (toolchain .config .get_config_data ())
853859
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 )
859860
860861 # Copy Headers
861862 for resource in resources :
@@ -952,31 +953,25 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
952953 return False
953954
954955 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 )
962960
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 ))
964963 mkdir (tmp_path )
965964
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 )
967969
968970 # Take into account the library configuration (MBED_CONFIG_FILE)
969- config = Config (target )
970- toolchain .config = config
971+ config = toolchain .config
971972 config .add_config_files ([MBED_CONFIG_FILE ])
972973 toolchain .set_config_data (toolchain .config .get_config_data ())
973974
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-
980975 # CMSIS
981976 toolchain .info ("Building library %s (%s, %s)" %
982977 ('CMSIS' , target .name , toolchain_name ))
0 commit comments