@@ -2433,6 +2433,21 @@ def status_(ignore=False):
2433
2433
status_ (ignore )
2434
2434
2435
2435
2436
+ # Helper function for compile subcommand
2437
+ def _safe_append_profile_to_build_path (build_path , profile ):
2438
+ append_str = 'DEFAULT'
2439
+
2440
+ if profile :
2441
+ if isinstance (profile , basestring ):
2442
+ append_str = profile
2443
+ else :
2444
+ append_str = profile [0 ]
2445
+
2446
+ build_path = os .path .join (build_path , os .path .splitext (os .path .basename (append_str ))[0 ].upper ())
2447
+
2448
+ return build_path
2449
+
2450
+
2436
2451
# Compile command which invokes the mbed OS native build system
2437
2452
@subcommand ('compile' ,
2438
2453
dict (name = ['-t' , '--toolchain' ], help = 'Compile toolchain. Example: ARM, GCC_ARM, IAR' ),
@@ -2501,6 +2516,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2501
2516
# Compile as a library (current dir is default)
2502
2517
if not build_path :
2503
2518
build_path = os .path .join (os .path .relpath (program .path , orig_path ), program .build_dir , 'libraries' , os .path .basename (orig_path ), target .upper (), tchain .upper ())
2519
+ build_path = _safe_append_profile_to_build_path (build_path , profile )
2504
2520
2505
2521
popen ([python_cmd , '-u' , os .path .join (tools_dir , 'build.py' )]
2506
2522
+ list (chain .from_iterable (zip (repeat ('-D' ), macros )))
@@ -2517,6 +2533,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2517
2533
# Compile as application (root is default)
2518
2534
if not build_path :
2519
2535
build_path = os .path .join (os .path .relpath (program .path , orig_path ), program .build_dir , target .upper (), tchain .upper ())
2536
+ build_path = _safe_append_profile_to_build_path (build_path , profile )
2520
2537
2521
2538
popen ([python_cmd , '-u' , os .path .join (tools_dir , 'make.py' )]
2522
2539
+ list (chain .from_iterable (zip (repeat ('-D' ), macros )))
0 commit comments