From: Jérémie D. <Ba...@us...> - 2010-02-11 08:14:40
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 5dfa179cb90bb249bdbccdf7d1e18818a9854581 (commit) from 5fb766cfa9a3523c9143ff2aae1e0b3cd343b693 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5dfa179cb90bb249bdbccdf7d1e18818a9854581 Author: Jérémie Dimino <je...@di...> Date: Thu Feb 11 09:14:13 2010 +0100 [clients] enable conditionnal compilation ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/clients/myocamlbuild.ml b/PC_Mainboard/clients/myocamlbuild.ml index 5da00b7..c1df199 100644 --- a/PC_Mainboard/clients/myocamlbuild.ml +++ b/PC_Mainboard/clients/myocamlbuild.ml @@ -11,6 +11,53 @@ open Printf open Ocamlbuild_plugin (* +-----------------------------------------------------------------+ + | Configuration | + +-----------------------------------------------------------------+ *) + +let try_exec command = + try + let () = Command.execute ~quiet:true (Cmd(S[Sh command; Sh"> /dev/null"; Sh"2> /dev/null"])) in + true + with _ -> + false + +let () = + if not (try_exec "ocamlfind printconf") then begin + prerr_endline "ocamlfind is not available, please install it"; + exit 1 + end + +let have_native = try_exec "ocamlfind ocamlopt -version" +let have_sdl = try_exec "ocamlfind query sdl" +let have_obus = try_exec "ocamlfind query obus" +let have_lwt_text = try_exec "ocamlfind query lwt.text" + +let () = + let yes_no = function true -> "yes" | false -> "no" in + printf "\ ++--[ compilation options ]----------+ +| native compilation: %3s | +| SDL (joystick): %3s | +| OBus: %3s | +| Lwt.text %3s | ++-----------------------------------+ +%!" (yes_no have_native) + (yes_no have_sdl) + (yes_no have_obus) + (yes_no have_lwt_text) + +let targets = List.filter_opt (function (true, target) -> Some target | (false, target) -> None) [ + (have_obus, "lib-krobot/krobot.cma"); + (have_obus && have_native, "lib-krobot/krobot.cmxa"); + (have_obus, "tools/status.best"); + (have_obus && have_lwt_text, "tools/controller.best"); + (have_obus, "remote/forward_dbus.best"); + (have_obus && have_sdl, "tools/joy_control.best"); + (have_obus, "security/hard_stop.best"); + (have_obus, "tools/init_position.best"); +] + +(* +-----------------------------------------------------------------+ | Ocamlfind | +-----------------------------------------------------------------+ *) @@ -89,20 +136,18 @@ let _ = | Virtual targets | +---------------------------------------------------------+ *) + if have_native then + rule "best" ~dep:"%.native" ~prod:"%.best" + (fun env _ -> cp (env "%.native") (env "%.best")) + else + rule "best" ~dep:"%.byte" ~prod:"%.best" + (fun env _ -> cp (env "%.byte") (env "%.best")); + let virtual_rule name deps = rule name ~stamp:name ~deps (fun _ _ -> Nop) in - virtual_rule "all" [ - "lib-krobot/krobot.cma"; - "lib-krobot/krobot.cmxa"; - "tools/status.native"; - "tools/controller.native"; - "remote/forward_dbus.native"; - "tools/joy_control.native"; - "security/hard_stop.native"; - "tools/init_position.native"; - ]; + virtual_rule "all" targets; (* +---------------------------------------------------------+ | Ocamlfind stuff | hooks/post-receive -- krobot |