Make the build script compatible with emacs compile mode.
authorKim Nguyễn <kn@lri.fr>
Tue, 12 Feb 2013 16:31:02 +0000 (17:31 +0100)
committerKim Nguyễn <kn@lri.fr>
Mon, 4 Mar 2013 17:59:44 +0000 (18:59 +0100)
build

diff --git a/build b/build
index f73479d..e1c442e 100755 (executable)
--- a/build
+++ b/build
@@ -7,7 +7,9 @@ let verbose = ref false
 
 let dir = Sys.getcwd ()
 let project_root = Filename.dirname Sys.argv.(0)
-let () = Sys.chdir project_root
+(*  if Filename.is_relative build_path
+  then Filename.concat dir build_path
+  else build_path *)
 
 let () =
   for i = 1 to Array.length Sys.argv - 1 do
@@ -22,9 +24,14 @@ 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 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