(executable
 (name gen_emacs_completion)
 (link_flags -cclib %{env:LDFLAGS=})
 (libraries liquidsoap_runtime)
 (modules gen_emacs_completion))

(rule
 (target liquidsoap-completions.el)
 (deps
  (source_tree ../src/libs)
  ./gen_emacs_completion.exe)
 (action
  (with-stdout-to
   %{target}
   (run ./gen_emacs_completion.exe))))

(install
 (section share_root)
 (package liquidsoap)
 (files
  (bash-completion as bash_completion/completions/liquidsoap)))

(install
 (section share_root)
 (package liquidsoap-mode)
 (files
  (liquidsoap-mode.el as emacs/site-lisp/liquidsoap-mode.el)
  (liquidsoap-completion.el as emacs/site-lisp/liquidsoap-completion.el)
  (liquidsoap-completions.el as emacs/site-lisp/liquidsoap-completions.el)))
