summaryrefslogtreecommitdiff
path: root/rules/CC
diff options
context:
space:
mode:
Diffstat (limited to 'rules/CC')
-rw-r--r--rules/CC/RULES42
-rw-r--r--rules/CC/proto/RULES41
2 files changed, 81 insertions, 2 deletions
diff --git a/rules/CC/RULES b/rules/CC/RULES
index 7e9fbf9..e5d887a 100644
--- a/rules/CC/RULES
+++ b/rules/CC/RULES
@@ -21,6 +21,7 @@
, "PATH"
, "SYSTEM_TOOLS"
]
+ , "config_vars": ["ARCH", "HOST_ARCH", "TARGET_ARCH", "DEBUG"]
, "field_doc":
{ "base": ["Other targets (using the same rule) to inherit values from."]
, "toolchain":
@@ -77,7 +78,16 @@
, "with \":\". Specifying this field extends values from \"base\"."
]
}
- , "config_vars": ["ARCH", "HOST_ARCH", "TARGET_ARCH"]
+ , "config_doc":
+ { "ARCH":
+ [ "The unqualified architecture. Is taken as a default for \"HOST_ARCH\""
+ , "and \"TARGET_ARCH\" if not set."
+ ]
+ , "HOST_ARCH":
+ ["The architecture on which the build actions are carried out."]
+ , "TARGET_ARCH": ["The architecture for which to build."]
+ , "DEBUG": ["Compute the debug-stage, needed for local debugging."]
+ }
, "imports":
{ "base-provides": "defaults-base-provides"
, "base-provides-++": "defaults-base-provides-++"
@@ -93,6 +103,7 @@
, "cflags-files-deps": "cflags-files-deps"
, "ldflags-files-deps": "ldflags-files-deps"
, "for host": ["transitions", "for host"]
+ , "debug-deps": "debug-deps"
}
, "config_transitions":
{"toolchain": [{"type": "CALL_EXPRESSION", "name": "for host"}]}
@@ -306,6 +317,33 @@
, {"type": "CALL_EXPRESSION", "name": "ldflags-files-deps"}
]
, ["package", {"type": "env", "vars": ["cflags-files", "ldflags-files"]}]
+ , [ "debug-srcs"
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "DEBUG"}
+ , "then":
+ { "type": "let*"
+ , "bindings": [["deps-provider", "debug-srcs"]]
+ , "body": {"type": "CALL_EXPRESSION", "name": "debug-deps"}
+ }
+ , "else": {"type": "empty_map"}
+ }
+ ]
+ , [ "debug-hdrs"
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "DEBUG"}
+ , "then":
+ { "type": "map_union"
+ , "$1":
+ [ { "type": "let*"
+ , "bindings": [["deps-provider", "debug-hdrs"]]
+ , "body": {"type": "CALL_EXPRESSION", "name": "debug-deps"}
+ }
+ , {"type": "var", "name": "compile-deps"}
+ ]
+ }
+ , "else": {"type": "empty_map"}
+ }
+ ]
]
, "body":
{ "type": "RESULT"
@@ -329,6 +367,8 @@
, "run-libs"
, "run-libs-args"
, "package"
+ , "debug-srcs"
+ , "debug-hdrs"
]
}
}
diff --git a/rules/CC/proto/RULES b/rules/CC/proto/RULES
index f42c783..6fb0f40 100644
--- a/rules/CC/proto/RULES
+++ b/rules/CC/proto/RULES
@@ -15,7 +15,7 @@
, "GRPC_PLUGIN"
, "PATH"
]
- , "config_vars": ["ARCH", "HOST_ARCH"]
+ , "config_vars": ["ARCH", "HOST_ARCH", "DEBUG"]
, "field_doc":
{ "base":
[ "Other targets (using the same rule) to inherit values from. If"
@@ -69,6 +69,15 @@
, "with \":\". Specifying this field extends values from \"base\"."
]
}
+ , "config_doc":
+ { "ARCH":
+ [ "The unqualified architecture. Is taken as a default for \"HOST_ARCH\""
+ , "and \"TARGET_ARCH\" if not set."
+ ]
+ , "HOST_ARCH":
+ ["The architecture on which the build actions are carried out."]
+ , "DEBUG": ["Compute the debug-stage, needed for local debugging."]
+ }
, "imports":
{ "base-provides": ["./", "..", "defaults-base-provides"]
, "base-provides-++": ["./", "..", "defaults-base-provides-++"]
@@ -84,6 +93,7 @@
, "cflags-files-deps": ["CC", "cflags-files-deps"]
, "ldflags-files-deps": ["CC", "ldflags-files-deps"]
, "for host": ["transitions", "for host"]
+ , "debug-deps": ["CC", "debug-deps"]
}
, "config_transitions":
{"toolchain": [{"type": "CALL_EXPRESSION", "name": "for host"}]}
@@ -246,6 +256,33 @@
, {"type": "CALL_EXPRESSION", "name": "ldflags-files-deps"}
]
, ["package", {"type": "env", "vars": ["cflags-files", "ldflags-files"]}]
+ , [ "debug-srcs"
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "DEBUG"}
+ , "then":
+ { "type": "let*"
+ , "bindings": [["deps-provider", "debug-srcs"]]
+ , "body": {"type": "CALL_EXPRESSION", "name": "debug-deps"}
+ }
+ , "else": {"type": "empty_map"}
+ }
+ ]
+ , [ "debug-hdrs"
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "DEBUG"}
+ , "then":
+ { "type": "map_union"
+ , "$1":
+ [ { "type": "let*"
+ , "bindings": [["deps-provider", "debug-hdrs"]]
+ , "body": {"type": "CALL_EXPRESSION", "name": "debug-deps"}
+ }
+ , {"type": "var", "name": "compile-deps"}
+ ]
+ }
+ , "else": {"type": "empty_map"}
+ }
+ ]
]
, "body":
{ "type": "RESULT"
@@ -267,6 +304,8 @@
, "run-libs"
, "run-libs-args"
, "package"
+ , "debug-srcs"
+ , "debug-hdrs"
]
}
}