(ocamllex
 (modules reason_declarative_lexer))

(rule
 (targets ocaml_util.ml)
 (deps ocaml_util.cppo.ml)
 (action
  (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets})))

(menhir
 (flags --strict --inspection --unused-tokens --table --cmly)
 (modules reason_parser))

; Previously, make preprocess.
; (rule
;  (targets reason_parser.cmly reason_parser.ml reason_parser.mli)
;  (deps reason_parser.mly)
;  (action
;   (run menhir --strict --inspection --infer
;        --unused-tokens
;        --fixed-exception
;        --table
;        --cmly reason_parser.mly)))

(rule
 (targets reason_parser_explain_raw.ml)
 (deps reason_parser.cmly)
 (action
  (with-stdout-to
   %{targets}
   (run ../menhir-error-processor/menhir_error_processor.exe
    reason_parser.cmly))))

(rule
 (targets reason_parser_recover.ml)
 (deps reason_parser.cmly)
 (action
  (with-stdout-to
   %{targets}
   (run ../menhir-recover/main.exe reason_parser.cmly))))

(library
 (name reason)
 ; Uncomment to allow make coverage target to work
 ; requires you to have run $ opam install bisect_ppx
 ;  (preprocess (pps (bisect_ppx)))
 (public_name reason)
 (libraries
  reason.ocaml-migrate-parsetree
  menhirLib
  reason.easy_format
  ppxlib))
