(library
  (name js_of_ocaml_compiler)
  (public_name js_of_ocaml-compiler)
  (synopsis "Js_of_ocaml compiler library")
  (libraries compiler-libs.common compiler-libs.bytecomp bytes menhirLib
   (select source_map_io.ml from
    (yojson -> source_map_io.yojson.ml)
    (       -> source_map_io.unsupported.ml))
  )
  (flags (:standard -w -7-37 -safe-string))
  (preprocess (pps ppx_optcomp_light))
  )

(ocamllex js_lexer annot_lexer)

;; cp $(ocamlfind printconf path)/menhir/standard.mly standard.mly

;; menhir is just noisy, both because this parser has conflicts, or
;; because we don't use --infer (to avoid having to write  manually and
;; badly specified dependencieds), so we just discard stderr.
(rule
 (targets js_parser.mli js_parser.ml)
 (deps standard.mly)
 (action (ignore-stderr (run menhir --stdlib . --table --external-tokens Js_token --explain %{dep:js_parser.mly}))))

(rule
 (targets annot_parser.mli annot_parser.ml)
 (deps standard.mly)
 (action (ignore-stderr (run menhir --stdlib . --explain %{dep:annot_parser.mly}))))

(rule
 (targets compiler_version.ml)
 (deps (:input-file ../../version.ml.in))
 (action (copy %{input-file} %{targets})))
