summaryrefslogtreecommitdiff
path: root/ocamltest/ocaml_variables.ml
blob: b9515629171d7bace290f0197bf946e3a72ca892 (plain)
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
(**************************************************************************)
(*                                                                        *)
(*                                 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 variables used by built-in actions *)

(* The variables are listed in alphabetical order *)

(*
  The name of the identifier representing a variable and its string name
  should be similar. Is there a way to enforce this?
*)

open Ocamltest_stdlib

open Variables (* Should not be necessary with a ppx *)

let all_modules = make ("all_modules",
  "All the modules to compile and link")

let arch = make ("arch",
  "Host architecture")

let binary_modules = make ("binary_modules",
  "Additional binary modules to link")

let bytecc_libs = make ("bytecc_libs",
  "Libraries to link with for bytecode")

let c_preprocessor = make ("c_preprocessor",
  "Command to use to invoke the C preprocessor")

let caml_ld_library_path_name = "CAML_LD_LIBRARY_PATH"

let export_caml_ld_library_path value =
  let current_value = Sys.safe_getenv caml_ld_library_path_name in
  let local_value =
    (String.concat Filename.path_sep (String.words value)) in
  let new_value =
    if local_value="" then current_value else
    if current_value="" then local_value else
    String.concat Filename.path_sep [local_value; current_value] in
  Printf.sprintf "%s=%s" caml_ld_library_path_name new_value

let caml_ld_library_path =
  make_with_exporter
    export_caml_ld_library_path
    ("ld_library_path",
      "List of paths to lookup for loading dynamic libraries")

let compare_programs = make ("compare_programs",
  "Set to \"false\" to disable program comparison")

let compiler_directory_suffix = make ("compiler_directory_suffix",
  "Suffix to add to the directory where the test will be compiled")

let compiler_reference = make ("compiler_reference",
  "Reference file for compiler output for ocamlc.byte and ocamlopt.byte")

let compiler_reference2 = make ("compiler_reference2",
  "Reference file for compiler output for ocamlc.opt and ocamlopt.opt")

let compiler_reference_suffix = make ("compiler_reference_suffix",
  "Suffix to add to the file name containing the reference for compiler output")

let compiler_output = make ("compiler_output",
  "Where to log output of bytecode compilers")

let compiler_output2 = make ("compiler_output2",
  "Where to log output of native compilers")

let compiler_stdin = make ("compiler_stdin",
  "standard input of compilers")

let compile_only = make ("compile_only",
  "Compile only (do not link)")

let csc = make ("csc", "Path to the CSharp compiler")

let csc_flags = make ("csc_flags", "Flags for the CSharp compiler")

let directories = make ("directories",
  "Directories to include by all the compilers")

let flags = make ("flags",
  "Flags passed to all the compilers")

let last_flags = make ("last_flags",
  "Flags passed to all the compilers at the end of the commandline")

let libraries = make ("libraries",
  "Libraries the program should be linked with")

let mkdll = make ("mkdll",
  "Command to use to build a DLL")

let mkexe = make ("mkexe",
  "Command used to build an executable program DLL")

let module_ = make ("module",
  "Compile one module at once")

let modules = make ("modules",
  "Other modules of the test")

let nativecc_libs = make ("nativecc_libs",
  "Libraries to link with for native code")

let objext = make ("objext",
  "Extension of object files")

let asmext = make ("asmext",
  "Extension of assembly files")

let ocamlc_byte = make ("ocamlc_byte",
  "Path of the ocamlc.byte executable")

let ocamlopt_byte = make ("ocamlopt_byte",
  "Path of the ocamlopt.byte executable")

let ocamlrun = make ("ocamlrun",
  "Path of the ocamlrun executable")

let ocamlc_flags = make ("ocamlc_flags",
  "Flags passed to ocamlc.byte and ocamlc.opt")

let ocamlc_default_flags = make ("ocamlc_default_flags",
  "Flags passed by default to ocamlc.byte and ocamlc.opt")



let ocamllex_flags = make ("ocamllex_flags",
  "Flags passed to ocamllex")

let ocamlopt_flags = make ("ocamlopt_flags",
  "Flags passed to ocamlopt.byte and ocamlopt.opt")

let ocamlopt_default_flags = make ("ocamlopt_default_flags",
  "Flags passed by default to ocamlopt.byte and ocamlopt.opt")

