(rule
  (alias ocsigen-doc)
  (deps
    (alias_rec ../examples/default)
    (alias ../toplevel/examples/lwt_toplevel/default)
    (source_tree ../examples)
    (source_tree ../toplevel/examples/lwt_toplevel)
    (glob_files *wiki)
    (source_tree files)
  )
  (action (bash
"function copy { \
   src=$1; shift; \
   dst=$1; shift; \
   mkdir -p files/$dst; \
   cp -R ${@/#/$src/} files/$dst; \
 }; \
 copy ../toplevel/examples/lwt_toplevel toplevel index.html toplevel.js test_dynlink.js; \
 copy ../examples/boulderdash boulderdash index.html boulderdash.js sprites; \
 copy ../examples/webgl webgl index.html webgldemo.js; \
 copy ../examples/graph_viewer graph_viewer index.html viewer_js.js; \
 copy ../examples/planet planet index.html texture.jpg planet.js; \
 copy ../examples/wiki wiki index.html main.js; \
 copy ../examples/wysiwyg wysiwyg index.html main.js; \
 copy ../examples/hyperbolic hyperbolic index.html hypertree.js icons thumbnails; \
 copy ../examples/minesweeper minesweeper index.html main.js sprites; \
 copy ../examples/cubes cubes index.html cubes.js; \
")))