forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathocaml_modifiers.ml
144 lines (120 loc) · 4.58 KB
/
ocaml_modifiers.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Sebastien Hinderer, projet Gallium, INRIA Paris *)
(* *)
(* Copyright 2016 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. *)
(* *)
(**************************************************************************)
(* Definition of a few OCaml-specific environment modifiers *)
open Ocamltest_stdlib
open Environments
let principal =
[
Append (Ocaml_variables.flags, " -principal ");
Add (Ocaml_variables.compiler_directory_suffix, ".principal");
Add (Ocaml_variables.compiler_reference_suffix, ".principal");
]
let latex =
[
Add (Ocaml_variables.ocamldoc_backend, "latex");
Append (Ocaml_variables.ocamldoc_flags, "-latex-type-prefix=TYP ");
Append (Ocaml_variables.ocamldoc_flags, "-latex-module-prefix= ");
Append (Ocaml_variables.ocamldoc_flags, "-latex-value-prefix= ");
Append (Ocaml_variables.ocamldoc_flags, "-latex-module-type-prefix= ");
Append (Ocaml_variables.ocamldoc_flags, "-latextitle=1,subsection* ");
Append (Ocaml_variables.ocamldoc_flags, "-latextitle=2,subsubsection* ");
Append (Ocaml_variables.ocamldoc_flags, "-latextitle=6,subsection* ");
Append (Ocaml_variables.ocamldoc_flags, "-latextitle=7,subsubsection* ");
]
let html =
[
Add (Ocaml_variables.ocamldoc_backend, "html");
Append (Ocaml_variables.ocamldoc_flags, "-colorize-code ");
]
let man =
[
Add (Ocaml_variables.ocamldoc_backend, "man");
]
let wrap str = (" " ^ str ^ " ")
let make_library_modifier library directory =
[
Append (Ocaml_variables.directories, (wrap directory));
Append (Ocaml_variables.libraries, (wrap library));
Append (Ocaml_variables.caml_ld_library_path, (wrap directory));
]
let make_module_modifier unit_name directory =
[
Append (Ocaml_variables.directories, (wrap directory));
Append (Ocaml_variables.binary_modules, (wrap unit_name));
]
let compiler_subdir subdir =
Filename.make_path (Ocamltest_config.ocamlsrcdir :: subdir)
let config =
[
Append (Ocaml_variables.directories, (wrap (compiler_subdir ["utils"])));
]
let testing = make_library_modifier
"testing" (compiler_subdir ["testsuite"; "lib"])
let tool_ocaml_lib = make_module_modifier
"lib" (compiler_subdir ["testsuite"; "lib"])
let unixlibdir = if Sys.os_type="Win32" then "win32unix" else "unix"
let unix = make_library_modifier
"unix" (compiler_subdir ["otherlibs"; unixlibdir])
let dynlink =
make_library_modifier "dynlink" (compiler_subdir ["otherlibs"; "dynlink"])
let str = make_library_modifier
"str" (compiler_subdir ["otherlibs"; "str"])
let systhreads =
unix @
(make_library_modifier
"threads" (compiler_subdir ["otherlibs"; "systhreads"]))
let compilerlibs_subdirs =
[
"asmcomp";
"bytecomp";
"compilerlibs";
"driver";
"file_formats";
"lambda";
"middle_end";
"parsing";
"toplevel";
"typing";
"utils";
]
let add_compiler_subdir subdir =
Append (Ocaml_variables.directories, (wrap (compiler_subdir [subdir])))
let compilerlibs_archive archive =
(Append (Ocaml_variables.libraries, wrap archive)) ::
(List.map add_compiler_subdir compilerlibs_subdirs)
let debugger = [add_compiler_subdir "debugger"]
let _ =
register_modifiers "principal" principal;
register_modifiers "config" config;
register_modifiers "testing" testing;
register_modifiers "unix" unix;
register_modifiers "dynlink" dynlink;
register_modifiers "str" str;
List.iter
(fun archive -> register_modifiers archive (compilerlibs_archive archive))
[
"ocamlcommon";
"ocamlbytecomp";
"ocamlmiddleend";
"ocamloptcomp";
"ocamltoplevel";
];
register_modifiers "systhreads" systhreads;
register_modifiers "latex" latex;
register_modifiers "html" html;
register_modifiers "man" man;
register_modifiers "tool-ocaml-lib" tool_ocaml_lib;
register_modifiers "debugger" debugger;
()