ocamltest: define a file type for object files

master
Sébastien Hinderer 2018-04-16 15:46:41 +02:00
parent 9bcf7c5dbb
commit 943cb5436e
3 changed files with 8 additions and 2 deletions

View File

@ -152,7 +152,7 @@ let prepare_module ocamlsrcdir output_variable log env input =
let input_type = snd input in
let open Ocaml_filetypes in
match input_type with
| Implementation | Interface | C -> [input]
| Implementation | Interface | C | Obj -> [input]
| Binary_interface -> [input]
| Backend_specific _ -> [input]
| C_minus_minus -> assert false

View File

@ -25,6 +25,7 @@ type t =
| Lexer
| Grammar
| Binary_interface
| Obj
| Backend_specific of Ocaml_backends.t * backend_specific
| Text (* used by ocamldoc for text only documentation *)
@ -41,6 +42,7 @@ let string_of_filetype = function
| Lexer -> "lexer"
| Grammar -> "grammar"
| Binary_interface -> "binary interface"
| Obj -> "object"
| Backend_specific (backend, filetype) ->
((Ocaml_backends.string_of_backend backend) ^ " " ^
(string_of_backend_specific filetype))
@ -54,6 +56,7 @@ let extension_of_filetype = function
| Lexer -> "mll"
| Grammar -> "mly"
| Binary_interface -> "cmi"
| Obj -> Ocamltest_config.objext
| Backend_specific (backend, filetype) ->
begin match (backend, filetype) with
| (Ocaml_backends.Native, Object) -> "cmx"
@ -73,6 +76,8 @@ let filetype_of_extension = function
| "mll" -> Lexer
| "mly" -> Grammar
| "cmi" -> Binary_interface
| "o" -> Obj
| "obj" -> Obj
| "cmx" -> Backend_specific (Ocaml_backends.Native, Object)
| "cmxa" -> Backend_specific (Ocaml_backends.Native, Library)
| "opt" -> Backend_specific (Ocaml_backends.Native, Program)
@ -80,7 +85,7 @@ let filetype_of_extension = function
| "cma" -> Backend_specific (Ocaml_backends.Bytecode, Library)
| "byte" -> Backend_specific (Ocaml_backends.Bytecode, Program)
| "txt" -> Text
| _ -> raise Not_found
| _ as e -> Printf.eprintf "Unknown file extension %s\n%!" e; exit 2
let split_filename name =
let l = String.length name in

View File

@ -25,6 +25,7 @@ type t =
| Lexer
| Grammar
| Binary_interface
| Obj
| Backend_specific of Ocaml_backends.t * backend_specific
| Text (** text-only documentation file *)