X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=myocamlbuild.ml;h=6121130738bf54e44cf88ac9dac1c702ad93e6b7;hb=HEAD;hp=3e14dfaae827d57b25a326ba8bb49aedd40bbfeb;hpb=63db110485e97e189313abd1a6ce1bedf941d76d;p=SXSI%2Fxpathcomp.git diff --git a/myocamlbuild.ml b/myocamlbuild.ml index 3e14dfa..6121130 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -9,17 +9,18 @@ let print_list l = let _A x = A x let _S ?(extra=N) l = S (List.map (fun e -> (S [extra; _A e] )) l) ;; - +let cxx_flags_for_ml = [ _S ~extra:(_A "-ccopt") cxx_flags ] let cxx_flags = ref [ _S cxx_flags ] - let project_dirs = [ src_path; include_path ] let cxx_include_flags = _S cxx_includes let cxx_link_flags = ref [ _S cxx_lpaths; _S cxx_libs] let native_link_flags = ref (List.map (fun s -> s ^ ".cmxa") ocaml_link) let byte_link_flags = ref ("-custom" :: (List.map (fun s -> s ^ ".cma") ocaml_link)) let link_flags = [ A"-linkpkg" ] +let libs_files = List.map (fun s -> "file:" ^ s) cxx_libs_objects -let native_compile_flags = ref [A"-fno-PIC"] + +let native_compile_flags = if Sys.word_size = 64 then ref [A"-fno-PIC"] else ref [] let compile_flags = ref [] let dwsize = sprintf "-DWORDSIZE%i" Sys.word_size @@ -106,8 +107,8 @@ let () = dispatch begin Options.ocamldoc := ocamlfind (A"ocamldoc"); Options.ocamlmktop := ocamlfind (A"ocamlmktop"); - if not (List.mem "trace" !Options.tags) then begin - pp_macro_options @= [ A "-DNTRACE" ]; + if not (List.mem "log" !Options.tags) then begin + pp_macro_options @= [ A "-DNLOG" ]; end; if (List.mem "profile" !Options.tags) then begin pp_macro_options @= [ A "-DPROFILE" ]; @@ -126,7 +127,7 @@ let () = dispatch begin compile_flags @= [A "-noassert"]; pp_macro_options @= [ A "-unsafe" ]; native_compile_flags @= [ A "-inline"; A ocaml_inline ]; - cxx_flags @= [ A "-O3" ] + cxx_flags @= [ A "-O3"; A "-DNDEBUG" ] end; let dir_path = Pathname.pwd / src_path in @@ -141,17 +142,16 @@ let () = dispatch begin | After_rules -> dep [ "link" ] cstub_lib; - rule "c++: cpp & depends -> o" ~prod:"%.o" ~deps:[ "%.cpp" ] cxx_compile; let syntax_flags = S ([ A "-syntax"; A "camlp4o"; S (ppopt [A "-printer" ; A"Camlp4OCamlAstDumper"]); S (ppopt !pp_macro_options) ]) in flag [ "ocaml"; "ocamldep"] syntax_flags; - flag [ "ocaml"; "compile" ] (S[ A "-cc"; A cxx_cmd; syntax_flags; S !compile_flags ]); + flag [ "ocaml"; "compile" ] (S[ A "-cc"; A cxx_cmd; S cxx_flags_for_ml ; syntax_flags; S !compile_flags ]); flag [ "ocaml"; "native"; "compile" ] (S !native_compile_flags); flag [ "ocaml"; "link" ] - (S [ S link_flags ; A "-cc"; A cxx_cmd; A "-cclib" ; + (S [ S link_flags ; A "-cc"; A cxx_cmd; S cxx_flags_for_ml; A "-cclib" ; Quote (S [ _S cstub_lib; S !cxx_link_flags]) ]); flag [ "ocaml"; "byte"; "link" ] (_S !byte_link_flags); flag [ "ocaml"; "native"; "link" ] (_S !native_link_flags);