1 let start = Unix.gettimeofday
();;
9 let jobs, targets
, dodeplist
, dotarlist
= getopt
();;
12 match getval key
with | None
-> failwith msg
| Some s
-> s
16 match getval key
with | None
-> def
| Some s
-> s
19 let srcdir = get "src" "no source dir";;
20 let cc = getdef "cc" "cc";;
21 let ccopt = getdef "ccopt" "";;
22 let mupdflibpath = get "mupdflibpath" "no mupdf libpath";;
23 let libs = getdef "libs" "";;
30 ("-cc '" ^
cc ^
"' -ccopt '" ^ flags ^
" " ^
ccopt ^
" -o " ^
o ^
"'")
33 [Filename.concat
srcdir c]
38 let ocaml1 prog flags1 flags2 mainoutput outputs inputs deps f
=
39 let flags = flags1 ^
" -o " ^
Filename.quote mainoutput
in
42 let s = String.concat
" " (map
Filename.quote
(f
())) in
43 [Run
(prog ^
" " ^
flags ^
" " ^
s ^ flags2
)]
45 let cookie _
= prog ^
flags in
46 let presentation _
= "OCAMLC " ^ mainoutput
in
47 { get_commands
= commands
49 ; get_presentation
= presentation
52 let inputs = fold_right
StrSet.add
inputs StrSet.empty
in
53 let deps = StrSet.union
inputs deps in
54 StrSet.iter
(fun output
->
55 put_build_info output
build;
56 let deps = StrSet.remove output
deps in
57 add_target output
inputs outputs
deps
61 let ocaml' prog flags1 flags2 mainoutput outputs
inputs deps =
62 ocaml1 prog flags1 flags2 mainoutput outputs
inputs deps (fun () -> inputs)
66 let so = name ^
".so" in
68 " -L" ^
mupdflibpath ^
" " ^
libs
70 let o = List.map
(fun s -> s ^
".o") objs
in
73 ("-shared -lpthread -o " ^
so ^
mupdf_libs)
78 (StrSet.singleton
(Filename.concat
mupdflibpath "libmupdf.a"))
85 let so = bso "link" ["link"] in
89 ("-g -I +lablGL lablgl.cma lablglut.cma str.cma unix.cma -dllpath "
92 (StrSet.singleton name
)
97 cmopp ~
flags:"-g -w y -I +lablGL -thread" ~dirname
:srcdir "main";
100 prog "llpp" [so; main];
105 c cc "-c -Wall -Werror -Wextra -g" srcdir "test";
109 c cc "-c -Wall -Werror -Wextra -g" srcdir "testgl";
117 ~flags2
:"-lX11 -lXext"
121 let proggl name
objs =
126 ~flags2
:"-lX11 -lXext -lGL"
131 proggl "testgl" objsgl;
135 run
start jobs targets dodeplist dotarlist
;