summaryrefslogtreecommitdiff
path: root/CC/RULES
diff options
context:
space:
mode:
Diffstat (limited to 'CC/RULES')
-rw-r--r--CC/RULES193
1 files changed, 189 insertions, 4 deletions
diff --git a/CC/RULES b/CC/RULES
index 0f1b0ff..6c07275 100644
--- a/CC/RULES
+++ b/CC/RULES
@@ -103,6 +103,8 @@
, "compile-args-deps": "compile-args-deps"
, "link-deps": "link-deps"
, "link-args-deps": "link-args-deps"
+ , "run-libs-deps": "run-libs-deps"
+ , "run-libs-args-deps": "run-libs-args-deps"
, "cflags-files-deps": "cflags-files-deps"
, "ldflags-files-deps": "ldflags-files-deps"
, "for host": ["transitions", "for host"]
@@ -315,6 +317,10 @@
]
, ["link-deps", {"type": "CALL_EXPRESSION", "name": "link-deps"}]
, ["link-args", {"type": "CALL_EXPRESSION", "name": "link-args-deps"}]
+ , ["run-libs", {"type": "CALL_EXPRESSION", "name": "run-libs-deps"}]
+ , [ "run-libs-args"
+ , {"type": "CALL_EXPRESSION", "name": "run-libs-args-deps"}
+ ]
, [ "cflags-files"
, {"type": "CALL_EXPRESSION", "name": "cflags-files-deps"}
]
@@ -370,6 +376,8 @@
, "compile-args"
, "link-deps"
, "link-args"
+ , "run-libs"
+ , "run-libs-args"
, "package"
, "debug-srcs"
, "debug-hdrs"
@@ -381,7 +389,15 @@
, "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"
+ , "components"
+ ]
, "string_fields":
[ "name"
, "stage"
@@ -390,18 +406,26 @@
, "private-defines"
, "cflags"
, "private-cflags"
+ , "ldflags"
, "private-ldflags"
+ , "soversion"
, "pkg-name"
]
+ , "config_fields": ["shared"]
, "config_vars":
[ "CC"
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
+ , "LDFLAGS"
, "ADD_CFLAGS"
, "ADD_CXXFLAGS"
+ , "ADD_LDFLAGS"
, "AR"
, "ENV"
+ , "BUILD_POSITION_INDEPENDENT"
+ , "BUILD_OBJECT_ONLY"
+ , "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING"
, "DEBUG"
, "LINT"
]
@@ -415,6 +439,11 @@
[ "Any header files that only need to be present when compiling the"
, "source files, but are not needed for any consumer of the library."
]
+ , "components":
+ [ "Any other libraries that are considered part of this library;"
+ , "all object files of those are included unconditionally into this"
+ , "library."
+ ]
, "stage":
[ "The logical location of all header and source files, as well as the"
, "resulting library file. Individual directory components are joined"
@@ -437,6 +466,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)."
@@ -453,6 +487,18 @@
, "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"
+ , "joined with \".\"."
+ ]
, "pkg-name":
[ "Name to use for pkg-config files. If this field is empty, the field"
, "\"name\" is used instead."
@@ -480,6 +526,12 @@
, "adapting the default target [\"CC\", \"defaults\"] is the better"
, "choice."
]
+ , "LDFLAGS":
+ [ "The linker flags to be used instead of the default ones."
+ , "For libraries that should be built in a non-standard way; usually"
+ , "adapting the default target [\"CC\", \"defaults\"] is the better"
+ , "choice."
+ ]
, "ADD_CFLAGS":
[ "The flags to add to the default ones for CC."
, "For libraries that should be built in a non-standard way; usually"
@@ -492,12 +544,31 @@
, "adapting the default target [\"CC\", \"defaults\"] is the better"
, "choice."
]
+ , "ADD_LDFLAGS":
+ [ "The linker flags to add to the default ones."
+ , "For libraries that should be built in a non-standard way; usually"
+ , "adapting the default target [\"CC\", \"defaults\"] is the better"
+ , "choice."
+ ]
, "AR":
[ "The archive tool to used for creating the library"
, "If None, the respective value from [\"CC\", \"defaults\"] will be taken."
]
, "ENV": ["The environment for any action generated."]
+ , "BUILD_POSITION_INDEPENDENT": ["Build with -fPIC."]
, "DEBUG": ["Compute the debug-stage, needed for local debugging."]
+ , "BUILD_OBJECT_ONLY":
+ [ "If true, produce an object library, resulting in object files"
+ , "added to the linker line of all depending targets. If this"
+ , "configuration is set, the \"shared\" option is ignored. This"
+ , "variable is cleared for all dependencies."
+ ]
+ , "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING":
+ [ "If true, do not include the objects in the provided \"link-args\"."
+ , "This allows consuming libraries that pick on the objects themselves"
+ , "to still forward the \"link-args\" of that library, and thus getting"
+ , "correct linking instructions for the resulting library."
+ ]
, "LINT":
[ "Also provide nodes describing compile actions and header files;"
, "those can be used by lint rules (doing also the config transition)"
@@ -522,6 +593,20 @@
]
, "debug-srcs": ["Map of all sources needed for debugging."]
, "debug-hdrs": ["Map of all additional headers needed for debugging."]
+ , "run-libs":
+ [ "Map of artifacts specifying libraries that have to be present at"
+ , "runtime (as well as during linking)."
+ ]
+ , "run-libs-args":
+ [ "Additional arguments for linking that are related to the run-libs."
+ , "Those are added on the linker command line after the regular link-args."
+ ]
+ , "package":
+ [ "Information related to packaging the library. This provider is a map,"
+ , "specifying \"name\" and \"version\" of the package, as well as"
+ , "additional stages \"cflags-files\" and \"ldflags-files\" for files"
+ , "with compile-flags or link-flags, respctively."
+ ]
}
, "anonymous":
{ "proto-deps":
@@ -532,9 +617,34 @@
, "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"], "result": "lib result"}
+ { "artifacts": ["./", "..", "field_artifacts"]
+ , "runfiles": ["./", "..", "field_runfiles"]
+ , "static result": "lib result"
+ , "shared result": "shared result"
+ , "object result": "object result"
+ , "fPIC transition": ["transitions", "with fPIC, not object-only"]
+ , "component transition": ["transitions", "with fPIC, object-only"]
+ }
+ , "config_transitions":
+ { "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"}]
+ , "defaults": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
+ , "components":
+ [{"type": "CALL_EXPRESSION", "name": "component transition"}]
+ }
, "expression":
{ "type": "let*"
, "bindings":
@@ -592,6 +702,27 @@
}
}
]
+ , [ "component transition"
+ , {"type": "CALL_EXPRESSION", "name": "component transition"}
+ ]
+ , [ "component hdrs"
+ , { "type": "let*"
+ , "bindings":
+ [ ["fieldname", "components"]
+ , ["transition", {"type": "var", "name": "component transition"}]
+ ]
+ , "body": {"type": "CALL_EXPRESSION", "name": "runfiles"}
+ }
+ ]
+ , [ "hdrs"
+ , { "type": "disjoint_map_union"
+ , "msg": "Staging conflict between component and own header files"
+ , "$1":
+ [ {"type": "var", "name": "hdrs"}
+ , {"type": "var", "name": "component hdrs"}
+ ]
+ }
+ ]
, [ "private-hdrs"
, { "type": "to_subdir"
, "subdir": {"type": "var", "name": "stage"}
@@ -602,7 +733,9 @@
}
}
]
+ , ["ldflags", {"type": "FIELD", "name": "ldflags"}]
, ["private-ldflags", {"type": "FIELD", "name": "private-ldflags"}]
+ , ["soversion", {"type": "FIELD", "name": "soversion"}]
, [ "pkg-name"
, { "type": "if"
, "cond": {"type": "FIELD", "name": "pkg-name"}
@@ -611,12 +744,52 @@
, "else": {"type": "var", "name": "name"}
}
]
+ , [ "defaults-transition"
+ , {"type": "CALL_EXPRESSION", "name": "fPIC transition"}
+ ]
+ , [ "deps-transition"
+ , {"type": "CALL_EXPRESSION", "name": "fPIC transition"}
+ ]
, ["public-fieldnames", ["deps", "proto-deps", "defaults"]]
, [ "private-fieldnames"
- , ["deps", "private-deps", "proto-deps", "defaults"]
+ , [ "deps"
+ , "private-deps"
+ , "proto-deps"
+ , "private-proto-deps"
+ , "defaults"
+ , "components"
+ ]
+ ]
+ , ["component-fieldnames", ["components"]]
+ , [ "modified-transitions"
+ , { "type": "singleton_map"
+ , "key": "components"
+ , "value": {"type": "var", "name": "component transition"}
+ }
+ ]
+ , [ "shared"
+ , { "type": "and"
+ , "$1":
+ [ {"type": "FIELD", "name": "shared"}
+ , { "type": "not"
+ , "$1": {"type": "var", "name": "BUILD_OBJECT_ONLY"}
+ }
+ ]
+ }
]
]
- , "body": {"type": "CALL_EXPRESSION", "name": "result"}
+ , "body":
+ { "type": "cond"
+ , "cond":
+ [ [ {"type": "var", "name": "shared"}
+ , {"type": "CALL_EXPRESSION", "name": "shared result"}
+ ]
+ , [ {"type": "var", "name": "BUILD_OBJECT_ONLY"}
+ , {"type": "CALL_EXPRESSION", "name": "object result"}
+ ]
+ ]
+ , "default": {"type": "CALL_EXPRESSION", "name": "static result"}
+ }
}
}
, "binary":
@@ -635,9 +808,12 @@
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
+ , "LDFLAGS"
, "ADD_CFLAGS"
, "ADD_CXXFLAGS"
+ , "ADD_LDFLAGS"
, "ENV"
+ , "BUILD_POSITION_INDEPENDENT"
, "DEBUG"
, "LINT"
]
@@ -688,6 +864,10 @@
[ "The flags for CXX to be used instead of the default ones"
, "taken from the [\"CC\", \"defaults\"] target"
]
+ , "LDFLAGS":
+ [ "The linker flags do be used instead of the default ones"
+ , "taken from the [\"CC\", \"defaults\"] target"
+ ]
, "ADD_CFLAGS":
[ "The flags to add to the default ones for CC"
, "taken from the [\"CC\", \"defaults\"] target"
@@ -696,7 +876,12 @@
[ "The flags to add to the default ones for CXX"
, "taken from the [\"CC\", \"defaults\"] target"
]
+ , "ADD_LDFLAGS":
+ [ "The linker flags to add to the default ones"
+ , "taken from the [\"CC\", \"defaults\"] target"
+ ]
, "ENV": ["The environment for any action generated."]
+ , "BUILD_POSITION_INDEPENDENT": ["Build with -fPIC."]
, "DEBUG": ["Compute the debug-stage, needed for local debugging."]
, "LINT":
[ "Also provide nodes describing compile actions and header files;"