(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_kernel
  -open Merlin_utils
  -open Merlin_analysis
  -open Merlin_kernel)
 (modules (:standard \ gen_ccflags))
 (libraries merlin-lib.config yojson merlin-lib.analysis merlin-lib.kernel
            merlin-lib.utils merlin-lib.os_ipc merlin-lib.ocaml_parsing
            merlin-lib.query_protocol merlin-lib.query_commands
            merlin-lib.ocaml_typing merlin-lib.ocaml_utils))

(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)))
