(library
 (name migrate_parsetree)
 (public_name ocaml-migrate-parsetree)
 (wrapped false)
 (libraries compiler-libs.common result ppx_derivers)
 (flags :standard -open Result)
 (modules :standard \ migrate_parsetree_driver_main)
 (preprocess (action (run %{exe:../tools/pp.exe} %{read:ast-version}
                       %{input-file})))
 (ppx.driver
  (main       Migrate_parsetree.Driver.run_main)
  (flags      --dump-ast)
  (lint_flags --null)))

(library
 (name migrate_parsetree_driver_main)
 (public_name ocaml-migrate-parsetree.driver-main)
 (modules migrate_parsetree_driver_main)
 (library_flags -linkall)
 (libraries migrate_parsetree))

(rule
 (copy#
  compiler-functions/%{read:compiler-functions-file}
  migrate_parsetree_compiler_functions.ml))

(rule
 (targets ast-version compiler-functions-file)
 (action  (run %{ocaml} %{dep:config/gen.ml} %{ocaml_version})))
