diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-29 11:31:50 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-29 13:28:44 +0200 |
commit | 128ff7d3abd575419e719ad224d9a42ee93d09a6 (patch) | |
tree | 3feb284ba7a0315b5b5fb998b55fb656dd6b36cc /CC | |
parent | 54393b2288110c8d2ebcc0c19c14b62e286a6ab9 (diff) | |
download | rules-cc-128ff7d3abd575419e719ad224d9a42ee93d09a6.tar.gz |
["CC", "binary"] stage link action
... to avoid staging conflicts with the toolchain
Diffstat (limited to 'CC')
-rw-r--r-- | CC/EXPRESSIONS | 100 |
1 files changed, 79 insertions, 21 deletions
diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS index 34c0ed4..ab7c922 100644 --- a/CC/EXPRESSIONS +++ b/CC/EXPRESSIONS @@ -1387,40 +1387,98 @@ , "else": {"type": "var", "name": "name"} } ] - , [ "binary" + , [ "binpath (in work)" + , {"type": "join", "$1": ["work/", {"type": "var", "name": "binpath"}]} + ] + , ["TOOLCHAIN_DIR", "../toolchain"] + , ["COMPILER", {"type": "CALL_EXPRESSION", "name": "compiler"}] + , [ "ENV" + , { "type": "map_union" + , "$1": + [ {"type": "var", "name": "ENV"} + , { "type": "singleton_map" + , "key": "PATH" + , "value": + { "type": "join" + , "separator": ":" + , "$1": + { "type": "++" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "default-PATH"} + , { "type": "if" + , "cond": {"type": "var", "name": "ENV_PATH"} + , "then": [{"type": "var", "name": "ENV_PATH"}] + } + ] + } + } + } + ] + } + ] + , [ "cmd" + , { "type": "++" + , "$1": + [ [ {"type": "var", "name": "COMPILER"} + , "-o" + , {"type": "var", "name": "binpath"} + ] + , {"type": "var", "name": "COMPILE_FLAGS"} + , {"type": "var", "name": "link-args"} + , {"type": "var", "name": "LDFLAGS"} + ] + } + ] + , [ "binary (in work)" , { "type": "ACTION" - , "outs": [{"type": "var", "name": "binpath"}] + , "outs": [{"type": "var", "name": "binpath (in work)"}] , "inputs": { "type": "disjoint_map_union" , "$1": [ {"type": "var", "name": "TOOLCHAIN"} - , {"type": "var", "name": "objects"} - , {"type": "var", "name": "link-deps"} - , { "type": "var" - , "name": "cflags-files" - , "default": {"type": "empty_map"} - } - , { "type": "var" - , "name": "ldflags-files" - , "default": {"type": "empty_map"} + , { "type": "to_subdir" + , "subdir": "work" + , "$1": + { "type": "disjoint_map_union" + , "$1": + [ {"type": "var", "name": "objects"} + , {"type": "var", "name": "link-deps"} + , { "type": "var" + , "name": "cflags-files" + , "default": {"type": "empty_map"} + } + , { "type": "var" + , "name": "ldflags-files" + , "default": {"type": "empty_map"} + } + ] + } } ] } , "cmd": - { "type": "++" - , "$1": - [ [ {"type": "var", "name": "COMPILER"} - , "-o" - , {"type": "var", "name": "binpath"} + [ "sh" + , "-c" + , { "type": "join" + , "$1": + [ "cd work && " + , {"type": "join_cmd", "$1": {"type": "var", "name": "cmd"}} ] - , {"type": "var", "name": "COMPILE_FLAGS"} - , {"type": "var", "name": "link-args"} - , {"type": "var", "name": "LDFLAGS"} - ] - } + } + ] , "env": {"type": "var", "name": "ENV"} } ] + , [ "binary" + , { "type": "singleton_map" + , "key": {"type": "var", "name": "binpath"} + , "value": + { "type": "lookup" + , "map": {"type": "var", "name": "binary (in work)"} + , "key": {"type": "var", "name": "binpath (in work)"} + } + } + ] ] , "body": {"type": "var", "name": "binary"} } |