Skip to content
This repository
tree: e52bd65cf4
Fetching contributors…

Cannot retrieve contributors at this time

file 69 lines (56 sloc) 2.488 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)
      (* -- Preprocessing -- *)
      let extern_on_windows = false in

      (* pp_script *)

      let mlstate_debug, mlstate_nodebug, pa_ulex =
        if windows_mode then
          let pp_script s=
            let win_exists s = try ignore(Unix.stat s);true with _ -> false in (* under cygwin, Unix.*link* does not work *)
            let location = (Sys.getenv "LIBQML")^"/preprocessing/" in
            location ^ s ^ ".bat"
          in
          (* pre-defined wrapper scripts to workaround the "no space in ppdebug string" bug on windows *)
          (* (they do the same as the commands below) *)
          P (pp_script "mlstate_debug"),
          P (pp_script "mlstate_nodebug"),
          P (pp_script "pa_ulex")
        else
          P (Pathname.pwd/"utils"/"ppdebug.pl"),
          S [ P (Pathname.pwd/"utils"/"ppdebug.pl"); A "-r" ],
          S [ P Config.camlp4o;
              (match Config.Libdir.ulex with
               | Some dir -> S [A "-I"; P dir]
               | None -> N);
              P "pa_ulex.cma"; P "pr_o.cmo" ]
      in

      flag ["ocaml"; "pp"; "with_mlstate_debug"]
        (if List.mem "release" !Options.tags then mlstate_nodebug else mlstate_debug);

      (** Ulex *)

      flag ["ocaml"; "pp"; "use_ulex_pp"] pa_ulex;

    (* This additional rule needs to be after the rule for plugins in
opa. Hence its presence here *)

    (* This rule can probably be improved *)
    rule "ocaml shared object: cmx -> cmxs"
      ~dep: "%.cmx"
      ~prod: "%.cmxs"
      (fun env build ->
         Cmd(S[!Options.ocamlopt;
               T(tags_of_pathname (env "%.cmx"));T(tags_of_pathname (env "%.cmxs"));
               A"-shared";A"-o";P(env "%.cmxs");P(env "%.cmx")]));

    (try set_tool ~internal:false "trx" (Sys.getenv "TRX_OVERRIDE")
     with Not_found -> ());

    ()
  | _ -> ()
end
Something went wrong with that request. Please try again.