summaryrefslogtreecommitdiff
path: root/CC/RULES
diff options
context:
space:
mode:
Diffstat (limited to 'CC/RULES')
-rw-r--r--CC/RULES150
1 files changed, 144 insertions, 6 deletions
diff --git a/CC/RULES b/CC/RULES
index ff642b9..37460d3 100644
--- a/CC/RULES
+++ b/CC/RULES
@@ -12,11 +12,47 @@
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
+ , "LDFLAGS"
, "ADD_CFLAGS"
, "ADD_CXXFLAGS"
+ , "ADD_LDFLAGS"
, "AR"
, "PATH"
]
+ , "field_doc":
+ { "base": ["Other targets (using the same rule) to inherit values from."]
+ , "CC": ["The C compiler to use"]
+ , "CXX": ["The C++ compiler to use"]
+ , "AR": ["The archiver tool to use"]
+ , "CFLAGS":
+ [ "Flags for C compilation. Specifying this field overwrites"
+ , "values from \"base\"."
+ ]
+ , "CXXFLAGS":
+ [ "Flags for C++ compilation. Specifying this field overwrites"
+ , "values from \"base\"."
+ ]
+ , "LDFLAGS":
+ [ "Linker flags for linking the final CC library. Specifying this field"
+ , "overwrites values from \"base\"."
+ ]
+ , "ADD_CFLAGS":
+ [ "Additional compilation flags for C. Specifying this field"
+ , "extends values from \"base\"."
+ ]
+ , "ADD_CXXFLAGS":
+ [ "Additional compilation flags for C++. Specifying this field"
+ , "extends values from \"base\"."
+ ]
+ , "ADD_LDFLAGS":
+ [ "Additional linker flags for linking the final CC library. Specifying"
+ , "this field extends values from \"base\"."
+ ]
+ , "PATH":
+ [ "Path for looking up the compilers. Individual paths are joined"
+ , "with \":\"."
+ ]
+ }
, "imports": {"base-provides": "defaults-base-provides"}
, "expression":
{ "type": "let*"
@@ -25,6 +61,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 +136,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"]
}
}
}
@@ -112,7 +157,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"
@@ -121,18 +173,24 @@
, "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"
]
, "implicit": {"defaults": ["defaults"]}
, "field_doc":
@@ -166,6 +224,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)."
@@ -182,6 +245,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."
@@ -208,6 +283,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"
@@ -220,11 +301,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"]
@@ -252,9 +340,28 @@
, "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"]
+ , "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"}]
+ , "private-proto-deps":
+ [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
+ }
, "expression":
{ "type": "let*"
, "bindings":
@@ -322,7 +429,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"}
@@ -331,10 +440,20 @@
, "else": {"type": "var", "name": "name"}
}
]
+ , [ "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": "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":
@@ -349,7 +468,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"]
@@ -396,6 +525,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"
@@ -404,7 +537,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"]