Consistency
[dormin.git] / build.ml
blob58c12f9855d5da32a6fa92431930cedd24273b3d
1 let start = Unix.gettimeofday ();;
2 open List;;
3 open Typs;;
4 open Utils;;
5 open State;;
6 open Helpers;;
8 let jobs, targets, dodeplist, dotarlist = getopt ();;
10 let get key msg =
11 match getval key with | None -> failwith msg | Some s -> s
14 let getdef key def =
15 match getval key with | None -> def | Some s -> s
18 let srcdir = get "src" "no source dir";;
19 let cc = getdef "cc" "cc";;
20 let ccopt = getdef "ccopt" "";;
22 let boc flags src =
23 let o = src ^ ".o" in
24 let c = src ^ ".c" in
25 ocaml
26 "ocamlc.opt"
27 ("-cc " ^ cc ^ " -ccopt '" ^ flags ^ " " ^ ccopt ^ " -o " ^ o ^ "'")
29 (StrSet.singleton o)
30 [Filename.concat srcdir c]
32 if src = "skin"
33 then StrSet.singleton (Filename.concat srcdir "vec.c")
34 else StrSet.empty
39 let bso src =
40 let so = src ^ ".so" in
41 let so = Filename.concat (Sys.getcwd ()) so in
42 let o = src ^ ".o" in
43 ocaml
45 ("-shared -o " ^ so)
47 (StrSet.singleton so)
48 [o]
49 StrSet.empty
54 let _ =
55 List.iter (fun src ->
56 cmopp ~flags:"-g -I +lablGL -thread" ~dirname:srcdir src)
57 ["xff"; "nto"; "nmo"; "slice"; "rend"; "vec"; "skb"; "qtr"; "anb"; "skin"]
59 boc "-g" "swizzle";
60 boc "-g" "skin";
61 let so = bso "swizzle" in
62 let so1 = bso "skin" in
63 let prog name cmos =
64 ocaml
65 "ocamlc.opt"
66 ("-g -I +lablGL lablgl.cma lablglut.cma unix.cma")
67 name
68 (StrSet.singleton name)
69 (State.dep_sort cmos)
70 StrSet.empty
72 prog "dormin" ["slice.cmo"; "xff.cmo"; "nto.cmo"; "rend.cmo";
73 "vec.cmo"; "anb.cmo"; "skb.cmo"; "skin.cmo";
74 "nmo.cmo"; "qtr.cmo";
75 so; so1];
79 let () =
80 Helpers.run start jobs targets dodeplist dotarlist