You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.2 KiB

(* -*- 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.
*)
(* NOTE: prepend dune.common to this file! *)
let ( ^/ ) = Filename.concat
let source_dirs =
(if facebook then "facebook" else "opensource")
:: ( ( if clang then ["al"; "clang"; "unit" ^/ "clang"]
else ["clang_stubs"; "unit" ^/ "clang_stubs"] )
@ [ (if java then "java" else "java_stubs")
; "absint"
; "backend"
; "biabduction"
; "bufferoverrun"
; "checkers"
; "concurrency"
; "cost"
; "integration"
; "labs"
; "nullsafe"
; "pulse"
; "quandary"
; "scuba"
; "test_determinator"
; "topl"
; "unit"
; "unit" ^/ "nullsafe" ] )
let infer_binaries = ["infer"; "inferunit"] @ if facebook then ["InferCreateTraceViewLinks"] else []
let infer_cflags =
common_cflags
@ [ "-open"
; "Core"
; "-open"
; "InferStdlib"
; "-open"
; "IStd"
; "-open"
; "InferGenerated"
; "-open"
; "InferIR"
; "-open"
; "InferBase"
; "-open"
; "InferCStubs"
; "-w"
; "+A-4@8-9-40-41-42-44-45-48-60-66" ]
(** The build stanzas to be passed to dune *)
let stanzas =
( if clang then ["(ocamllex types_lexer ctl_lexer)"; "(menhir (modules types_parser ctl_parser))"]
else [] )
@ [ "(ocamllex ToplLexer)"
; "(menhir (flags --unused-token INDENT --explain) (modules ToplParser))"
; Format.sprintf
{|
(library
(name InferModules)
(public_name infer)
(flags (%s))
(ocamlopt_flags (%s))
(libraries %s)
(modules :standard \ %s infertop)
(preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_let ppx_sexp_conv ppx_variants_conv -no-check))
)
(documentation
(package infer)
(mld_files index)
)
|}
(String.concat " " infer_cflags)
(String.concat " " common_optflags)
(String.concat " " ("InferCStubs" :: "InferIR" :: common_libraries))
(String.concat " " infer_binaries)
; Format.sprintf
{|
(executables
(names %s)
(modes byte exe)
(flags (%s -open InferModules))
(ocamlopt_flags (%s))
(libraries InferModules)
(modules %s)
(preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_let ppx_sexp_conv ppx_variants_conv -no-check))
)
|}
(String.concat " " infer_binaries)
(String.concat " " infer_cflags)
(String.concat " " common_optflags)
(String.concat " " infer_binaries)
; Format.sprintf
{|
(executable
(name infertop)
(modes byte)
(flags (%s))
(libraries utop InferModules)
(modules Infertop)
(preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_let ppx_sexp_conv ppx_variants_conv -no-check))
(link_flags (-linkall -warn-error -31))
)
|}
(String.concat " " infer_cflags) ]
@ ( List.map
(fun source_dir ->
[ Printf.sprintf "(copy_files# %s/*.ml{,i,l})" source_dir
; (* menhir doesn't support '# 1 "<source file>"' directives at the start of the file inserted by
copy# actions *)
Printf.sprintf "(copy_files %s/*.mly)" source_dir ] )
source_dirs
|> List.concat )
;;
String.concat "\n" stanzas |> Jbuild_plugin.V1.send