Skip to content

Commit 87e203b

Browse files
Create separate build subdirectory for each build profile.
1 parent 667814f commit 87e203b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

mbed/mbed.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,10 +2497,23 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
24972497

24982498
build_path = build
24992499

2500+
def safe_append_profile_to_build_path(bp):
2501+
if profile:
2502+
if isinstance(profile, basestring):
2503+
append_str = profile
2504+
else:
2505+
append_str = profile[0]
2506+
2507+
if append_str:
2508+
bp = os.path.join(bp, os.path.splitext(os.path.basename(append_str))[0].upper())
2509+
2510+
return bp
2511+
25002512
if compile_library:
25012513
# Compile as a library (current dir is default)
25022514
if not build_path:
25032515
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())
2516+
build_path = safe_append_profile_to_build_path(build_path)
25042517

25052518
popen([python_cmd, '-u', os.path.join(tools_dir, 'build.py')]
25062519
+ list(chain.from_iterable(zip(repeat('-D'), macros)))
@@ -2517,6 +2530,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
25172530
# Compile as application (root is default)
25182531
if not build_path:
25192532
build_path = os.path.join(os.path.relpath(program.path, orig_path), program.build_dir, target.upper(), tchain.upper())
2533+
build_path = safe_append_profile_to_build_path(build_path)
25202534

25212535
popen([python_cmd, '-u', os.path.join(tools_dir, 'make.py')]
25222536
+ list(chain.from_iterable(zip(repeat('-D'), macros)))

0 commit comments

Comments
 (0)