Skip to content

Commit 1ee1150

Browse files
committed
Merge pull request #2 from mjs-arm/merge-from-classic
Merge from classic
2 parents f040936 + ab0fc59 commit 1ee1150

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

tools/build_api.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from types import ListType
2424
from shutil import rmtree
2525
from os.path import join, exists, basename
26+
from os import getcwd
2627
from time import time
2728

2829
from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException
@@ -91,15 +92,15 @@ def build_project(src_path, build_path, target, toolchain_name,
9192
# We need to remove all paths which are repeated to avoid
9293
# multiple compilations and linking with the same objects
9394
src_paths = [src_paths[0]] + list(set(src_paths[1:]))
94-
PROJECT_BASENAME = basename(src_paths[0])
95+
project_name = basename(src_paths[0] if src_paths[0] != "." and src_paths[0] != "./" else getcwd())
9596

9697
if name is None:
9798
# We will use default project name based on project folder name
98-
name = PROJECT_BASENAME
99-
toolchain.info("Building project %s (%s, %s)" % (PROJECT_BASENAME.upper(), target.name, toolchain_name))
99+
name = project_name
100+
toolchain.info("Building project %s (%s, %s)" % (project_name, target.name, toolchain_name))
100101
else:
101102
# User used custom global project name to have the same name for the
102-
toolchain.info("Building project %s to %s (%s, %s)" % (PROJECT_BASENAME.upper(), name, target.name, toolchain_name))
103+
toolchain.info("Building project %s to %s (%s, %s)" % (project_name, name, target.name, toolchain_name))
103104

104105

105106
if report != None:

tools/make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
parser.add_option("--dep", dest="dependencies",
9595
default=None, help="Dependencies")
9696
parser.add_option("--source", dest="source_dir",
97-
default=None, help="The source (input) directory")
97+
default=None, help="The source (input) directory", action="append")
9898
parser.add_option("--duration", type="int", dest="duration",
9999
default=None, help="Duration of the test")
100100
parser.add_option("--build", dest="build_dir",

tools/toolchains/__init__.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import re
1919
import sys
20-
from os import stat, walk
20+
from os import stat, walk, getcwd
2121
from copy import copy
2222
from time import time, sleep
2323
from types import ListType
@@ -216,6 +216,9 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
216216
self.CHROOT = None
217217

218218
self.mp_pool = None
219+
220+
if 'UVISOR_PRESENT' in self.macros:
221+
self.target.core = re.sub(r"F$", '', self.target.core)
219222

220223
def get_output(self):
221224
return self.output
@@ -363,7 +366,8 @@ def scan_resources(self, path):
363366

364367
if ((d.startswith('.') or d in self.legacy_ignore_dirs) or
365368
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
366-
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN'])):
369+
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
370+
(d == 'TESTS')):
367371
dirs.remove(d)
368372

369373
# Add root to include paths
@@ -456,7 +460,13 @@ def copy_files(self, files_paths, trg_path, rel_path=None):
456460

457461
def relative_object_path(self, build_path, base_dir, source):
458462
source_dir, name, _ = split_path(source)
459-
obj_dir = join(build_path, relpath(source_dir, base_dir))
463+
464+
if build_path.startswith(base_dir):
465+
# absolute path
466+
obj_dir = join(build_path, relpath(source_dir, base_dir))
467+
else:
468+
# relative path
469+
obj_dir = join(base_dir, build_path)
460470
mkdir(obj_dir)
461471
return join(obj_dir, name + '.o')
462472

@@ -481,16 +491,12 @@ def compile_sources(self, resources, build_path, inc_dirs=None):
481491
# The dependency checking for C/C++ is delegated to the compiler
482492
base_path = resources.base_path
483493
files_to_compile.sort()
494+
work_dir = getcwd()
495+
484496
for source in files_to_compile:
485497
_, name, _ = split_path(source)
486498
object = self.relative_object_path(build_path, base_path, source)
487499

488-
# Avoid multiple mkdir() calls on same work directory
489-
work_dir = dirname(object)
490-
if work_dir is not prev_dir:
491-
prev_dir = work_dir
492-
mkdir(work_dir)
493-
494500
# Queue mode (multiprocessing)
495501
commands = self.compile_command(source, object, inc_paths)
496502
if commands is not None:

0 commit comments

Comments
 (0)