Skip to content

Commit acc6143

Browse files
author
Cruz Monrreal
authored
Merge pull request ARMmbed#7646 from theotherjimmy/fix-incr
Tools: Fix incrimental compile dep tracking
2 parents 4619820 + 9a991b4 commit acc6143

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

tools/config/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,10 +1124,14 @@ def config_to_header(config, fname=None):
11241124
Config._check_required_parameters(params)
11251125
params_with_values = [p for p in params.values() if p.value is not None]
11261126
ctx = {
1127-
"cfg_params" : [(p.macro_name, str(p.value), p.set_by)
1128-
for p in params_with_values],
1129-
"macros": [(m.macro_name, str(m.macro_value or ""), m.defined_by)
1130-
for m in macros.values()],
1127+
"cfg_params": sorted([
1128+
(p.macro_name, str(p.value), p.set_by)
1129+
for p in params_with_values
1130+
]),
1131+
"macros": sorted([
1132+
(m.macro_name, str(m.macro_value or ""), m.defined_by)
1133+
for m in macros.values()
1134+
]),
11311135
"name_len": max([len(m.macro_name) for m in macros.values()] +
11321136
[len(m.macro_name) for m in params_with_values]
11331137
+ [0]),

tools/toolchains/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,17 @@ def make_option_file(self, options, naming=".options_{}.txt"):
312312
""" Generate a via file for a pile of defines
313313
ARM, GCC, IAR cross compatible
314314
"""
315-
option_md5 = md5(' '.join(options).encode('utf-8')).hexdigest()
316-
via_file = join(self.build_dir, naming.format(option_md5))
317-
if not exists(via_file):
315+
to_write = " ".join(options).encode('utf-8')
316+
new_md5 = md5(to_write).hexdigest()
317+
via_file = join(self.build_dir, naming.format(new_md5))
318+
try:
319+
with open(via_file, "r") as fd:
320+
old_md5 = md5(fd.read().encode('utf-8')).hexdigest()
321+
except IOError:
322+
old_md5 = None
323+
if old_md5 != new_md5:
318324
with open(via_file, "w") as fd:
319-
string = " ".join(options)
320-
fd.write(string)
325+
fd.write(to_write)
321326
return via_file
322327

323328
def get_inc_file(self, includes):

0 commit comments

Comments
 (0)