Module B0_ocaml.Code

Code generated by compilers.

In a build it is desirable to know which code is being produced because if both are produced the compilers may compete to produce some of the shared build artefacts. The following store keys allow to express build code desires and determine the actual decision. Note the desires may actually be altered by units that may build FIXME maybe we should stick to must build.

Code

type t = [
  1. | `Byte
    (*

    Bytecode.

    *)
  2. | `Native
    (*

    Native-code.

    *)
]

The type for code generated by the OCaml compiler.

type built = [
  1. | `Byte
    (*

    Bytecode.

    *)
  2. | `Native
    (*

    Native-code.

    *)
  3. | `All
    (*

    Both of them.

    *)
]

The type indicating which code is being built.

Metadata keys

val needs : built B0_meta.key

needs indicates the unit unconditionally needs a given code build.

val supported : built B0_meta.key

supported indicates which backend code the unit supports. If the meta is unspecified defaults to `All.

Store keys

val wanted : [ built | `Auto ] B0_store.key

wanted indicates which code should be built, default determines to `Auto. If `Auto is used and no unit that may build has specific needs then `Native is used if ocamlopt can be found in the memo environment and `Byte otherwise.

val built : built B0_store.key

build is a memo key indicating the built code. By default determines by consulting wanted_code.

Formatting

val pp : t B0_std.Fmt.t

pp formats code values.

val pp_built : built B0_std.Fmt.t

pp_built formats built code values.