(executable
 (name mte)
 (modules mte)
 (link_flags :standard -cclib "-z solo5-abi=hvt")
 (libraries mte)
 (foreign_stubs
  (language c)
  (names manifest)))

(library
 (name mte)
 (wrapped false)
 (modules :standard \ mte b32)
 (libraries
  b32
  ;
  ; caqti
  caqti-miou
  caqti-miou.unix
  caqti-driver-pgx
  bin
  mirage-crypto
  kdf.hkdf
  digestif
  duration
  vif
  fmt
  jsont
  cohttp
  ptime
  logs
  logs.fmt
  fmt.tty))

(library ; crockford base32
 (name b32)
 (modules b32)
 (libraries base32))

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

(rule
 (targets manifest.c)
 (deps manifest.json)
 (enabled_if
  (= %{context_name} "solo5"))
 (action
  (run solo5-elftool gen-manifest manifest.json manifest.c)))

(rule
 (targets manifest.c)
 (enabled_if
  (= %{context_name} "default"))
 (action
  (write-file manifest.c "")))
