#!/usr/bin/env bash
set -euo pipefail

echo "----------------------------------------------------------------"
echo "Reformatting ..."
scripts/reformat.sh src
scripts/reformat.sh tests

echo "----------------------------------------------------------------"
echo "Building native version"

BIN=bin/native \
  make -j`nproc`

./bin/native/tests.exe

echo "----------------------------------------------------------------"
echo "Building asmjs version"

BIN=bin/asmjs \
  scripts/asmjs-make -j`nproc` bin/asmjs/faade.html

echo Success!
