X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=build;h=d5eb3a558fe1345e9a71fdf47ef0488f7aebe69d;hp=f73479db67ac923388f1b3a44b46b2e66b23bc45;hb=3a9b1a559d76758c1e8fb01f7f4b09fe976aaff7;hpb=22783ce35e6d14fc45d4d612a4030c0c3fe8adfe diff --git a/build b/build index f73479d..d5eb3a5 100755 --- a/build +++ b/build @@ -1,13 +1,12 @@ #!/usr/bin/env ocaml -let target = ref "main.otarget" +let target = ref [ "main.otarget" ] let debug = ref false let profile = ref false let verbose = ref false let dir = Sys.getcwd () let project_root = Filename.dirname Sys.argv.(0) -let () = Sys.chdir project_root let () = for i = 1 to Array.length Sys.argv - 1 do @@ -15,16 +14,23 @@ let () = | "-d" -> debug := true | "-p" -> profile := true | "-v" -> verbose := true - | x -> target := x + | x -> target := x :: !target done let oprofile = if !profile then " -tag profile " else "" let odebug = if !profile then " -tag debug " else "" -let otarget = if !target = "clean" then " -clean " else !target +let otarget = List.fold_left (fun acc t -> + let t = if t = "clean" then "-clean" else t in + t ^ " " ^ acc) "" !target let overbose = if !verbose then " -classic-display " else "" +let () = + Sys.chdir project_root; + Printf.printf "Entering directory `%s'\n%!" project_root -let cmd = "ocamlbuild -use-ocamlfind " ^ overbose ^ oprofile ^ odebug ^ otarget +let cmd = Printf.sprintf "ocamlbuild -use-ocamlfind %s %s %s %s" + overbose oprofile odebug otarget let i = Sys.command cmd -let () = Sys.chdir dir +let () = Sys.chdir dir; + Printf.printf "Leaving directory `%s'\n%!" project_root let _ = exit i