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

(library
 (name liquidsoap_js)
 (public_name liquidsoap-js)
 (optional)
 (modules init_js regexp_js)
 (preprocess
  (pps js_of_ocaml-ppx))
 (libraries liquidsoap_lang))

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

(executable
 (name interactive_js)
 (modes js)
 (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})))
