Clean-up the build system.
[tatoo.git] / build
diff --git a/build b/build
new file mode 100755 (executable)
index 0000000..ed3876a
--- /dev/null
+++ b/build
@@ -0,0 +1,24 @@
+#!/usr/bin/env ocaml
+
+let target = ref "main.otarget"
+let debug = ref false
+let profile = ref false
+let verbose = ref false
+
+let () =
+  for i = 1 to Array.length Sys.argv - 1 do
+    match Sys.argv.(i) with
+    | "-d" -> debug := true
+    | "-p" -> profile := true
+    | "-v" -> verbose := true
+    | x -> target := x
+  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 overbose = if !verbose then " -classic-display " else ""
+
+let cmd = "ocamlbuild -use-ocamlfind " ^ overbose ^ oprofile ^ odebug ^ otarget
+let _ = Sys.command cmd
+