let ocamlyacc_flags = make ("ocamlyacc_flags",
  "Flags passed to ocamlyacc")

let ocaml_exit_status = make ("ocaml_exit_status",
  "Expected exit status of ocaml")

let ocaml_filetype_flag = make ("ocaml_filetype_flag",
  "Filetype of the testfile (-impl, -intf, etc.)")

let ocamlc_byte_exit_status = make ("ocamlc_byte_exit_status",
  "Expected exit status of ocac.byte")

let ocamlopt_byte_exit_status = make ("ocamlopt_byte_exit_status",
  "Expected exit status of ocamlopt.byte")

let ocamlnat_exit_status = make ("ocamlnat_exit_status",
  "Expected exit status of ocamlnat")

let ocamlc_opt_exit_status = make ("ocamlc_opt_exit_status",
  "Expected exit status of ocac.opt")

let ocamlopt_opt_exit_status = make ("ocamlopt_opt_exit_status",
  "Expected exit status of ocamlopt.opt")

let export_ocamlrunparam value =
  Printf.sprintf "%s=%s" "OCAMLRUNPARAM" value

let ocamlrunparam =
  make_with_exporter
    export_ocamlrunparam
    ("ocamlrunparam",
      "Equivalent of OCAMLRUNPARAM")

let ocamlsrcdir = make ("ocamlsrcdir",
  "Where OCaml sources are")

let ocamldebug_flags = make ("ocamldebug_flags",
  "Flags for ocamldebug")

let ocamldebug_script = make ("ocamldebug_script",
  "Where ocamldebug should read its commands")

let os_type = make ("os_type",
  "The OS we are running on")

let ocamldoc_flags = Variables.make ("ocamldoc_flags",
  "ocamldoc flags")

let ocamldoc_backend = Variables.make ("ocamldoc_backend",
  "ocamldoc backend (html, latex, man, ... )")

let ocamldoc_exit_status =
  Variables.make ( "ocamldoc_exit_status", "expected ocamldoc exit status")

let ocamldoc_output =
  Variables.make ( "ocamldoc_output", "Where to log ocamldoc output")

let ocamldoc_reference =
  Variables.make ( "ocamldoc_reference",
                   "Where to find expected ocamldoc output")

let ocaml_script_as_argument =
  Variables.make ( "ocaml_script_as_argument",
    "Whether the ocaml script should be passed as argument or on stdin")

let plugins =
  Variables.make ( "plugins", "plugins for ocamldoc" )

let shared_library_cflags =
  Variables.make ("shared_library_cflags",
    "Flags used to compile C files for inclusion in shared libraries")

let sharedobjext =
  Variables.make ("sharedobjext",
    "Extension of shared object files")

let use_runtime =
  Variables.make ("use_runtime",
    "Whether the -use-runtime option should be used" )

let _ = List.iter register_variable
  [
    all_modules;
    arch;
    binary_modules;
    bytecc_libs;
    c_preprocessor;
    caml_ld_library_path;
    compare_programs;
    compiler_directory_suffix;
    compiler_reference;
    compiler_reference2;
    compiler_reference_suffix;
    compiler_output;
    compiler_output2;
    compiler_stdin;
    compile_only;
    csc;
    csc_flags;
    directories;
    flags;
    last_flags;
    libraries;
    mkdll;
    module_;
    modules;
    nativecc_libs;
    objext;
    asmext;
    ocamlc_byte;
    ocamlopt_byte;
    ocamlrun;
    ocamlc_flags;
    ocamlc_default_flags;
    ocamlopt_flags;
    ocamlopt_default_flags;
    ocaml_exit_status;
    ocaml_filetype_flag;
    ocamlc_byte_exit_status;
    ocamlopt_byte_exit_status;
    ocamlnat_exit_status;
    ocamlc_opt_exit_status;
    ocamlopt_opt_exit_status;
    ocamlrunparam;
    ocamllex_flags;
    ocamlyacc_flags;
    ocamldoc_flags;
    ocamldoc_backend;
    ocamldoc_output;
    ocamldoc_reference;
    ocamldoc_exit_status;
    ocamldebug_flags;
    ocamldebug_script;
    ocaml_script_as_argument;
    os_type;
    plugins;
    shared_library_cflags;
    sharedobjext;
    use_runtime;
  ]