(env
 (dev
  (flags
   (:standard -w -7-9 -warn-error -33))))

(library
 (name liquidsoap_js)
 (public_name liquidsoap-js)
 (optional)
 (modules)
 (js_of_ocaml
  (javascript_files runtime.js))
 (preprocess
  (pps js_of_ocaml-ppx))
 (libraries liquidsoap_lang liquidsoap_tooling))

(install
 (files index.html)
 (section share)
 (package liquidsoap-js))

(executable
 (name interactive_js)
 (modes js)
 (optional)
 (modules interactive_js)
 (js_of_ocaml
  (javascript_files filesystem.js))
 (preprocess
  (pps ppx_string js_of_ocaml-ppx))
 (libraries liquidsoap_lang liquidsoap_js))

(rule
 (target filesystem.js)
 (enabled_if
  (not %{bin-available:js_of_ocaml}))
 (action
  (write-file %{target} "console.log(\"no js_of_ocaml available!\")")))

(rule
 (target filesystem.js)
 (enabled_if %{bin-available:js_of_ocaml})
 (deps
  ./stdlib_js.liq
  (glob_files ../libs/*.liq))
 (action
  (run js_of_ocaml build-fs -I . -I ../libs -o %{target} %{deps})))
