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";;
29 ("-cc '" ^
cc ^
"' -ccopt '" ^ flags ^
" " ^
ccopt ^
" -o " ^
o ^
"'")
32 [Filename.concat
srcdir c]
37 let ocaml1 prog flags1 flags2 mainoutput outputs inputs deps f
=
38 let flags = flags1 ^
" -o " ^
Filename.quote mainoutput
in
41 let s = String.concat
" " (map
Filename.quote
(f
())) in
42 [Run
(prog ^
" " ^
flags ^
" " ^
s ^ flags2
)]
44 let cookie _
= prog ^
flags in
45 let presentation _
= "OCAMLC " ^ mainoutput
in
46 { get_commands
= commands
48 ; get_presentation
= presentation
51 let inputs = fold_right
StrSet.add
inputs StrSet.empty
in
52 let deps = StrSet.union
inputs deps in
53 StrSet.iter
(fun output
->
54 put_build_info output
build;
55 let deps = StrSet.remove output
deps in
56 add_target output
inputs outputs
deps
60 let ocaml' prog flags1 flags2 mainoutput outputs
inputs deps =
61 ocaml1 prog flags1 flags2 mainoutput outputs
inputs deps (fun () -> inputs)
65 let so = name ^
".so" in
67 " -L" ^
mupdflibpath ^
68 " -lmupdf -lopenjpeg -ljbig2dec -ljpeg -lz -lfreetype"
70 let o = List.map
(fun s -> s ^
".o") objs
in
73 ("-shared -lpthread -o " ^
so ^
mupdf_libs)
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
;