(library
 (public_name ppx_tools)
 (synopsis "Tools for authors of ppx rewriters and other syntactic tools")
 (wrapped false)
 (modules ast_convenience ast_mapper_class)
 (preprocess (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{input-file})))
 (libraries compiler-libs.common))

(library
 (name ppx_metaquot)
 (public_name ppx_tools.metaquot)
 (synopsis "Meta-quotation: Parsetree manipulation using concrete syntax")
 (wrapped false)
 (kind ppx_rewriter)
 (modules ppx_metaquot)
 (ppx.driver (main Ppx_metaquot.Main.main))
 (ppx_runtime_libraries ppx_tools)
 (libraries compiler-libs.common ppx_tools ast_lifter))

(executable
 (name genlifter)
 (modules genlifter)
 (preprocess (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{input-file})))
 (libraries compiler-libs.common ppx_tools))

(executable
 (name dumpast)
 (modules dumpast)
 (libraries compiler-libs.common compiler-libs.bytecomp ast_lifter))

(executable
 (name ppx_metaquot_main)
 (modules ppx_metaquot_main)
 (libraries ppx_metaquot))

(executable
 (name rewriter)
 (modules rewriter)
 (libraries compiler-libs.common))

(rule
 (with-stdout-to ast_lifter.ml
  (run ./genlifter.exe -I +compiler-libs Parsetree.expression)))

(library
 (name ast_lifter)
 (public_name ppx_tools.ast_lifter)
 (wrapped false)
 (modules ast_lifter)
 (flags :standard -w -17)
 (libraries compiler-libs.common))

(install
 (section libexec)
 (files
  (genlifter.exe as genlifter)
  (dumpast.exe as dumpast)
  (ppx_metaquot_main.exe as ppx_metaquot)
  (rewriter.exe as rewriter)))
