C build tool of the 21st century
1open Types
2
3type t =
4 | Build of Build.t
5 | Src of Source_file.t
6 | Obj of Object_file.t
7 | Output of path
8 | External of Build.External.t
9
10let node_id = function
11 | Build b -> "build:" ^ b.name
12 | Src s -> "src:" ^ Eio.Path.native_exn s.path
13 | Obj s -> "obj:" ^ Eio.Path.native_exn s.path
14 | Output s -> "out:" ^ Eio.Path.native_exn s
15 | External e ->
16 "external:" ^ e.Build.External.path ^ ":" ^ e.Build.External.target
17
18type edge =
19 | Script of string * path option
20 | Compiler of Compiler.t * Flags.t option
21 | Linker of Linker.t
22 | Dependency
23
24let edge_id = function
25 | Script (b, output) ->
26 "script:"
27 ^ (Digest.string
28 ((Option.map Eio.Path.native_exn output |> Option.value ~default:"")
29 ^ b)
30 |> Digest.to_hex)
31 | Compiler (c, Some f) ->
32 "compiler:" ^ c.name ^ "_" ^ String.concat "_" f.link
33 ^ String.concat "_" f.compile
34 | Compiler (c, None) -> "compiler:" ^ c.name
35 | Linker link -> "linker:" ^ link.name
36 | Dependency -> "dependency"