Skip to content

Commit 14a9824

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Merge branch 'root-include-path' of ssh://github.com/theotherjimmy/mbed into rollup
2 parents 20fc4da + 95e2b07 commit 14a9824

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

tools/resources/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,26 +261,26 @@ def get_file_refs(self, file_type):
261261
return list(self._file_refs[file_type])
262262

263263
def _all_parents(self, files):
264-
for name in files:
264+
for name, path in files:
265265
components = name.split(self._sep)
266-
start_at = 2 if components[0] in set(['', '.']) else 1
267-
for index, directory in reversed(list(enumerate(components))[start_at:]):
266+
start_at = 0
267+
for index, directory in reversed(list(enumerate(components))):
268268
if directory in self._prefixed_labels:
269269
start_at = index + 1
270270
break
271+
prefix = path.replace(name, "")
271272
for n in range(start_at, len(components)):
272-
parent = self._sep.join(components[:n])
273-
yield parent
273+
parent_name = self._sep.join(components[:n])
274+
parent_path = join(prefix, *components[:n])
275+
yield FileRef(parent_name, parent_path)
274276

275277
def _get_from_refs(self, file_type, key):
276278
if file_type is FileType.INC_DIR:
277-
parents = set(self._all_parents(self._get_from_refs(
278-
FileType.HEADER, key)))
279-
parents.add(".")
279+
parents = set(self._all_parents(self._file_refs[FileType.HEADER]))
280280
else:
281281
parents = set()
282282
return sorted(
283-
list(parents) + [key(f) for f in self.get_file_refs(file_type)]
283+
[key(f) for f in list(parents) + self.get_file_refs(file_type)]
284284
)
285285

286286

tools/toolchains/arm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def get_compile_options(self, defines, includes, for_asm=False):
188188
if self.RESPONSE_FILES:
189189
opts += ['--via', self.get_inc_file(includes)]
190190
else:
191-
opts += ["-I%s" % i for i in includes]
191+
opts += ["-I%s" % i for i in includes if i]
192192

193193
return opts
194194

@@ -474,7 +474,7 @@ def get_config_option(self, config_header):
474474

475475
def get_compile_options(self, defines, includes, for_asm=False):
476476
opts = ['-D%s' % d for d in defines]
477-
opts.extend(["-I%s" % i for i in includes])
477+
opts.extend(["-I%s" % i for i in includes if i])
478478
if for_asm:
479479
return ["--cpreproc",
480480
"--cpreproc_opts=%s" % ",".join(self.flags['common'] + opts)]

0 commit comments

Comments
 (0)