Skip to content

Commit 34d7f6c

Browse files
committed
Parse deps the same for GCC_ARM and ARMC6
1 parent 90a9631 commit 34d7f6c

File tree

3 files changed

+14
-27
lines changed

3 files changed

+14
-27
lines changed

tools/toolchains/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,6 @@ def compile_command(self, source, object, includes):
10301030

10311031
return None
10321032

1033-
@abstractmethod
10341033
def parse_dependencies(self, dep_path):
10351034
"""Parse the dependency information generated by the compiler.
10361035
@@ -1042,8 +1041,21 @@ def parse_dependencies(self, dep_path):
10421041
10431042
Side effects:
10441043
None
1044+
1045+
Note: A default implementation is provided for make-like file formats
10451046
"""
1046-
raise NotImplemented
1047+
dependencies = []
1048+
buff = open(dep_path).readlines()
1049+
if buff:
1050+
buff[0] = re.sub('^(.*?)\: ', '', buff[0])
1051+
for line in buff:
1052+
filename = line.replace('\\\n', '').strip()
1053+
if file:
1054+
filename = filename.replace('\\ ', '\a')
1055+
dependencies.extend(((self.CHROOT if self.CHROOT else '') +
1056+
f.replace('\a', ' '))
1057+
for f in filename.split(" "))
1058+
return list(filter(None, dependencies))
10471059

10481060
def is_not_supported_error(self, output):
10491061
return "#error directive: [NOT_SUPPORTED]" in output

tools/toolchains/arm.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ def __init__(self, target, *args, **kwargs):
8585
self.ar = [join(ARMC6_PATH, "armar")]
8686
self.elf2bin = join(ARMC6_PATH, "fromelf")
8787

88-
89-
def parse_dependencies(self, dep_path):
90-
return []
91-
9288
def parse_output(self, output):
9389
pass
9490

tools/toolchains/gcc.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,6 @@ def __init__(self, target, notify=None, macros=None,
100100
self.ar = join(tool_path, "arm-none-eabi-ar")
101101
self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
102102

103-
def parse_dependencies(self, dep_path):
104-
dependencies = []
105-
buff = open(dep_path).readlines()
106-
buff[0] = re.sub('^(.*?)\: ', '', buff[0])
107-
for line in buff:
108-
file = line.replace('\\\n', '').strip()
109-
if file:
110-
# GCC might list more than one dependency on a single line, in this case
111-
# the dependencies are separated by a space. However, a space might also
112-
# indicate an actual space character in a dependency path, but in this case
113-
# the space character is prefixed by a backslash.
114-
# Temporary replace all '\ ' with a special char that is not used (\a in this
115-
# case) to keep them from being interpreted by 'split' (they will be converted
116-
# back later to a space char)
117-
file = file.replace('\\ ', '\a')
118-
if file.find(" ") == -1:
119-
dependencies.append((self.CHROOT if self.CHROOT else '') + file.replace('\a', ' '))
120-
else:
121-
dependencies = dependencies + [(self.CHROOT if self.CHROOT else '') + f.replace('\a', ' ') for f in file.split(" ")]
122-
return dependencies
123-
124103
def is_not_supported_error(self, output):
125104
return "error: #error [NOT_SUPPORTED]" in output
126105

0 commit comments

Comments
 (0)