myocamlbuild.ml 463 Bytes
Newer Older
1
open Ocamlbuild_plugin
2

3 4 5 6 7 8 9 10 11 12 13
let read file =
  let in_ch = open_in file in
  try
    let v = input_line in_ch in
    close_in in_ch;
    v
  with End_of_file -> failwith ("Error loading file: "^file)

let () =
  dispatch begin function
  | After_rules ->
14 15
    let version = "\""^(read "VERSION")^"\"" in
    let pp_src = S[A"-pp"; A("cppo -D 'VERSION "^version^"'")] in
16
    flag ["ocaml"; "ocamldep"] & pp_src;
17
    flag ["ocaml"; "compile"] & pp_src;
18 19
  | _ -> ()
  end