diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-24 12:47:27 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-30 10:40:47 +0200 |
commit | a457da441220f37874b8eb4c35225e92c2f6a18e (patch) | |
tree | e0e68a388b9a1472c23ccb00e7c6d486cfeabc06 | |
parent | f1c9699ed00c6c743482a0dd714e09d83fd24df0 (diff) | |
download | justbuild-a457da441220f37874b8eb4c35225e92c2f6a18e.tar.gz |
defaults: Separate toolchain from compile flags
-rw-r--r-- | etc/defaults/CC/TARGETS | 259 | ||||
-rw-r--r-- | etc/repos.json | 6 | ||||
-rw-r--r-- | etc/toolchain/CC/TARGETS | 258 |
3 files changed, 265 insertions, 258 deletions
diff --git a/etc/defaults/CC/TARGETS b/etc/defaults/CC/TARGETS index e028b67f..1b3d6a1f 100644 --- a/etc/defaults/CC/TARGETS +++ b/etc/defaults/CC/TARGETS @@ -1,7 +1,7 @@ { "defaults": { "type": ["CC", "defaults"] , "arguments_config": ["COMPILER_FAMILY", "DEBUG"] - , "base": ["toolchain"] + , "base": [["@", "toolchain", "CC", "defaults"]] , "ADD_CFLAGS": { "type": "case" , "expr": {"type": "var", "name": "COMPILER_FAMILY", "default": "unknown"} @@ -39,261 +39,4 @@ } } } -, "toolchain": - { "type": ["CC", "defaults"] - , "arguments_config": ["OS", "ARCH", "COMPILER_FAMILY"] - , "base": - { "type": "let*" - , "bindings": - [ [ "COMPILER_FAMILY" - , { "type": "if" - , "cond": - { "type": "and" - , "$1": - [{"type": "var", "name": "OS"}, {"type": "var", "name": "ARCH"}] - } - , "then": {"type": "var", "name": "COMPILER_FAMILY"} - , "else": "unknown" - } - ] - ] - , "body": - { "type": "case" - , "expr": - {"type": "var", "name": "COMPILER_FAMILY", "default": "unknown"} - , "case": {"gnu": ["gcc"], "clang": ["clang"], "unknown": ["unknown"]} - , "default": - { "type": "fail" - , "msg": - [ "Unsupported COMPILER_FAMILY" - , {"type": "var", "name": "COMPILER_FAMILY"} - ] - } - } - } - } -, "unknown": - { "type": ["CC", "defaults"] - , "CC": ["cc"] - , "CXX": ["c++"] - , "AR": ["ar"] - , "PATH": ["/bin", "/sbin", "/usr/bin", "/usr/sbin"] - } -, "gcc": - { "type": ["CC", "defaults"] - , "arguments_config": ["OS", "ARCH", "HOST_ARCH", "TARGET_ARCH"] - , "CC": - { "type": "let*" - , "bindings": - [ [ "PLATFORM" - , { "type": "join" - , "separator": "_" - , "$1": - [ {"type": "var", "name": "OS"} - , { "type": "var" - , "name": "TARGET_ARCH" - , "default": {"type": "var", "name": "ARCH"} - } - ] - } - ] - ] - , "body": - { "type": "case" - , "expr": {"type": "var", "name": "PLATFORM"} - , "case": - { "linux_x86": ["i686-linux-gnu-gcc"] - , "linux_x86_64": ["x86_64-linux-gnu-gcc"] - , "linux_arm": ["arm-linux-gnueabi-gcc"] - , "linux_arm64": ["aarch64-linux-gnu-gcc"] - } - , "default": - { "type": "fail" - , "msg": - ["Unsupported PLATFORM for gcc", {"type": "var", "name": "PLATFORM"}] - } - } - } - , "CXX": - { "type": "let*" - , "bindings": - [ [ "PLATFORM" - , { "type": "join" - , "separator": "_" - , "$1": - [ {"type": "var", "name": "OS"} - , { "type": "var" - , "name": "TARGET_ARCH" - , "default": {"type": "var", "name": "ARCH"} - } - ] - } - ] - ] - , "body": - { "type": "case" - , "expr": {"type": "var", "name": "PLATFORM"} - , "case": - { "linux_x86": ["i686-linux-gnu-g++"] - , "linux_x86_64": ["x86_64-linux-gnu-g++"] - , "linux_arm": ["arm-linux-gnueabi-g++"] - , "linux_arm64": ["aarch64-linux-gnu-g++"] - } - , "default": - { "type": "fail" - , "msg": - ["Unsupported PLATFORM for g++", {"type": "var", "name": "PLATFORM"}] - } - } - } - , "CXXFLAGS": - { "type": "case" - , "expr": - { "type": "var" - , "name": "TARGET_ARCH" - , "default": {"type": "var", "name": "ARCH"} - } - , "case": {"arm": ["-Wno-psabi"]} - } - , "AR": - { "type": "let*" - , "bindings": - [ [ "PLATFORM" - , { "type": "join" - , "separator": "_" - , "$1": - [ {"type": "var", "name": "OS"} - , { "type": "var" - , "name": "TARGET_ARCH" - , "default": {"type": "var", "name": "ARCH"} - } - ] - } - ] - ] - , "body": - { "type": "case" - , "expr": {"type": "var", "name": "PLATFORM"} - , "case": - { "linux_x86": ["i686-linux-gnu-ar"] - , "linux_x86_64": ["x86_64-linux-gnu-ar"] - , "linux_arm": ["arm-linux-gnueabi-ar"] - , "linux_arm64": ["aarch64-linux-gnu-ar"] - } - , "default": - { "type": "fail" - , "msg": - ["Unsupported PLATFORM for ar", {"type": "var", "name": "PLATFORM"}] - } - } - } - , "PATH": ["/bin", "/sbin", "/usr/bin", "/usr/sbin"] - } -, "clang": - { "type": ["CC", "defaults"] - , "arguments_config": ["OS", "ARCH", "TARGET_ARCH"] - , "CC": ["clang"] - , "CXX": ["clang++"] - , "AR": - { "type": "let*" - , "bindings": - [ [ "PLATFORM" - , { "type": "join" - , "separator": "_" - , "$1": - [ {"type": "var", "name": "OS"} - , { "type": "var" - , "name": "TARGET_ARCH" - , "default": {"type": "var", "name": "ARCH"} - } - ] - } - ] - ] - , "body": - { "type": "case" - , "expr": {"type": "var", "name": "PLATFORM"} - , "case": - { "linux_x86": ["i686-linux-gnu-ar"] - , "linux_x86_64": ["x86_64-linux-gnu-ar"] - , "linux_arm": ["arm-linux-gnueabi-ar"] - , "linux_arm64": ["aarch64-linux-gnu-ar"] - } - , "default": - { "type": "fail" - , "msg": - ["Unsupported PLATFORM for ar", {"type": "var", "name": "PLATFORM"}] - } - } - } - , "CFLAGS": - { "type": "let*" - , "bindings": - [ [ "PLATFORM" - , { "type": "join" - , "separator": "_" - , "$1": - [ {"type": "var", "name": "OS"} - , { "type": "var" - , "name": "TARGET_ARCH" - , "default": {"type": "var", "name": "ARCH"} - } - ] - } - ] - ] - , "body": - { "type": "case" - , "expr": {"type": "var", "name": "PLATFORM"} - , "case": - { "linux_x86": ["-target", "i686-linux-gnu"] - , "linux_x86_64": ["-target", "x86_64-linux-gnu"] - , "linux_arm": ["-target", "arm-linux-gnueabi"] - , "linux_arm64": ["-target", "aarch64-linux-gnu"] - } - , "default": - { "type": "fail" - , "msg": - [ "Unsupported PLATFORM for clang" - , {"type": "var", "name": "PLATFORM"} - ] - } - } - } - , "CXXFLAGS": - { "type": "let*" - , "bindings": - [ [ "PLATFORM" - , { "type": "join" - , "separator": "_" - , "$1": - [ {"type": "var", "name": "OS"} - , { "type": "var" - , "name": "TARGET_ARCH" - , "default": {"type": "var", "name": "ARCH"} - } - ] - } - ] - ] - , "body": - { "type": "case" - , "expr": {"type": "var", "name": "PLATFORM"} - , "case": - { "linux_x86": ["-target", "i686-linux-gnu"] - , "linux_x86_64": ["-target", "x86_64-linux-gnu"] - , "linux_arm": ["-target", "arm-linux-gnueabi"] - , "linux_arm64": ["-target", "aarch64-linux-gnu"] - } - , "default": - { "type": "fail" - , "msg": - [ "Unsupported PLATFORM for clang++" - , {"type": "var", "name": "PLATFORM"} - ] - } - } - } - , "PATH": ["/bin", "/sbin", "/usr/bin", "/usr/sbin"] - } } diff --git a/etc/repos.json b/etc/repos.json index eb152d8c..70dc60a2 100644 --- a/etc/repos.json +++ b/etc/repos.json @@ -62,6 +62,11 @@ , "target_root": "import targets" , "target_file_name": "TARGETS.distfiles" } + , "toolchain": + { "repository": + {"type": "file", "path": "etc/toolchain", "pragma": {"to_git": true}} + , "rule_root": "rules" + } , "defaults": { "repository": {"type": "file", "path": "etc/defaults", "pragma": {"to_git": true}} @@ -75,6 +80,7 @@ {"type": "file", "path": "rules", "pragma": {"to_git": true}} , "target_root": "defaults" , "rule_root": "rules" + , "bindings": {"toolchain": "toolchain"} } , "rules-just": { "repository": "rules" diff --git a/etc/toolchain/CC/TARGETS b/etc/toolchain/CC/TARGETS new file mode 100644 index 00000000..3ad0ef3d --- /dev/null +++ b/etc/toolchain/CC/TARGETS @@ -0,0 +1,258 @@ +{ "defaults": + { "type": ["CC", "defaults"] + , "arguments_config": ["OS", "ARCH", "COMPILER_FAMILY"] + , "base": + { "type": "let*" + , "bindings": + [ [ "COMPILER_FAMILY" + , { "type": "if" + , "cond": + { "type": "and" + , "$1": + [{"type": "var", "name": "OS"}, {"type": "var", "name": "ARCH"}] + } + , "then": {"type": "var", "name": "COMPILER_FAMILY"} + , "else": "unknown" + } + ] + ] + , "body": + { "type": "case" + , "expr": + {"type": "var", "name": "COMPILER_FAMILY", "default": "unknown"} + , "case": {"gnu": ["gcc"], "clang": ["clang"], "unknown": ["unknown"]} + , "default": + { "type": "fail" + , "msg": + [ "Unsupported COMPILER_FAMILY" + , {"type": "var", "name": "COMPILER_FAMILY"} + ] + } + } + } + } +, "unknown": + { "type": ["CC", "defaults"] + , "CC": ["cc"] + , "CXX": ["c++"] + , "AR": ["ar"] + , "PATH": ["/bin", "/sbin", "/usr/bin", "/usr/sbin"] + } +, "gcc": + { "type": ["CC", "defaults"] + , "arguments_config": ["OS", "ARCH", "HOST_ARCH", "TARGET_ARCH"] + , "CC": + { "type": "let*" + , "bindings": + [ [ "PLATFORM" + , { "type": "join" + , "separator": "_" + , "$1": + [ {"type": "var", "name": "OS"} + , { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + } + ] + ] + , "body": + { "type": "case" + , "expr": {"type": "var", "name": "PLATFORM"} + , "case": + { "linux_x86": ["i686-linux-gnu-gcc"] + , "linux_x86_64": ["x86_64-linux-gnu-gcc"] + , "linux_arm": ["arm-linux-gnueabi-gcc"] + , "linux_arm64": ["aarch64-linux-gnu-gcc"] + } + , "default": + { "type": "fail" + , "msg": + ["Unsupported PLATFORM for gcc", {"type": "var", "name": "PLATFORM"}] + } + } + } + , "CXX": + { "type": "let*" + , "bindings": + [ [ "PLATFORM" + , { "type": "join" + , "separator": "_" + , "$1": + [ {"type": "var", "name": "OS"} + , { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + } + ] + ] + , "body": + { "type": "case" + , "expr": {"type": "var", "name": "PLATFORM"} + , "case": + { "linux_x86": ["i686-linux-gnu-g++"] + , "linux_x86_64": ["x86_64-linux-gnu-g++"] + , "linux_arm": ["arm-linux-gnueabi-g++"] + , "linux_arm64": ["aarch64-linux-gnu-g++"] + } + , "default": + { "type": "fail" + , "msg": + ["Unsupported PLATFORM for g++", {"type": "var", "name": "PLATFORM"}] + } + } + } + , "CXXFLAGS": + { "type": "case" + , "expr": + { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + , "case": {"arm": ["-Wno-psabi"]} + } + , "AR": + { "type": "let*" + , "bindings": + [ [ "PLATFORM" + , { "type": "join" + , "separator": "_" + , "$1": + [ {"type": "var", "name": "OS"} + , { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + } + ] + ] + , "body": + { "type": "case" + , "expr": {"type": "var", "name": "PLATFORM"} + , "case": + { "linux_x86": ["i686-linux-gnu-ar"] + , "linux_x86_64": ["x86_64-linux-gnu-ar"] + , "linux_arm": ["arm-linux-gnueabi-ar"] + , "linux_arm64": ["aarch64-linux-gnu-ar"] + } + , "default": + { "type": "fail" + , "msg": + ["Unsupported PLATFORM for ar", {"type": "var", "name": "PLATFORM"}] + } + } + } + , "PATH": ["/bin", "/sbin", "/usr/bin", "/usr/sbin"] + } +, "clang": + { "type": ["CC", "defaults"] + , "arguments_config": ["OS", "ARCH", "TARGET_ARCH"] + , "CC": ["clang"] + , "CXX": ["clang++"] + , "AR": + { "type": "let*" + , "bindings": + [ [ "PLATFORM" + , { "type": "join" + , "separator": "_" + , "$1": + [ {"type": "var", "name": "OS"} + , { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + } + ] + ] + , "body": + { "type": "case" + , "expr": {"type": "var", "name": "PLATFORM"} + , "case": + { "linux_x86": ["i686-linux-gnu-ar"] + , "linux_x86_64": ["x86_64-linux-gnu-ar"] + , "linux_arm": ["arm-linux-gnueabi-ar"] + , "linux_arm64": ["aarch64-linux-gnu-ar"] + } + , "default": + { "type": "fail" + , "msg": + ["Unsupported PLATFORM for ar", {"type": "var", "name": "PLATFORM"}] + } + } + } + , "CFLAGS": + { "type": "let*" + , "bindings": + [ [ "PLATFORM" + , { "type": "join" + , "separator": "_" + , "$1": + [ {"type": "var", "name": "OS"} + , { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + } + ] + ] + , "body": + { "type": "case" + , "expr": {"type": "var", "name": "PLATFORM"} + , "case": + { "linux_x86": ["-target", "i686-linux-gnu"] + , "linux_x86_64": ["-target", "x86_64-linux-gnu"] + , "linux_arm": ["-target", "arm-linux-gnueabi"] + , "linux_arm64": ["-target", "aarch64-linux-gnu"] + } + , "default": + { "type": "fail" + , "msg": + [ "Unsupported PLATFORM for clang" + , {"type": "var", "name": "PLATFORM"} + ] + } + } + } + , "CXXFLAGS": + { "type": "let*" + , "bindings": + [ [ "PLATFORM" + , { "type": "join" + , "separator": "_" + , "$1": + [ {"type": "var", "name": "OS"} + , { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + } + ] + ] + , "body": + { "type": "case" + , "expr": {"type": "var", "name": "PLATFORM"} + , "case": + { "linux_x86": ["-target", "i686-linux-gnu"] + , "linux_x86_64": ["-target", "x86_64-linux-gnu"] + , "linux_arm": ["-target", "arm-linux-gnueabi"] + , "linux_arm64": ["-target", "aarch64-linux-gnu"] + } + , "default": + { "type": "fail" + , "msg": + [ "Unsupported PLATFORM for clang++" + , {"type": "var", "name": "PLATFORM"} + ] + } + } + } + , "PATH": ["/bin", "/sbin", "/usr/bin", "/usr/sbin"] + } +} |