(* -*- tuareg -*- *) (* use strings so that it looks like OCaml even before substituting, e.g. to use ocamlformat *) type build_mode = Default | Opt | Test let build_mode = match Jbuild_plugin.V1.context with | "test" -> Test | "default" -> Default | "opt" -> Opt | ctx -> invalid_arg ("unknown context: " ^ ctx) let is_yes = String.equal "yes" let clang = is_yes "@BUILD_C_ANALYZERS@" let java = is_yes "@BUILD_JAVA_ANALYZERS@" let python = is_yes "@BUILD_PYTHON_ANALYZERS@" let facebook = is_yes "@IS_FACEBOOK_TREE@" let extra_cflags = if "@EXTRA_CFLAGS" = "" then [] else ["@EXTRA_CFLAGS@"] let common_cflags = let fatal_warnings = "+3+5+6+8+10+11+12+18+19+20+21+23+26+29+27+32+33+34+35+37+38+39+50+52+57+60" in let warnings = fatal_warnings ^ "-4-9-40-41-42-45-48" in let common_flags = [ "-g" ; "-short-paths" ; "-safe-string" ; "-principal" ; "-strict-formats" ; "-strict-sequence" ; "-bin-annot" ; "-w" ; warnings ] in match build_mode with | Default | Opt -> common_flags | Test -> "-warn-error" :: fatal_warnings :: common_flags let common_optflags = match build_mode with Opt -> ["-O3"] | Default | Test -> [] let common_libraries = (if java then ["javalib"; "ptrees"; "sawja"] else []) @ [ "ANSITerminal" ; "atdgen" ; "base" ; "base64" ; "cmdliner" ; "core" ; "extlib" ; "mtime.clock.os" ; "oUnit" ; "parmap" ; "sqlite3" ; "str" ; "unix" ; "xmlm" ; "yojson" ; "zip" ]