(* -*- tuareg -*- *) (* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) (* 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 facebook = is_yes "@IS_FACEBOOK_TREE@" let extra_cflags = if "@EXTRA_CFLAGS@" = "" then [] else ["@EXTRA_CFLAGS@"] let common_cflags = (* * A known issue: At the moment of writing warning 14 (illegal backslash * escape in string) does not manifest as an error, presumably due to * peculiarities in communication between preprocessor and compiler. * Still leave it for visibility and in hope that the issue will be * fixed one day. *) let fatal_warnings = "+3+5+6+8+10+11+12+14+18+19+20+21+23+26+29+27+28+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"; "sawja"] else []) @ [ "ANSITerminal" ; "apron" ; "apron.octMPQ" ; "atdgen" ; "base" ; "base64" ; "cmdliner" ; "core" ; "elina" ; "mtime.clock.os" ; "ocamlgraph" ; "oUnit" ; "parmap" ; "sqlite3" ; "str" ; "unix" ; "xmlm" ; "yojson" ; "zarith" ; "zip" ]