1 (***********************************************************************)
4 (* Nicolas Pouillard, Berke Durak, projet Gallium, INRIA Rocquencourt *)
6 (* Copyright 2007 Institut National de Recherche en Informatique et *)
7 (* en Automatique. All rights reserved. This file is distributed *)
8 (* under the terms of the Q Public License version 1.0. *)
10 (***********************************************************************)
13 (* Original author: Nicolas Pouillard *)
17 type env = Pathname.t -> Pathname.t
18 type builder = Pathname.t list list -> (Pathname.t, exn) Outcome.t list
19 type action = env -> builder -> Command.t
23 type rule = Pathname.t gen_rule
24 type rule_scheme = resource_pattern gen_rule
26 type 'a rule_printer = (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a gen_rule -> unit
28 (** This exception can be raised inside the action of a rule to make the
29 algorithm skip this rule. *)
32 val name_of_rule : 'a gen_rule -> string
33 val deps_of_rule : 'a gen_rule -> Pathname.t list
34 val prods_of_rule : 'a gen_rule -> 'a list
43 ?insert:[`top | `before of string | `after of string | `bottom] ->
46 (** [copy_rule name ?insert source destination] *)
47 val copy_rule : string ->
48 ?insert:[`top | `before of string | `after of string | `bottom] ->
49 string -> string -> unit
51 module Common_commands : sig
52 val mv : Pathname.t -> Pathname.t -> Command.t
53 val cp : Pathname.t -> Pathname.t -> Command.t
54 val cp_p : Pathname.t -> Pathname.t -> Command.t
55 val ln_f : Pathname.t -> Pathname.t -> Command.t
56 val ln_s : Pathname.t -> Pathname.t -> Command.t
57 val rm_f : Pathname.t -> Command.t
58 val chmod : Command.spec -> Pathname.t -> Command.t
59 val cmp : Pathname.t -> Pathname.t -> Command.t
62 val print : Format.formatter -> rule -> unit
63 val pretty_print : 'a rule_printer
65 (** For system use only *)
67 val subst : Resource.env -> rule_scheme -> rule
68 val can_produce : Pathname.t -> rule_scheme -> rule option
69 (* val tags_matches : Tags.t -> t -> t option *)
70 val compare : 'a gen_rule -> 'a gen_rule -> int
72 val print_rule_name : Format.formatter -> 'a gen_rule -> unit
73 val print_rule_contents : 'a rule_printer
75 val get_rules : unit -> rule_scheme list
76 val clear_rules : unit -> unit
78 val call : builder -> rule -> unit
80 val build_deps_of_tags : builder -> Tags.t -> Pathname.t list