summaryrefslogtreecommitdiff
path: root/rules/CC/RULES
diff options
context:
space:
mode:
Diffstat (limited to 'rules/CC/RULES')
-rw-r--r--rules/CC/RULES79
1 files changed, 75 insertions, 4 deletions
diff --git a/rules/CC/RULES b/rules/CC/RULES
index 3bfd200..4d90adc 100644
--- a/rules/CC/RULES
+++ b/rules/CC/RULES
@@ -12,8 +12,10 @@
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
+ , "LDFLAGS"
, "ADD_CFLAGS"
, "ADD_CXXFLAGS"
+ , "ADD_LDFLAGS"
, "AR"
, "PATH"
]
@@ -25,6 +27,7 @@
, ["CXX", {"type": "FIELD", "name": "CXX"}]
, ["CFLAGS", {"type": "FIELD", "name": "CFLAGS"}]
, ["CXXFLAGS", {"type": "FIELD", "name": "CXXFLAGS"}]
+ , ["LDFLAGS", {"type": "FIELD", "name": "LDFLAGS"}]
, ["AR", {"type": "FIELD", "name": "AR"}]
, ["PATH", {"type": "FIELD", "name": "PATH"}]
, ["provider", "CC"]
@@ -99,12 +102,20 @@
]
}
]
+ , [ "LDFLAGS"
+ , { "type": "++"
+ , "$1":
+ [ {"type": "var", "name": "LDFLAGS"}
+ , {"type": "FIELD", "name": "ADD_LDFLAGS"}
+ ]
+ }
+ ]
]
, "body":
{ "type": "RESULT"
, "provides":
{ "type": "env"
- , "vars": ["CC", "CXX", "CFLAGS", "CXXFLAGS", "AR", "ENV"]
+ , "vars": ["CC", "CXX", "CFLAGS", "CXXFLAGS", "LDFLAGS", "AR", "ENV"]
}
}
}
@@ -122,16 +133,21 @@
, "cflags"
, "private-cflags"
, "private-ldflags"
+ , "soversion"
]
+ , "config_fields": ["shared"]
, "config_vars":
[ "CC"
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
+ , "LDFLAGS"
, "ADD_CFLAGS"
, "ADD_CXXFLAGS"
+ , "ADD_LDFLAGS"
, "AR"
, "ENV"
+ , "BUILD_POSITION_INDEPENDENT"
]
, "implicit": {"defaults": ["defaults"]}
, "field_doc":
@@ -181,6 +197,11 @@
, "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 \".\"."
+ ]
}
, "config_doc":
{ "CC":
@@ -203,6 +224,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"
@@ -215,11 +242,18 @@
, "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."]
}
, "artifacts_doc":
["The actual library (libname.a) staged in the specified directory"]
@@ -249,7 +283,16 @@
}
}
, "imports":
- {"artifacts": ["./", "..", "field_artifacts"], "result": "lib result"}
+ { "artifacts": ["./", "..", "field_artifacts"]
+ , "static result": "lib result"
+ , "shared result": "shared result"
+ , "fPIC transition": ["transitions", "with fPIC"]
+ }
+ , "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"}]
+ }
, "expression":
{ "type": "let*"
, "bindings":
@@ -318,10 +361,19 @@
}
]
, ["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"]]
]
- , "body": {"type": "CALL_EXPRESSION", "name": "result"}
+ , "body":
+ { "type": "if"
+ , "cond": {"type": "FIELD", "name": "shared"}
+ , "then": {"type": "CALL_EXPRESSION", "name": "shared result"}
+ , "else": {"type": "CALL_EXPRESSION", "name": "static result"}
+ }
}
}
, "binary":
@@ -336,7 +388,17 @@
, "private-ldflags"
]
, "config_vars":
- ["CC", "CXX", "CFLAGS", "CXXFLAGS", "ADD_CFLAGS", "ADD_CXXFLAGS", "ENV"]
+ [ "CC"
+ , "CXX"
+ , "CFLAGS"
+ , "CXXFLAGS"
+ , "LDFLAGS"
+ , "ADD_CFLAGS"
+ , "ADD_CXXFLAGS"
+ , "ADD_LDFLAGS"
+ , "ENV"
+ , "BUILD_POSITION_INDEPENDENT"
+ ]
, "implicit": {"defaults": ["defaults"]}
, "field_doc":
{ "name": ["The name of the binary"]
@@ -383,6 +445,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"
@@ -391,7 +457,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."]
}
, "artifacts_doc": ["The final binary, staged to the given directory"]
, "runfiles_doc": ["None"]