(executable
 (public_name permap)
 (modules
  app
  content
  db
  login
  permap
  register
  template
  user
  user_profile
  add_plant)
 (libraries
  uuidm
  caqti.blocking
  caqti-driver-sqlite3
  bos
  directories
  dream
  emile
  omd
  safepass
  sqlite3_utils
  lambdasoup)
 (preprocess
  (pps lwt_ppx)))

(executable
 (name map)
 (modules map)
 (libraries js_of_ocaml brr)
 (modes js)
 (js_of_ocaml
  (javascript_files leaflet/leaflet.js))
 (preprocess
  (pps js_of_ocaml-ppx)))

(rule
 (targets template.ml)
 (deps template.eml.html)
 (action
  (run dream_eml %{deps} --workspace %{workspace_root})))

(rule
 (targets login.ml)
 (deps login.eml.html)
 (action
  (run dream_eml %{deps} --workspace %{workspace_root})))

(rule
 (targets register.ml)
 (deps register.eml.html)
 (action
  (run dream_eml %{deps} --workspace %{workspace_root})))

(rule
 (targets add_plant.ml)
 (deps add_plant.eml.html)
 (action
  (run dream_eml %{deps} --workspace %{workspace_root})))

(rule
 (targets user_profile.ml)
 (deps user_profile.eml.html)
 (action
  (run dream_eml %{deps} --workspace %{workspace_root})))

(rule
 (target content.ml)
 (deps
  (source_tree content)
  (file content/assets/js/map.js))
 (action
  (with-stdout-to
   %{null}
   (run ocaml-crunch -m plain content -o %{target}))))

(install
 (section share)
 (files
  ./content/assets/css/leaflet.css
  (./content/assets/img/layers-2x.png as images/layers-2x.png)
  (./content/assets/img/layers.png as images/layers.png)
  (./content/assets/img/marker-icon-2x.png as images/marker-icon-2x.png)
  (./content/assets/img/marker-icon.png as images/marker-icon.png)
  (./content/assets/img/marker-shadow.png as images/marker-shadow.png)))
