[PATCH] build: Fix dependencies for start and asm files
Chris Johns
chrisj at rtems.org
Thu Sep 17 06:07:06 UTC 2020
On 17/9/20 3:57 pm, Sebastian Huber wrote:
> Add explicit asm target feature. Add a build start file node list and
> use it as a test program dependency.
>
> Close #3846.
> Close #4080.
> ---
> wscript | 41 ++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 36 insertions(+), 5 deletions(-)
>
> diff --git a/wscript b/wscript
> index 2e42918ebb..d47f25c094 100755
> --- a/wscript
> +++ b/wscript
> @@ -40,6 +40,8 @@ try:
> except:
> import ConfigParser as configparser
>
> +from waflib.TaskGen import after, before_method, feature
> +
> is_windows_host = os.name == "nt" or sys.platform in ["msys", "cygwin"]
> default_prefix = "/opt/rtems/6"
> compilers = ["gcc", "clang"]
> @@ -149,6 +151,31 @@ def _is_enabled(enabled, enabled_by):
> return enabled_by in enabled
>
>
> +def _explicit_asm_target(self, node):
> + task = self.create_task(
> + "asm", node, self.bld.bldnode.make_node(self.target)
> + )
> + try:
> + self.compiled_tasks.append(task)
> + except AttributeError:
> + self.compiled_tasks = [task]
> + return task
> +
> +
> + at feature("explicit_asm_target")
explicit_asm?
> + at before_method("process_source")
> +def _enable_explicit_asm_target(self):
> + self.mappings = dict(self.mappings) # Copy
> + self.mappings[".S"] = _explicit_asm_target
> +
> +
> + at after("apply_link")
> + at feature("cprogram", "cxxprogram")
> +def process_start_files(self):
> + if getattr(self, "start_files", False):
> + self.link_task.dep_nodes.extend(self.bld.start_files)
> +
> +
> class Item(object):
> def __init__(self, uid, data):
> self.uid = uid
> @@ -246,12 +273,10 @@ class Item(object):
> target = os.path.splitext(source)[0] + ".o"
> bld(
> asflags=self.data["asflags"],
> - before=["cstlib"],
> cppflags=cppflags + self.data["cppflags"],
> - features="asm c",
> + features="explicit_asm_target asm c",
I think ...
features="explicit_asm asm c",
... reads better.
Chris
> includes=bic.includes + self.data["includes"],
> - rule="${CC} ${ASFLAGS} ${CPPFLAGS} ${DEFINES_ST:DEFINES} ${CPPPATH_ST:INCPATHS} -c ${SRC[0]} -o ${TGT}",
> - source=[source] + deps,
> + source=source + deps,
> target=target,
> )
> return target
> @@ -532,7 +557,12 @@ class StartFileItem(Item):
> super(StartFileItem, self).__init__(uid, data)
>
> def do_build(self, bld, bic):
> - self.asm(bld, bic, self.data["source"], self.get(bld, "target"))
> + tgt = self.asm(bld, bic, self.data["source"], self.get(bld, "target"))
> + node = bld.bldnode.make_node(tgt)
> + try:
> + bld.start_files.append(node)
> + except AttributeError:
> + bld.start_files = [node]
> self.install_target(bld)
>
>
> @@ -626,6 +656,7 @@ class TestProgramItem(Item):
> install_path=None,
> ldflags=bic.ldflags + self.data["ldflags"],
> source=self.data["source"],
> + start_files=True,
> stlib=self.data["stlib"],
> target=self.get(bld, "target"),
> use=self.data["use-before"] + bic.use + self.data["use-after"],
>
More information about the devel
mailing list