1#!/bin/sh2# Builds ./bank from the given web.cml + host.cml + ffi.c, in the cwd.3# Needs cake (CAKE, default: cake on PATH) and the release's basis_ffi.c4# (BASIS, default: next to cake). Usage: ./build.sh web.cml5# cake touches its whole heap: on rtx, web.cml takes 2.3 s and 1.06 GB peak6# RSS (CML_HEAP_SIZE=256: 2.3 s, 270 MB, the same assembly).7set -e8dir=$(dirname "$0")9cake=${CAKE:-$(command -v cake)}10basis=${BASIS:-$(dirname "$cake")/basis_ffi.c}11cat "$1" "$dir/host.cml" > bank.cml12"$cake" < bank.cml > bank.S13cc -O2 bank.S "$basis" "$dir/ffi.c" -lm -o bank