(* -*- 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 *) let is_yes = String.equal "yes" let is_empty = String.equal "" 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 is_empty "@EXTRA_CFLAGS@" then [] else ["@EXTRA_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" let warnings = fatal_warnings ^ "-4-9-40-41-42-45-48" let ocamlc_flags = [ "-g" ; "-short-paths" ; "-safe-string" ; "-principal" ; "-strict-formats" ; "-strict-sequence" ; "-bin-annot" ] let lenient_flags = ocamlc_flags @ ["-w"; warnings] |> String.concat " " let strict_flags = ocamlc_flags @ ["-w"; warnings; "-warn-error"; fatal_warnings] |> String.concat " " let common_libraries = (if java then ["javalib"; "sawja"] else []) @ [ "ANSITerminal" ; "async" ; "atdgen" ; "base" ; "base64" ; "cmdliner" ; "core" ; "mtime.clock.os" ; "ocamlgraph" ; "oUnit" ; "parmap" ; "re" ; "sledge" ; "sqlite3" ; "str" ; "unix" ; "xmlm" ; "yojson" ; "zarith" ; "zip" ]