Skip to content

Commit 3123a1d

Browse files
committed
Switch dependencies to their respective CIL flags
1 parent 5152c1c commit 3123a1d

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

tools/toolchains/__init__.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -914,16 +914,19 @@ def compile_command(self, source, object, includes):
914914
deps = []
915915
config_file = ([self.config.app_config_location]
916916
if self.config.app_config_location else [])
917-
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME))
918917
deps.append(config_file)
918+
if ext == '.cpp' or self.COMPILE_C_AS_CPP:
919+
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-cxx"))
920+
else:
921+
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-c"))
919922
if len(deps) == 0 or self.need_update(object, deps):
920923
if ext == '.cpp' or self.COMPILE_C_AS_CPP:
921924
return self.compile_cpp(source, object, includes)
922925
else:
923926
return self.compile_c(source, object, includes)
924927
elif ext == '.s':
925928
deps = [source]
926-
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME))
929+
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-asm"))
927930
if self.need_update(object, deps):
928931
return self.assemble(source, object, includes)
929932
else:
@@ -1018,8 +1021,9 @@ def link_program(self, r, tmp_path, name):
10181021
r.objects = sorted(set(r.objects))
10191022
config_file = ([self.config.app_config_location]
10201023
if self.config.app_config_location else [])
1021-
if self.need_update(elf, r.objects + r.libraries + [r.linker_script] +
1022-
config_file):
1024+
dependencies = r.objects + r.libraries + [r.linker_script, config_file]
1025+
dependencies.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-ld"))
1026+
if self.need_update(elf, dependencies):
10231027
needed_update = True
10241028
self.progress("link", name)
10251029
self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script)
@@ -1170,12 +1174,18 @@ def get_config_header(self):
11701174
def dump_build_profile(self):
11711175
"""Dump the current build profile and macros into the `.profile` file
11721176
in the build directory"""
1173-
to_dump = (str(sorted(list(self.flags.iteritems()))) +
1174-
str(sorted(self.macros)))
1175-
where = join(self.build_dir, self.PROFILE_FILE_NAME)
1176-
if not exists(where) or to_dump != open(where).read():
1177-
with open(where, "wb") as out:
1178-
out.write(to_dump)
1177+
for key in ["cxx", "c", "asm", "ld"]:
1178+
to_dump = (str(self.flags[key]) + str(sorted(self.macros)))
1179+
if key in ["cxx", "c"]:
1180+
to_dump += str(self.flags['common'])
1181+
where = join(self.build_dir, self.PROFILE_FILE_NAME + "-" + key)
1182+
self._overwrite_when_not_equal(where, to_dump)
1183+
1184+
@staticmethod
1185+
def _overwrite_when_not_equal(filename, content):
1186+
if not exists(filename) or content != open(filename).read():
1187+
with open(filename, "wb") as out:
1188+
out.write(content)
11791189

11801190
@staticmethod
11811191
def generic_check_executable(tool_key, executable_name, levels_up,

0 commit comments

Comments
 (0)