(documentation
 (package odoc)
 (mld_files
  driver
  dune
  features
  index
  interface
  ocamldoc_differences
  odoc_for_authors
  cheatsheet
  parent_child_spec))

; Uncomment to run mdx on the documentation's code blocks.
; (mdx
;  (files
;   driver.mld
;   dune.mld
;   features.mld
;   index.mld
;   interface.mld
;   ocamldoc_differences.mld
;   odoc_for_authors.mld
;   parent_child_spec.mld))

; The driver is also used to collect benchmarks. The benchmark result is always
; generated but is promoted only by the @bench alias.

(rule
 (targets driver.mld.corrected driver-benchmarks.json)
 (enabled_if
  (> %{ocaml_version} 4.11))
 (deps
  (package odoc)
  (universe) ; Benchmark depends on the running time of odoc commands
  (glob_files *.mld)
  (glob_files *.js)
  (glob_files library_mlds/*)
  (glob_files examples/*.ml*))
 (action
  (progn
   (write-file driver-benchmarks.json "")
   (run ocaml-mdx-test --force-output %{dep:driver.mld}))))

(rule
 (alias docgen)
 (action
  (progn
   (diff driver.mld driver.mld.corrected))))
