Module B0_ocaml.Compile

Compiling.

Basic

val c_to_o : ?post_exec:(B0_zero.Op.t -> unit) -> ?k:(B0_zero.Op.t -> int -> unit) -> B0_memo.t -> comp:B0_memo.Tool.t -> opts:B0_std.Cmd.t -> reads:B0_std.Fpath.t list -> c:B0_std.Fpath.t -> o:B0_std.Fpath.t -> B0_std.Fpath.t list

c_to_o m ~comp ~opts ~reads ~c ~o compiles the C file c to the object file o with options opts and using compiler comp. It assumes the compilation depends on C include header files reads whose parent directories are added as -I options. Returns the written files.

val mli_to_cmi : ?post_exec:(B0_zero.Op.t -> unit) -> ?k:(B0_zero.Op.t -> int -> unit) -> and_cmti:bool -> B0_memo.t -> comp:B0_memo.Tool.t -> opts:B0_std.Cmd.t -> reads:B0_std.Fpath.t list -> mli:B0_std.Fpath.t -> o:B0_std.Fpath.t -> B0_std.Fpath.t list

mli_to_cmi ~and_cmti m ~comp ~opts ~reads ~mli ~o compiles the file mli to the cmi file o and, if and_cmti is true, to the cmti file Fpath.(o -+ ".cmti") with options opts and using compiler comp. It assumes the compilation depends on cmi files reads whose parent directories are added as -I options. Returns the written files.

val ml_to_cmo : ?post_exec:(B0_zero.Op.t -> unit) -> ?k:(B0_zero.Op.t -> int -> unit) -> and_cmt:bool -> B0_memo.t -> opts:B0_std.Cmd.t -> reads:B0_std.Fpath.t list -> has_cmi:bool -> ml:B0_std.Fpath.t -> o:B0_std.Fpath.t -> B0_std.Fpath.t list

ml_to_cmo ~and_cmt m ~opts ~reads ~has_cmi ~ml ~o compiles the file ml to cmo file o and, if and_cmt is true, to the cmt file Fpath.(o -+ ".cmt") with options opts. It assumes the compilation depends on the cmi files reads whose parent directories are added as -I options. has_cmi indicates whether the ml file already a corresponding cmi file, in which case it should be in reads (FIXME specify path directly ?).

val ml_to_cmx : ?post_exec:(B0_zero.Op.t -> unit) -> ?k:(B0_zero.Op.t -> int -> unit) -> and_cmt:bool -> B0_memo.t -> opts:B0_std.Cmd.t -> reads:B0_std.Fpath.t list -> has_cmi:bool -> ml:B0_std.Fpath.t -> o:B0_std.Fpath.t -> B0_std.Fpath.t list

ml_to_cmx ~and_cmt m ~opts ~reads ~has_cmi ~ml ~o ~and_cmt compiles the file ml to cmx file o and, if and_cmt is true, to the cmt file Fpath.(o -+ ".cmt") with options opts. It assumes the compilation depends on the cmi and cmx files reads whose parent directories are added as -I options. has_cmi indicates whether the ml file already has a corresponding cmi file, in which case it should be in reads (FIXME specify path directly ?).

val ml_to_impl : ?post_exec:(B0_zero.Op.t -> unit) -> ?k:(B0_zero.Op.t -> int -> unit) -> B0_memo.t -> code:Code.t -> opts:B0_std.Cmd.t -> reads:B0_std.Fpath.t list -> has_cmi:bool -> ml:B0_std.Fpath.t -> o:B0_std.Fpath.t -> and_cmt:bool -> B0_std.Fpath.t list

ml_to_impl is ml_to_cmo or ml_to_cmx according to code. Beware that the given arguments must be common to both

Modsrc convenience

A few helpers that deal directly with the Modsrc abstraction.

val modsrc_intf : and_cmti:bool -> B0_memo.t -> comp:B0_memo.Tool.t -> opts:B0_std.Cmd.t -> requires:Lib.t list -> modsrcs:Modsrc.t Modname.Map.t -> Modsrc.t -> B0_std.Fpath.t list

modsrc_intf m ~opts ~requires ~modsrcs ~and_cmti src compiles the interface of src with options opts and compiler comp assuming its dependencies are in modsrcs and requires. If and_cmti is true the cmti file is also produced. If src has no .mli this is a nop. Returns the written files (if any).

val modsrc_impl : and_cmt:bool -> B0_memo.t -> code:Code.t -> opts:B0_std.Cmd.t -> requires:Lib.t list -> modsrcs:Modsrc.t Modname.Map.t -> Modsrc.t -> B0_std.Fpath.t list

modsrc_impl m ~code ~opts ~requires ~modsrcs src compile the implementation of src with option opts to code code asuming it dependencies are in modsrc. If and_cmt is true the cmt file is also produced. If src has no .ml this is a nop. Returns the written files (if any).

val intfs : and_cmti:bool -> B0_memo.t -> comp:B0_memo.Tool.t -> opts:B0_std.Cmd.t -> requires:Lib.t list -> modsrcs:Modsrc.t Modname.Map.t -> B0_std.Fpath.t list

intfs iters modsrc_intf over the elements of modsrcs.

val impls : and_cmt:bool -> B0_memo.t -> code:Code.t -> opts:B0_std.Cmd.t -> requires:Lib.t list -> modsrcs:Modsrc.t Modname.Map.t -> B0_std.Fpath.t list

impls iters modsrc_impl over the elements of modsrcs.