ocaml_binary Last updated Mar 27, 2025
load("@rules_ocaml//build:rules.bzl", "ocaml_binary")
ocaml_binary(name, data, cc_deps, cc_linkall, cc_linkopts, data_prefix_map, env, epilogue, exe_name, force_archived_libdeps, main, opts, prologue, runtime, vm_linkage)
Generates an OCaml executable binary.
CONFIGURABLE DEFAULTS for rule ocaml_binary
In addition to the [Configurable defaults] that
apply to all ocaml_*
rules, the following apply to this rule. (Note
the difference between '/' and ':' in such labels):
Label | Default | opts attrib |
---|---|---|
@rules_ocaml//cfg/executable/linkall |
True |
|
@rules_ocaml//cfg/executable:warnings |
|
|
NOTE These do not support :enable
, :disable
syntax.
Attributes
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
A unique name for this target. |
required |
|||
Runtime dependencies: list of labels of data files needed by this executable at runtime. |
optional |
[] |
||
Dictionary specifying C/C++ library dependencies. Key: a target label; value: a linkmode string, which determines which file to link. Valid linkmodes: 'default', 'static', 'dynamic', 'shared' (synonym for 'dynamic'). For more information see [CC Dependencies: Linkmode](../ug/cc_deps.md#linkmode). |
optional |
{} |
||
True: use |
optional |
[] |
||
List of C/C link options. E.g. ["-lstd"]. |
List of strings |
optional |
[] |
|
Map for replacing path prefixes of data files |
optional |
{} |
||
Env variables |
optional |
{} |
||
List of OCaml dependencies to be linked after |
optional |
[] |
||
By default, executable name is derived from 'name' attribute; use this to override. |
String |
optional |
"" |
|
Force archiving of library dependencies |
Boolean |
optional |
False |
|
Label of module containing entry point of executable. In the list of dependencies, this will be placed after 'prologue' deps and before 'epilogue' deps. |
required |
|||
List of compile options; overrides configurable default options. Supports |
List of strings |
optional |
[] |
|
List of OCaml dependencies to be linked before |
optional |
[] |
||
Runtime to use. One of @rules_ocaml//rt:std,
@rules_ocaml//rt:dbg, @rules_ocaml//rt:instrumented; or,
label of an @rules_ocaml//rt:dbg will set |
optional |
"@rules_ocaml//rt:std" |
||
custom, dynamic or static. Custom means link with -custom flag; static with -output-complete-exe |
String |
optional |
"custom" |