myocamlbuild.ml 402 Bytes
Newer Older
bguillaum's avatar
bguillaum committed
1 2 3 4 5 6 7 8 9 10 11
open Ocamlbuild_plugin
 
let get_version () =
  let in_ch = open_in "VERSION" in
  let v = input_line in_ch in
  close_in in_ch;
  v

let () =
  dispatch begin function
  | After_rules ->
12
    let version = "\""^(get_version ())^"\"" in
bguillaum's avatar
bguillaum committed
13
    let pp_src = S[A"-pp"; A("cppo -D 'VERSION "^version^"'")] in
bguillaum's avatar
bguillaum committed
14 15 16 17
    flag ["ocaml"; "ocamldep"] & pp_src;
    flag ["ocaml"; "compile"] & pp_src; 
  | _ -> ()
  end