From 22783ce35e6d14fc45d4d612a4030c0c3fe8adfe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kim=20Nguy=E1=BB=85n?= Date: Fri, 8 Feb 2013 18:43:27 +0100 Subject: [PATCH] Build script can be called from a subdirectory of the project root. --- build | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build b/build index ed3876a..f73479d 100755 --- a/build +++ b/build @@ -5,6 +5,10 @@ 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 match Sys.argv.(i) with @@ -20,5 +24,7 @@ let otarget = if !target = "clean" then " -clean " else !target let overbose = if !verbose then " -classic-display " else "" let cmd = "ocamlbuild -use-ocamlfind " ^ overbose ^ oprofile ^ odebug ^ otarget -let _ = Sys.command cmd +let i = Sys.command cmd +let () = Sys.chdir dir +let _ = exit i -- 2.17.1