-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathocaml_flags.ml
60 lines (51 loc) · 2.43 KB
/
ocaml_flags.ml
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
(**************************************************************************)
(* *)
(* 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 =
let stdlib_path = Ocaml_directories.stdlib in
"-nostdlib -I " ^ stdlib_path
let include_toplevel_directory =
"-I " ^ Ocaml_directories.toplevel
let c_includes =
let dir = Ocaml_directories.runtime in
"-ccopt -I" ^ dir
let runtime_variant_flags () = match Ocaml_files.runtime_variant() with
| Ocaml_files.Normal -> ""
| Ocaml_files.Debug -> " -runtime-variant d"
| Ocaml_files.Instrumented -> " -runtime-variant i"
let runtime_flags env backend c_files =
let runtime_library_flags = "-I " ^
Ocaml_directories.runtime in
let rt_flags = match backend with
| Ocaml_backends.Native -> runtime_variant_flags ()
| Ocaml_backends.Bytecode ->
begin
if c_files then begin (* custom mode *)
"-custom " ^ (runtime_variant_flags ())
end else begin (* non-custom mode *)
let use_runtime =
Environments.lookup_as_bool Ocaml_variables.use_runtime env
in
if use_runtime = Some false
then ""
else "-use-runtime " ^ Ocaml_files.ocamlrun
end
end in
rt_flags ^ " " ^ runtime_library_flags
let toplevel_default_flags = "-noinit -no-version -noprompt"
let ocamldebug_default_flags =
"-no-version -no-prompt -no-time -no-breakpoint-message " ^
("-I " ^ Ocaml_directories.stdlib ^ " ")
let ocamlobjinfo_default_flags = "-null-crc"