diff options
Diffstat (limited to 'rules/CC/RULES')
-rw-r--r-- | rules/CC/RULES | 91 |
1 files changed, 68 insertions, 23 deletions
diff --git a/rules/CC/RULES b/rules/CC/RULES index e5d887a..0a69375 100644 --- a/rules/CC/RULES +++ b/rules/CC/RULES @@ -384,6 +384,7 @@ , "private-deps" , "proto" , "private-proto" + , "components" ] , "string_fields": [ "name" @@ -398,7 +399,7 @@ , "soversion" , "pkg-name" ] - , "config_fields": ["shared", "object_only"] + , "config_fields": ["shared"] , "config_vars": [ "CC" , "CXX" @@ -411,6 +412,8 @@ , "AR" , "ENV" , "BUILD_POSITION_INDEPENDENT" + , "BUILD_OBJECT_ONLY" + , "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING" , "DEBUG" ] , "implicit": {"defaults": ["defaults"]} @@ -423,6 +426,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" @@ -473,15 +481,7 @@ , "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. Setting" - , "this option is mutually exclusive to the \"object_only\" option." - ] - , "object_only": - [ "If non-empty, produce an object library, resulting in object files" - , "added to the linker line of all depending targets. Setting this option" - , "is mutually exclusive to the \"shared\" option." - ] + , "shared": ["If non-empty, produce a shared instead of a static library."] , "soversion": [ "The SOVERSION for shared libraries. Individual version components are" , "joined with \".\"." @@ -544,6 +544,18 @@ , "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." + ] } , "artifacts_doc": ["The actual library (libname.a) staged in the specified directory"] @@ -584,10 +596,12 @@ } , "imports": { "artifacts": ["./", "..", "field_artifacts"] + , "runfiles": ["./", "..", "field_runfiles"] , "static result": "lib result" , "shared result": "shared result" , "object result": "object result" - , "fPIC transition": ["transitions", "with fPIC"] + , "fPIC transition": ["transitions", "with fPIC, not object-only"] + , "component transition": ["transitions", "with fPIC, object-only"] } , "config_transitions": { "deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}] @@ -596,6 +610,8 @@ , "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*" @@ -654,6 +670,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"} @@ -688,26 +725,34 @@ , "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": "cond" , "cond": - [ [ { "type": "and" - , "$1": - [ {"type": "FIELD", "name": "shared"} - , {"type": "FIELD", "name": "object_only"} - ] - } - , { "type": "fail" - , "msg": "Fields \"shared\" and \"object_only\" are mutually exclusive." - } - ] - , [ {"type": "FIELD", "name": "shared"} + [ [ {"type": "var", "name": "shared"} , {"type": "CALL_EXPRESSION", "name": "shared result"} ] - , [ {"type": "FIELD", "name": "object_only"} + , [ {"type": "var", "name": "BUILD_OBJECT_ONLY"} , {"type": "CALL_EXPRESSION", "name": "object result"} ] ] |