Fix strtol failure condition check
[apc.git] / build.ml
blob700c1baa039e933b9acbd15a0f5df624b3afa5e2
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 srcdir =
11 match getval "src" with
12 | None -> failwith "no source dir"
13 | Some s -> s
16 let _ =
17 cmopp ~flags:"-g -I +lablGL -thread" ~dirname:srcdir "apc";
18 ocaml
19 "ocamlc.opt"
20 "-ccopt '-Wall -o ml_apc.o'"
21 "ml_apc.o"
22 (StrSet.singleton "ml_apc.o")
23 [Filename.concat srcdir "ml_apc.c"]
24 StrSet.empty
26 let prog base =
27 gcc "gcc" true
28 "-Wall -Werror -g -c" ""
29 (base ^ ".o")
30 [Filename.concat srcdir (base ^ ".c")]
32 gcc "gcc" false
33 "" ""
34 base
35 [base ^ ".o"]
38 prog "hog";
39 prog "idlestat";
40 ocaml
41 "ocamlc.opt"
42 "-custom -thread -g -I +lablGL lablgl.cma lablglut.cma unix.cma threads.cma"
43 "apc"
44 (StrSet.singleton "apc")
45 ["ml_apc.o"; "apc.cmo"]
46 StrSet.empty
48 let _ =
49 let moddir = Filename.concat srcdir "mod" in
50 let modconts = Sys.readdir moddir in
51 let deps = Array.fold_left (fun deps s ->
52 if String.length s > 0 && s.[0] != '.'
53 then
54 let src = Filename.concat moddir s in
55 add_target s (StrSet.singleton src) (StrSet.singleton s) (StrSet.singleton src);
56 let build =
57 let commands _ =
58 [Run ("cp " ^ Filename.quote src ^ " " ^ Filename.quote s)]
59 and cookie _ = "cp"
60 and presentation _ =
61 "COPY"
63 { get_commands = commands
64 ; get_cookie = cookie
65 ; get_presentation = presentation
68 State.put_build_info s build;
69 StrSet.add s deps
70 else
71 deps
72 ) StrSet.empty modconts
74 let build =
75 let commands _ = [Run ("make")]
76 and cookie _ = "make"
77 and presentation _ = "KBUILD" in
78 { get_commands = commands
79 ; get_cookie = cookie
80 ; get_presentation = presentation
83 add_phony "mod" deps "";
84 State.put_build_info "mod" build;
89 let () =
90 Helpers.run start jobs targets dodeplist dotarlist