(include_subdirs unqualified)

(executable
 (name ocamlmerlin_server)
 (package merlin)
 (public_name ocamlmerlin-server)
 (flags
  :standard
  -open Ocaml_utils
  -open Ocaml_parsing
  -open Ocaml_typing
  -open Merlin_utils
  -open Merlin_analysis)
 (modules (:standard \ gen_ccflags))
 (libraries config yojson merlin_analysis merlin_kernel
            merlin_utils os_ipc ocaml_parsing query_protocol query_commands
            ocaml_typing ocaml_utils seq))

(executable
 (name      gen_ccflags)
 (modules   gen_ccflags)
 (libraries str))

(rule
 (targets pre-flags post-flags)
 (deps    gen_ccflags.exe)
 (action  (run %{deps} "%{ocaml-config:ccomp_type}" %{targets})))

(rule
 (targets ocamlmerlin.exe)
 (deps    (:c ocamlmerlin.c) pre-flags post-flags)
 (action  (run %{cc} "%{read-lines:pre-flags}%{targets}" %{c} %{read-lines:post-flags})))

(install
 (package merlin)
 (section bin)
 (files   (ocamlmerlin.exe as ocamlmerlin)))
