(library
 (name config)
 (synopsis "Coq Configuration Variables")
 (public_name coq-core.config)
 (modules :standard \ list_plugins)
 (wrapped false))

(executable (name list_plugins) (modules list_plugins))
(rule (targets plugin_list)
  (deps (source_tree %{project_root}/plugins))
  (action (with-stdout-to %{targets} (chdir %{project_root} (run config/list_plugins.exe)))))

; Dune doesn't use configure's output, but it is still necessary for
; some Coq files to work; will be fixed in the future.
(rule
 (targets coq_config.ml coq_config.py Makefile dune.c_flags)
 (mode fallback)
 (deps
   %{project_root}/dev/ocamldebug-coq.run
   %{project_root}/dev/header.c
   ; Needed to generate include lists for coq_makefile
   plugin_list
  (env_var PWD) ; used in the fallback of COQ_CONFIGURE_PREFIX
  (env_var COQ_CONFIGURE_PREFIX))
 (action (chdir %{project_root} (run %{project_root}/tools/configure/configure.exe -no-ask))))
