summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--rules/CC/EXPRESSIONS17
-rw-r--r--rules/CC/RULES37
3 files changed, 52 insertions, 4 deletions
diff --git a/README.md b/README.md
index ee6b3b0..01d8ac1 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ A C++ library
| `"private-defines"` | List of defines set for source files local to this target. Each list entry will be prepended by `"-D"`. |
| `"cflags"` | List of compile flags set for this target and its consumers. |
| `"private-cflags"` | List of compile flags set for source files local to this target. |
+| `"ldflags"` | Additional linker flags for linking external libraries for this target and its consumers (not built by this tool, typically system libraries). |
| `"private-ldflags"` | Additional linker flags for linking external libraries (not built by this tool, typically system libraries). |
| `"soversion"` | The SOVERSION for shared libraries. Individual version components are joined with `"."`. |
| `"srcs"` | The source files of the library. |
@@ -19,6 +20,7 @@ A C++ library
| `"deps"` | Any other libraries this library depends upon. |
| `"private-deps"` | Any other libraries this library depends upon but does not include in its public headers. |
| `"proto"` | Any `["proto", "library"]` this target depends upon directly. The creation of C++ bindings for this proto library as well as of its dependencies will be taken care of (as anonymous targets, so no duplicate work will be carried out, even if the same proto library is used at various places). |
+| `"private-proto"` | Any `["proto", "library"]` this target depends upon privately. The creation of C++ bindings for this proto library as well as of its dependencies will be taken care of (as anonymous targets, so no duplicate work will be carried out, even if the same proto library is used at various places). |
| `"shared"` | If non-empty, produce a shared instead of a static library. |
## Rule `["CC", "binary"]`
diff --git a/rules/CC/EXPRESSIONS b/rules/CC/EXPRESSIONS
index 2998fa8..504e55a 100644
--- a/rules/CC/EXPRESSIONS
+++ b/rules/CC/EXPRESSIONS
@@ -681,6 +681,7 @@
, "private-hdrs"
, "cflags"
, "private-cflags"
+ , "ldflags"
, "private-ldflags"
, "stage"
, "extra-provides"
@@ -721,6 +722,7 @@
{ "type": "++"
, "$1":
[ {"type": "keys", "$1": {"type": "var", "name": "lib"}}
+ , {"type": "var", "name": "ldflags", "default": []}
, {"type": "var", "name": "private-ldflags", "default": []}
, {"type": "CALL_EXPRESSION", "name": "link-args-deps"}
]
@@ -936,6 +938,7 @@
, "private-hdrs"
, "cflags"
, "private-cflags"
+ , "ldflags"
, "private-ldflags"
, "soversion"
, "extra-provides"
@@ -977,7 +980,8 @@
, "$1":
{ "type": "++"
, "$1":
- [ {"type": "var", "name": "private-ldflags", "default": []}
+ [ {"type": "var", "name": "ldflags", "default": []}
+ , {"type": "var", "name": "private-ldflags", "default": []}
, {"type": "CALL_EXPRESSION", "name": "run-libs-args-deps"}
]
}
@@ -1008,7 +1012,16 @@
}
]
, [ "run-libs-args"
- , {"type": "keys", "$1": {"type": "var", "name": "lib"}}
+ , { "type": "nub_right"
+ , "$1":
+ { "type": "++"
+ , "$1":
+ [ {"type": "keys", "$1": {"type": "var", "name": "lib"}}
+ , {"type": "var", "name": "ldflags", "default": []}
+ , {"type": "CALL_EXPRESSION", "name": "run-libs-args-deps"}
+ ]
+ }
+ }
]
]
, "body":
diff --git a/rules/CC/RULES b/rules/CC/RULES
index 4d90adc..992e4a3 100644
--- a/rules/CC/RULES
+++ b/rules/CC/RULES
@@ -123,7 +123,14 @@
, "library":
{ "doc": ["A C++ library"]
, "target_fields":
- ["srcs", "hdrs", "private-hdrs", "deps", "private-deps", "proto"]
+ [ "srcs"
+ , "hdrs"
+ , "private-hdrs"
+ , "deps"
+ , "private-deps"
+ , "proto"
+ , "private-proto"
+ ]
, "string_fields":
[ "name"
, "stage"
@@ -132,6 +139,7 @@
, "private-defines"
, "cflags"
, "private-cflags"
+ , "ldflags"
, "private-ldflags"
, "soversion"
]
@@ -181,6 +189,11 @@
["List of compile flags set for this target and its consumers."]
, "private-cflags":
["List of compile flags set for source files local to this target."]
+ , "ldflags":
+ [ "Additional linker flags for linking external libraries for this"
+ , "target and its consumers (not built by this tool, typically system"
+ , "libraries)."
+ ]
, "private-ldflags":
[ "Additional linker flags for linking external libraries (not built"
, "by this tool, typically system libraries)."
@@ -197,6 +210,13 @@
, "duplicate work will be carried out, even if the same proto library"
, "is used at various places)."
]
+ , "private-proto":
+ [ "Any [\"proto\", \"library\"] this target depends upon privately."
+ , "The creation of C++ bindings for this proto library as well as of"
+ , "its dependencies will be taken care of (as anonymous targets, so no"
+ , "duplicate work will be carried out, even if the same proto library"
+ , "is used at various places)."
+ ]
, "shared": ["If non-empty, produce a shared instead of a static library."]
, "soversion":
[ "The SOVERSION for shared libraries. Individual version components are"
@@ -281,6 +301,14 @@
, "service library": ["./", "proto", "service library"]
}
}
+ , "private-proto-deps":
+ { "target": "private-proto"
+ , "provider": "proto"
+ , "rule_map":
+ { "library": ["./", "proto", "library"]
+ , "service library": ["./", "proto", "service library"]
+ }
+ }
}
, "imports":
{ "artifacts": ["./", "..", "field_artifacts"]
@@ -292,6 +320,8 @@
{ "deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
, "private-deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
, "proto-deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
+ , "private-proto-deps":
+ [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
}
, "expression":
{ "type": "let*"
@@ -360,13 +390,16 @@
}
}
]
+ , ["ldflags", {"type": "FIELD", "name": "ldflags"}]
, ["private-ldflags", {"type": "FIELD", "name": "private-ldflags"}]
, ["soversion", {"type": "FIELD", "name": "soversion"}]
, [ "deps-transition"
, {"type": "CALL_EXPRESSION", "name": "fPIC transition"}
]
, ["public-fieldnames", ["deps", "proto-deps"]]
- , ["private-fieldnames", ["deps", "private-deps", "proto-deps"]]
+ , [ "private-fieldnames"
+ , ["deps", "private-deps", "proto-deps", "private-proto-deps"]
+ ]
]
, "body":
{ "type": "if"