diff options
author | Alex White <alex.white@oarcorp.com> | 2023-08-29 20:21:21 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2023-08-30 11:05:33 -0500 |
commit | cfb8a68f516d1c138bb4e836e717ebc962ba692d (patch) | |
tree | 6899cd1edc3d69f823b1d218ee364b69decc0de2 /wscript | |
parent | microblaze: Add dl05 to expected failures (diff) | |
download | rtems-cfb8a68f516d1c138bb4e836e717ebc962ba692d.tar.bz2 |
build: Allow enabled-by in ldflags for link_cc and link_cxx
This allows for conditionally setting 'ldflags' in scripts that use
`link_cc` and `link_cxx`. The immediate use case is allowing a linker
flag to be used only for MicroBlaze builds of certain tests.
Diffstat (limited to 'wscript')
-rwxr-xr-x | wscript | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -353,10 +353,10 @@ class Item(object): class link(Task): - def __init__(self, item, bic, cmd, env): + def __init__(self, item, bic, cmd, env, ldflags): super(link, self).__init__(self, env=env) self.cmd = cmd - self.ldflags = bic.ldflags + item.data["ldflags"] + self.ldflags = bic.ldflags + ldflags self.stlib = item.data["stlib"] self.use = (item.data["use-before"] + bic.use + item.data["use-after"]) @@ -382,7 +382,14 @@ class Item(object): [], ) - tsk = link(self, bic, cmd, bld.env) + ldflags = [] + for ldflag in self.data["ldflags"]: + if isinstance(ldflag, dict): + if _is_enabled(bld.env.ENABLE, ldflag["enabled-by"]): + ldflags.append(ldflag["value"]) + else: + ldflags.append(ldflag) + tsk = link(self, bic, cmd, bld.env, ldflags) tsk.set_inputs([bld.bldnode.make_node(s) for s in source]) tsk.set_outputs(bld.bldnode.make_node(target)) bld.add_to_group(tsk) |