text stringlengths 12 786k |
|---|
let ocamldoc_plugin name = name ^ " . cmo " |
let ocamldoc_backend_flag env = let backend = Environments . safe_lookup Ocaml_variables . ocamldoc_backend env in if backend = " " then " " else " " - ^ backend |
let ocamldoc_o_flag env = let output = Environments . safe_lookup Builtin_variables . output env in match Environments . safe_lookup Ocaml_variables . ocamldoc_backend env with | " html " | " manual " -> " index " | _ -> output |
let run_ocamldoc = Actions . make " ocamldoc " @@ fun log env -> let modules = List . map Ocaml_filetypes . filetype @@ modules env in let plugins = List . map Ocaml_filetypes . filetype @@ plugins env in let ( r , env ) = compiler_for_ocamldoc plugins log env in if not ( Result . is_pas... |
let _ = Environments . register_initializer Environments . Post " find_source_modules " find_source_modules ; Environments . register_initializer Environments . Pre " config_variables " config_variables ; List . iter register [ setup_ocamlc_byte_build_env ; ocamlc_byte ; check_ocamlc_byte_... |
type ' a arch = | Arch_dir of string * ' a * ' a arch list | Arch_dir_pack of string * ' a * ' a arch list | Arch_file of string * ' a |
let dir name contents = Arch_dir ( name , ( ) , contents ) |
let dir_pack name contents = Arch_dir_pack ( name , ( ) , contents ) |
let file name = Arch_file ( name , ( ) ) |
type info = { current_path : string ; include_dirs : string list ; for_pack : string ; } |
let join_pack parent base = if parent = " " then base else parent ^ " . " ^ base |
let annotate arch = let rec self arch acc = match arch with | Arch_dir_pack ( name , _ , contents ) -> let acc = { ( acc ) with for_pack = join_pack acc . for_pack name } in let ( _ , _ , i , new_contents ) = self_contents name contents acc in ( [ ] , Arch_dir_pack ( name... |
let rec print print_info f = let rec print_contents f = function | [ ] -> ( ) | x :: xs -> Format . fprintf f " @ % a % a " ( print print_info ) x print_contents xs in function | Arch_dir ( name , info , contents ) -> Format . fprintf f " [ @< v2 > dir % S % a % a ] " ... |
let print_include_dirs = List . print String . print |
let print_info f i = Format . fprintf f " @ [ @< v2 { > [ @< 2 > current_path =@ % S ] ; @@\ \ [ @< 2 > include_dirs =@ % a ] ; @@\ \ [ @< 2 > for_pack =@ % S ] @ } ] " @ i . current_path print_include_dirs i . include_dirs i . for_pack |
let rec iter_info f = function | Arch_dir_pack ( _ , i , xs ) | Arch_dir ( _ , i , xs ) -> f i ; List . iter ( iter_info f ) xs | Arch_file ( _ , i ) -> f i |
let rec fold_info f arch acc = match arch with | Arch_dir_pack ( _ , i , xs ) | Arch_dir ( _ , i , xs ) -> List . fold_right ( fold_info f ) xs ( f i acc ) | Arch_file ( _ , i ) -> f i acc |
let iter_include_dirs arch = let set = fold_info ( fun i -> List . fold_right SS . add i . include_dirs ) arch SS . empty in fun f -> SS . iter f set |
let forpack_flags_of_pathname = ref ( fun _ -> N ) |
let print_table print_value f table = Format . fprintf f " [ @< hv0 { [ >:@< hv0 " ; > Hashtbl . iter begin fun k v -> if k <> " " then Format . fprintf f " @ [ @< 2 >% S =>@ % a ] ; " @ k print_value v ; end table ; Format . fprintf f " ] @@ } ] " :@ |
let print_tables f ( include_dirs_table , for_pack_table ) = Format . fprintf f " [ @< 2 [ >@< 2 > include_dirs_table :@ % a ] ; @@ [ @< 2 > for_pack_table : % a ] ] " @@ ( print_table ( List . print String . print ) ) include_dirs_table ( print_table String . pr... |
let mk_tables arch = let include_dirs_table = Hashtbl . create 17 and for_pack_table = Hashtbl . create 17 in iter_info begin fun i -> Hashtbl . replace include_dirs_table i . current_path i . include_dirs ; Hashtbl . replace for_pack_table i . current_path i . for_pack end arch ; let previous... |
let forpack_flags_of_pathname m = ! forpack_flags_of_pathname m |
let forpack_flags arg tags = if Tags . mem " pack " tags then Ocaml_arch . forpack_flags_of_pathname arg else N |
let ocamlc_c tags arg out = let tags = tags " ++ ocaml " " ++ byte " in Cmd ( S [ ! Options . ocamlc ; A " - c " ; T ( tags " ++ compile " ) ; ocaml_ppflags tags ; ocaml_include_flags arg ; A " - o " ; Px out ; P arg ] ) |
let ocamlc_link flag tags deps out = Cmd ( S [ ! Options . ocamlc ; flag ; T tags ; atomize_paths deps ; A " - o " ; Px out ] ) |
let ocamlc_link_lib = ocamlc_link ( A " - a " ) |
let ocamlc_link_prog = ocamlc_link N |
let ocamlmklib tags deps out = Cmd ( S [ ! Options . ocamlmklib ; T tags ; atomize_paths deps ; A " - o " ; Px ( Pathname . remove_extensions out ) ] ) |
let ocamlmktop tags deps out = Cmd ( S [ ! Options . ocamlmktop ; T ( tags " ++ mktop " ) ; atomize_paths deps ; A " - o " ; Px out ] ) |
let byte_lib_linker tags = if Tags . mem " ocamlmklib " tags then ocamlmklib tags else ocamlc_link_lib tags |
let byte_lib_linker_tags tags = tags " ++ ocaml " " ++ link " " ++ byte " " ++ library " |
let ocamlc_p tags deps out = Cmd ( S [ ! Options . ocamlc ; A " - pack " ; T tags ; atomize_paths deps ; A " - o " ; Px out ] ) |
let ocamlopt_c tags arg out = let tags = tags " ++ ocaml " " ++ native " in Cmd ( S [ ! Options . ocamlopt ; A " - c " ; Ocaml_arch . forpack_flags_of_pathname arg ; T ( tags " ++ compile " ) ; ocaml_ppflags tags ; ocaml_include_flags arg ; A " - o " ; Px out ; P ... |
let ocamlopt_link flag tags deps out = Cmd ( S [ ! Options . ocamlopt ; flag ; forpack_flags out tags ; T tags ; atomize_paths deps ; A " - o " ; Px out ] ) |
let ocamlopt_link_lib = ocamlopt_link ( A " - a " ) |
let ocamlopt_link_shared_lib = ocamlopt_link ( A " - shared " ) |
let ocamlopt_link_prog = ocamlopt_link N |
let ocamlopt_p tags deps out = let dirnames = List . union [ ] ( List . map Pathname . dirname deps ) in let include_flags = List . fold_right ocaml_add_include_flag dirnames [ ] in let mli = Pathname . update_extensions " mli " out in let cmd = S [ ! Options . ocamlopt ; A " - ... |
let native_lib_linker tags = if Tags . mem " ocamlmklib " tags then ocamlmklib tags else ocamlopt_link_lib tags |
let native_shared_lib_linker tags = ocamlopt_link_shared_lib tags |
let native_lib_linker_tags tags = tags " ++ ocaml " " ++ link " " ++ native " " ++ library " |
let prepare_compile build ml = let dir = Pathname . dirname ml in let include_dirs = Pathname . include_dirs_of dir in let modules = path_dependencies_of ml in let results = build ( List . map ( fun ( _ , x ) -> expand_module include_dirs x [ " cmi " ] ) modules ) in List . iter2 be... |
let byte_compile_ocaml_interf mli cmi env build = let mli = env mli and cmi = env cmi in prepare_compile build mli ; ocamlc_c ( tags_of_pathname mli " ++ interf " ) mli cmi |
let byte_compile_ocaml_implem ? tag ml cmo env build = let ml = env ml and cmo = env cmo in prepare_compile build ml ; ocamlc_c ( Tags . union ( tags_of_pathname ml ) ( tags_of_pathname cmo ) " ++ implem " +++ tag ) ml cmo |
let cache_prepare_link = Hashtbl . create 107 |
let rec prepare_link tag cmx extensions build = let key = ( tag , cmx , extensions ) in let dir = Pathname . dirname cmx in let include_dirs = Pathname . include_dirs_of dir in let ml = Pathname . update_extensions " ml " cmx in let mli = Pathname . update_extensions " mli " cmx in let mod... |
let native_compile_ocaml_implem ? tag ( ? cmx_ext " = cmx " ) ml env build = let ml = env ml in let cmi = Pathname . update_extensions " cmi " ml in let cmx = Pathname . update_extensions cmx_ext ml in prepare_link cmx cmi [ cmx_ext ; " cmi " ] build ; ocamlopt_c ( Tags . union ( ... |
let libs_of_use_lib tags = Tags . fold begin fun tag acc -> try let libpath , extern = Hashtbl . find info_libraries tag in if extern then acc else libpath :: acc with Not_found -> acc end tags [ ] |
let prepare_libs cma_ext a_ext out build = let out_no_ext = Pathname . remove_extension out in let libs1 = List . union ( libraries_of out_no_ext ) ( libs_of_use_lib ( tags_of_pathname out ) ) in let ( ) = dprintf 10 " prepare_libs : % S -> % a " out pp_l libs1 in let libs = List . m... |
let library_index = Hashtbl . create 32 |
let package_index = Hashtbl . create 32 |
let hidden_packages = ref [ ] |
let hide_package_contents package = hidden_packages := package :: ! hidden_packages |
module Ocaml_dependencies_input = struct let fold_dependencies = Resource . Cache . fold_dependencies let fold_libraries f = Hashtbl . fold f library_index let fold_packages f = Hashtbl . fold f package_index end |
let link_one_gen linker tagger cmX out env _build = let cmX = env cmX and out = env out in let tags = tagger ( tags_of_pathname out ) in linker tags [ cmX ] out |
let link_gen cmX_ext cma_ext a_ext extensions linker tagger cmX out env build = let cmX = env cmX and out = env out in let tags = tagger ( tags_of_pathname out ) in let dyndeps = Rule . build_deps_of_tags build ( tags " ++ link_with " ) in let cmi = Pathname . update_extensions " cmi " cmX in... |
let byte_link_gen = link_gen " cmo " " cma " " cma " [ " cmo " ; " cmi " ] |
let byte_link = byte_link_gen ocamlc_link_prog ( fun tags -> tags " ++ ocaml " " ++ link " " ++ byte " " ++ program " ) |
let byte_library_link = byte_link_gen byte_lib_linker byte_lib_linker_tags |
let byte_debug_link_gen = link_gen " d . cmo " " d . cma " " d . cma " [ " d . cmo " ; " cmi " ] |
let byte_debug_link = byte_debug_link_gen ocamlc_link_prog ( fun tags -> tags " ++ ocaml " " ++ link " " ++ byte " " ++ debug " " ++ program " ) |
let byte_debug_library_link = byte_debug_link_gen byte_lib_linker ( fun tags -> byte_lib_linker_tags tags " ++ debug " ) |
let native_link_gen linker = link_gen " cmx " " cmxa " ! Options . ext_lib [ ! Options . ext_obj ; " cmi " ] linker |
let native_link x = native_link_gen ocamlopt_link_prog ( fun tags -> tags " ++ ocaml " " ++ link " " ++ native " " ++ program " ) x |
let native_library_link x = native_link_gen native_lib_linker native_lib_linker_tags x |
let native_profile_link_gen linker = link_gen " p . cmx " " p . cmxa " ( " p " . -- ! Options . ext_lib ) [ " p " . -- ! Options . ext_obj ; " cmi " ] linker |
let native_profile_link x = native_profile_link_gen ocamlopt_link_prog ( fun tags -> tags " ++ ocaml " " ++ link " " ++ native " " ++ profile " " ++ program " ) x |
let native_profile_library_link x = native_profile_link_gen native_lib_linker ( fun tags -> native_lib_linker_tags tags " ++ profile " ) x |
let link_units table extensions cmX_ext cma_ext a_ext linker tagger contents_list cmX env build = let cmX = env cmX in let tags = tagger ( tags_of_pathname cmX ) in let _ = Rule . build_deps_of_tags build tags in let dir = let dir1 = Pathname . remove_extensions cmX in if Resource . exists_in_source_di... |
let link_modules = link_units library_index |
let pack_modules = link_units package_index |
let link_from_file link modules_file cmX env build = let modules_file = env modules_file in let contents_list = string_list_of_file modules_file in link contents_list cmX env build |
let byte_library_link_modules = link_modules [ ( " cmo " , [ ] ) ] " cmo " " cma " " cma " byte_lib_linker byte_lib_linker_tags |
let byte_library_link_mllib = link_from_file byte_library_link_modules |
let byte_toplevel_link_modules = link_modules [ ( " cmo " , [ ] ) ] " cmo " " cma " " cma " ocamlmktop ( fun tags -> tags " ++ ocaml " " ++ link " " ++ byte " " ++ toplevel " ) |
let byte_toplevel_link_mltop = link_from_file byte_toplevel_link_modules |
let byte_debug_library_link_modules = link_modules [ ( " d . cmo " , [ ] ) ] " d . cmo " " d . cma " " d . cma " byte_lib_linker ( fun tags -> byte_lib_linker_tags tags " ++ debug " ) |
let byte_debug_library_link_mllib = link_from_file byte_debug_library_link_modules |
let byte_pack_modules = pack_modules [ ( " cmo " , [ " cmi " ] ) ; ( " cmi " , [ ] ) ] " cmo " " cma " " cma " ocamlc_p ( fun tags -> tags " ++ ocaml " " ++ pack " " ++ byte " ) |
let byte_pack_mlpack = link_from_file byte_pack_modules |
let byte_debug_pack_modules = pack_modules [ ( " d . cmo " , [ " cmi " ] ) ; ( " cmi " , [ ] ) ] " d . cmo " " d . cma " " d . cma " ocamlc_p ( fun tags -> tags " ++ ocaml " " ++ pack " " ++ byte " " ++ debug " ) |
let byte_debug_pack_mlpack = link_from_file byte_debug_pack_modules |
let native_pack_modules x = pack_modules [ ( " cmx " , [ " cmi " ; ! Options . ext_obj ] ) ; ( " cmi " , [ ] ) ] " cmx " " cmxa " ! Options . ext_lib ocamlopt_p ( fun tags -> tags " ++ ocaml " " ++ pack " " ++ native " ) x |
let native_pack_mlpack = link_from_file native_pack_modules |
let native_profile_pack_modules x = pack_modules [ ( " p . cmx " , [ " cmi " ; " p " . -- ! Options . ext_obj ] ) ; ( " cmi " , [ ] ) ] " p . cmx " " p . cmxa " ( " p " . -- ! Options . ext_lib ) ocamlopt_p ( fun tags -> tags " ++ ocam... |
let native_profile_pack_mlpack = link_from_file native_profile_pack_modules |
let native_library_link_modules x = link_modules [ ( " cmx " , [ ! Options . ext_obj ] ) ] " cmx " " cmxa " ! Options . ext_lib native_lib_linker native_lib_linker_tags x |
let native_shared_library_link_modules x = link_modules [ ( " cmx " , [ ! Options . ext_obj ] ) ] " cmx " " cmxa " ! Options . ext_lib native_shared_lib_linker ( fun tags -> native_lib_linker_tags tags " ++ shared " ) x |
let native_library_link_mllib = link_from_file native_library_link_modules |
let native_shared_library_link_mldylib = link_from_file native_shared_library_link_modules |
let native_shared_library_tags tags basetags = List . fold_left ( ) ++ ( basetags " ++ ocaml " " ++ link " " ++ native " " ++ shared " " ++ library " ) tags |
let native_shared_library_link ( ? tags = [ ] ) x = link_one_gen native_shared_lib_linker ( native_shared_library_tags tags ) x |
let native_profile_library_link_modules x = link_modules [ ( " p . cmx " , [ " p " . -- ! Options . ext_obj ] ) ] " p . cmx " " p . cmxa " ( " p " . -- ! Options . ext_lib ) native_lib_linker ( fun tags -> native_lib_linker_tags tags " ++ profile " ) x |
let native_profile_shared_library_link_modules x = link_modules [ ( " p . cmx " , [ " p " . -- ! Options . ext_obj ] ) ] " p . cmx " " p . cmxa " ( " p " . -- ! Options . ext_lib ) native_shared_lib_linker ( fun tags -> native_lib_linker_tags tags " ++ shar... |
let native_profile_library_link_mllib = link_from_file native_profile_library_link_modules |
let native_profile_shared_library_link_mldylib = link_from_file native_profile_shared_library_link_modules |
( ~ name : string ) ( ~ flags : string ) ( ~ directory : string ) ( ~ exit_status_variable : Variables . t ) ( ~ reference_variable : Variables . t ) ( ~ output_variable : Variables . t ) ( ~ host : Ocaml_backends . t ) ( ~ target : Ocaml_backends . t ) ~ name ... |
let ocamlc_byte = new compiler ~ name : Ocaml_commands . ocamlrun_ocamlc ~ flags : " " ~ directory : " ocamlc . byte " ~ exit_status_variable : Ocaml_variables . ocamlc_byte_exit_status ~ reference_variable : Ocaml_variables . compiler_reference ~ output_variable : Ocaml_variables . compi... |
let ocamlc_opt = new compiler ~ name : Ocaml_files . ocamlc_dot_opt ~ flags : " " ~ directory : " ocamlc . opt " ~ exit_status_variable : Ocaml_variables . ocamlc_opt_exit_status ~ reference_variable : Ocaml_variables . compiler_reference2 ~ output_variable : Ocaml_variables . compiler_ou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.