Module Ninja_utils.Build

Helper module to build ninja build statements.

type t = {
outputs : Expr.t list;
rule : string;
inputs : Expr.t list option;
vars : (string * Expr.t) list;
}

Represents the minimal ninja build statement representation for Clerk:

build <outputs>: <rule> [<inputs>]
  [<vars>]
val make : outputs:Expr.t list -> rule:string -> t

make ~outputs ~rule returns the corresponding ninja Build.t with no inputs or vars.

val make_with_vars : outputs:Expr.t list -> rule:string -> vars:(string * Expr.t) list -> t

make_with_vars ~outputs ~rule ~vars returns the corresponding ninja Build.t with no inputs.

val make_with_inputs : outputs:Expr.t list -> rule:string -> inputs:Expr.t list -> t

make_with_vars ~outputs ~rule ~inputs returns the corresponding ninja Build.t with no vars.

val make_with_vars_and_inputs : outputs:Expr.t list -> rule:string -> inputs:Expr.t list -> vars:(string * Expr.t) list -> t

make_with_vars ~outputs ~rule ~inputs ~vars returns the corresponding ninja Build.t.

val empty : t

empty is the minimal ninja Build.t with "empty" as outputs and "phony" as rule.

val unpath : ?sep:string -> string -> string

unpath ~sep path replaces all / occurences with sep in path to avoid ninja writing the corresponding file and use it as sub command. By default, sep is set to "-".

val format : Stdlib.Format.formatter -> t -> unit

format fmt build outputs in fmt the string representation of the ninja build.