#!/usr/bin/env bash # The generics spike's measurement, driven by hand with ocamlfind against the # flan.cmxa dune already builds — the same arrangement spike/backend uses, and # for the same reason: nothing under spike/ is wired into the build, there is # no dune file here, and `dune test --root .` cannot see any of it. # # The three .flan programs beside this file are run with the ordinary driver: # dune exec --root . bin/main.exe -- run spike/generics/sort.flan set -u here=$(cd "$(dirname "$0")" && pwd) root=$(cd "$here/../.." && pwd) cd "$root" || exit 1 dune build --root . lib/flan.cmxa 2>&1 | head -20 out=$(mktemp -d); trap 'rm -rf "$out"' EXIT ocamlfind ocamlopt -thread -package unix,threads.posix -linkpkg \ -I "$root/_build/default/lib/.flan.objs/byte" \ -I "$root/_build/default/lib/.flan.objs/native" \ -I "$out" -I "$here" \ -o "$out/measure" \ "$root/_build/default/lib/flan.cmxa" \ -cclib -rdynamic -ccopt -L"$root/_build/default/lib" \ "$here/measure.ml" 2>&1 | head -40 test -x "$out/measure" || { echo "build failed"; exit 1; } "$out/measure"