Allow target to overide rules.
This commit is contained in:
parent
f50a571afa
commit
0bbced54c4
|
@ -289,7 +289,7 @@ def gen(out: TextIO, scope: TargetScope):
|
|||
w.variable(i + "flags", " ".join(rule.args + tool.args))
|
||||
w.rule(
|
||||
i,
|
||||
f"{tool.cmd} {rule.rule.replace('$flags',f'${i}flags')}",
|
||||
f"{tool.cmd} {(tool.rule or rule.rule).replace('$flags',f'${i}flags')}",
|
||||
depfile=rule.deps,
|
||||
)
|
||||
w.newline()
|
||||
|
|
|
@ -248,6 +248,7 @@ class Tool(DataClassJsonMixin):
|
|||
cmd: str = dt.field(default="")
|
||||
args: list[str] = dt.field(default_factory=list)
|
||||
files: list[str] = dt.field(default_factory=list)
|
||||
rule: Optional[str] = None
|
||||
|
||||
|
||||
Tools = dict[str, Tool]
|
||||
|
|
|
@ -51,7 +51,7 @@ rules: dict[str, Rule] = {
|
|||
"ld",
|
||||
["*.o", "*.a"],
|
||||
"*.out",
|
||||
"-o $out $objs -Wl,--whole-archive $wholeLibs -Wl,--no-whole-archive $libs $flags",
|
||||
"-o $out $objs --whole-archive $wholeLibs --no-whole-archive $libs $flags",
|
||||
),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue