Switch dependencies to their respective CIL flags

pull/4331/head
Jimmy Brisson 2017-05-16 15:48:45 -05:00
parent 5152c1c7ac
commit 3123a1d394
1 changed files with 20 additions and 10 deletions

View File

@ -914,8 +914,11 @@ class mbedToolchain:
deps = [] deps = []
config_file = ([self.config.app_config_location] config_file = ([self.config.app_config_location]
if self.config.app_config_location else []) if self.config.app_config_location else [])
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME))
deps.append(config_file) deps.append(config_file)
if ext == '.cpp' or self.COMPILE_C_AS_CPP:
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-cxx"))
else:
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-c"))
if len(deps) == 0 or self.need_update(object, deps): if len(deps) == 0 or self.need_update(object, deps):
if ext == '.cpp' or self.COMPILE_C_AS_CPP: if ext == '.cpp' or self.COMPILE_C_AS_CPP:
return self.compile_cpp(source, object, includes) return self.compile_cpp(source, object, includes)
@ -923,7 +926,7 @@ class mbedToolchain:
return self.compile_c(source, object, includes) return self.compile_c(source, object, includes)
elif ext == '.s': elif ext == '.s':
deps = [source] deps = [source]
deps.append(join(self.build_dir, self.PROFILE_FILE_NAME)) deps.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-asm"))
if self.need_update(object, deps): if self.need_update(object, deps):
return self.assemble(source, object, includes) return self.assemble(source, object, includes)
else: else:
@ -1018,8 +1021,9 @@ class mbedToolchain:
r.objects = sorted(set(r.objects)) r.objects = sorted(set(r.objects))
config_file = ([self.config.app_config_location] config_file = ([self.config.app_config_location]
if self.config.app_config_location else []) if self.config.app_config_location else [])
if self.need_update(elf, r.objects + r.libraries + [r.linker_script] + dependencies = r.objects + r.libraries + [r.linker_script, config_file]
config_file): dependencies.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-ld"))
if self.need_update(elf, dependencies):
needed_update = True needed_update = True
self.progress("link", name) self.progress("link", name)
self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script) self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script)
@ -1170,12 +1174,18 @@ class mbedToolchain:
def dump_build_profile(self): def dump_build_profile(self):
"""Dump the current build profile and macros into the `.profile` file """Dump the current build profile and macros into the `.profile` file
in the build directory""" in the build directory"""
to_dump = (str(sorted(list(self.flags.iteritems()))) + for key in ["cxx", "c", "asm", "ld"]:
str(sorted(self.macros))) to_dump = (str(self.flags[key]) + str(sorted(self.macros)))
where = join(self.build_dir, self.PROFILE_FILE_NAME) if key in ["cxx", "c"]:
if not exists(where) or to_dump != open(where).read(): to_dump += str(self.flags['common'])
with open(where, "wb") as out: where = join(self.build_dir, self.PROFILE_FILE_NAME + "-" + key)
out.write(to_dump) self._overwrite_when_not_equal(where, to_dump)
@staticmethod
def _overwrite_when_not_equal(filename, content):
if not exists(filename) or content != open(filename).read():
with open(filename, "wb") as out:
out.write(content)
@staticmethod @staticmethod
def generic_check_executable(tool_key, executable_name, levels_up, def generic_check_executable(tool_key, executable_name, levels_up,