2018-01-27 07:32:15 -08:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* OCaml *)
|
|
|
|
(* *)
|
|
|
|
(* Sebastien Hinderer, projet Gallium, INRIA Paris *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 2018 Institut National de Recherche en Informatique et *)
|
|
|
|
(* en Automatique. *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. This file is distributed under the terms of *)
|
|
|
|
(* the GNU Lesser General Public License version 2.1, with the *)
|
|
|
|
(* special exception on linking described in the file LICENSE. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
(* Flags used in OCaml commands *)
|
|
|
|
|
|
|
|
let stdlib ocamlsrcdir =
|
|
|
|
let stdlib_path = Ocaml_directories.stdlib ocamlsrcdir in
|
|
|
|
"-nostdlib -I " ^ stdlib_path
|
|
|
|
|
|
|
|
let include_toplevel_directory ocamlsrcdir =
|
|
|
|
"-I " ^ (Ocaml_directories.toplevel ocamlsrcdir)
|
|
|
|
|
|
|
|
let c_includes ocamlsrcdir =
|
|
|
|
let dir = Ocaml_directories.runtime ocamlsrcdir in
|
|
|
|
"-ccopt -I" ^ dir
|
|
|
|
|
2018-02-13 08:26:46 -08:00
|
|
|
let runtime_flags ocamlsrcdir backend c_files = match backend with
|
2018-02-07 08:24:25 -08:00
|
|
|
| Ocaml_backends.Native -> ""
|
2018-02-13 08:26:46 -08:00
|
|
|
| Ocaml_backends.Bytecode ->
|
|
|
|
if c_files then begin (* custm mode *)
|
|
|
|
let runtime_variant = Ocaml_files.runtime_variant() in
|
|
|
|
let variant_flag = match runtime_variant with
|
|
|
|
| Ocaml_files.Normal -> ""
|
|
|
|
| Ocaml_files.Debug -> " -runtime-variant d"
|
|
|
|
| Ocaml_files.Instrumented -> " -runtime-variant i" in
|
|
|
|
"-custom" ^ variant_flag ^ " -I " ^
|
|
|
|
(Ocaml_directories.runtime ocamlsrcdir)
|
|
|
|
(* when using the debug or instrumented runtimes, we need to include
|
|
|
|
the byterun directory so that libcamlrund and libcamlruni
|
|
|
|
can be found. This is not necessary with the normal runtime
|
|
|
|
because libcamlrun is copied to the stdlib directory which
|
|
|
|
will be included anyway
|
|
|
|
*)
|
|
|
|
end else begin (* non-custom mode *)
|
|
|
|
let ocamlrun = Ocaml_files.ocamlrun ocamlsrcdir in
|
|
|
|
"-use-runtime " ^ ocamlrun
|
|
|
|
end
|
|
|
|
|