(* -*- tuareg -*- *)

(**********************************************************************)
(*                                                                    *)
(*                            OCamlFormat                             *)
(*                                                                    *)
(*  Copyright (c) 2017-present, Facebook, Inc.  All rights reserved.  *)
(*                                                                    *)
(*  This source code is licensed under the MIT license found in the   *)
(*  LICENSE file in the root directory of this source tree.           *)
(*                                                                    *)
(**********************************************************************)

let ocamlc_flags =
  match Jbuild_plugin.V1.context with
  | "dbg" -> "-g -opaque"
  | _ -> "-noassert"

let ocamlopt_flags =
  match Jbuild_plugin.V1.context with
  | "dbg" -> ocamlc_flags
  | _ -> ocamlc_flags ^ " -O3"

;; Jbuild_plugin.V1.send @@ Format.sprintf "
(library
 ((name import)
  (flags
   (-strict-formats -strict-sequence -principal
    -w +a-3-4-6-9-40-41-42-44-45-48@50
    -short-paths -bin-annot -keep-docs
    -unboxed-types))
  (ocamlc_flags (%s))
  (ocamlopt_flags (%s))
  (libraries (base stdio))))
"
ocamlc_flags ocamlopt_flags
