(include link.dune.inc)

(rule
 (deps
  (glob_files cases/*)
  (glob_files html/*.targets)
  (glob_files latex/*.targets)
  (glob_files man/*.targets)
  (glob_files markdown/*.targets))
 (package odoc)
 (enabled_if
  (>= %{ocaml_version} 4.04))
 (action
  (with-stdout-to
   link.dune.inc.gen.raw
   (run gen_rules/gen_rules.exe))))

(rule
 (format-dune-file link.dune.inc.gen.raw link.dune.inc.gen))

(rule
 (alias runtest)
 (package odoc)
 (enabled_if
  (>= %{ocaml_version} 4.04))
 (action
  (diff link.dune.inc link.dune.inc.gen)))

(library
 (name gen_rules_lib)
 (libraries sexplib0 unix fpath odoc_utils)
 (enabled_if
  (>= %{ocaml_version} 4.04)))

(cram
 (package odoc)
 (deps %{bin:odoc}))
