diff options
-rw-r--r-- | CC/EXPRESSIONS | 177 |
1 files changed, 134 insertions, 43 deletions
diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS index a4bdbd9..9c64cff 100644 --- a/CC/EXPRESSIONS +++ b/CC/EXPRESSIONS @@ -1304,26 +1304,59 @@ , "cond": {"type": "var", "name": "objects"} , "else": {"type": "empty_map"} , "then": - { "type": "ACTION" - , "outs": [{"type": "var", "name": "libpath"}] - , "inputs": - { "type": "map_union" - , "$1": - [ {"type": "var", "name": "TOOLCHAIN"} - , {"type": "var", "name": "objects"} + { "type": "let*" + , "bindings": + [ [ "staged objects" + , { "type": "to_subdir" + , "subdir": "work" + , "$1": {"type": "var", "name": "objects"} + } ] - } - , "env": - {"type": "var", "name": "ENV", "default": {"type": "empty_map"}} - , "cmd": - { "type": "++" - , "$1": - [ [ {"type": "var", "name": "AR", "default": "ar"} - , "cqs" - , {"type": "var", "name": "libpath"} - ] - , {"type": "keys", "$1": {"type": "var", "name": "objects"}} + , [ "staged libpath" + , { "type": "join" + , "$1": ["work/", {"type": "var", "name": "libpath"}] + } ] + , [ "staged lib" + , { "type": "ACTION" + , "outs": [{"type": "var", "name": "staged libpath"}] + , "inputs": + { "type": "map_union" + , "$1": + [ {"type": "var", "name": "TOOLCHAIN"} + , {"type": "var", "name": "staged objects"} + ] + } + , "env": + { "type": "var" + , "name": "ENV" + , "default": {"type": "empty_map"} + } + , "cmd": + { "type": "++" + , "$1": + [ [ {"type": "var", "name": "AR", "default": "ar"} + , "cqs" + , {"type": "var", "name": "staged libpath"} + ] + , { "type": "keys" + , "$1": {"type": "var", "name": "staged objects"} + } + ] + } + } + ] + , [ "lib artifact" + , { "type": "lookup" + , "map": {"type": "var", "name": "staged lib"} + , "key": {"type": "var", "name": "staged libpath"} + } + ] + ] + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "libpath"} + , "value": {"type": "var", "name": "lib artifact"} } } } @@ -2342,44 +2375,102 @@ , "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"} + , "-Wl,-rpath,$ORIGIN" + , "-Wl,-rpath,$ORIGIN/../lib" + , "-o" + , {"type": "var", "name": "binpath"} + ] + , {"type": "var", "name": "COMPILE_FLAGS"} + , {"type": "var", "name": "link-args"} + , {"type": "var", "name": "run-libs-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": "run-libs"} - , { "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": "run-libs"} + , { "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"} - , "-Wl,-rpath,$ORIGIN" - , "-Wl,-rpath,$ORIGIN/../lib" - , "-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": "run-libs-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"} } |