#!/bin/bash

set -euo pipefail

if [[ ! -e L4_in.exa ]]; then
  echo "L4_in.exa not found, exiting"
  exit 1
fi
cpp -P L4_in.exa > o2_L4.exa
time java -XX:+UseG1GC -cp ../compiler_expl.jar Main ../settings.txt knowledge_ref.txt ../platform.txt 0 2>&1 | tee ot2_generateRef.log
echo "" | tee -a ot2_generateRef.log
time make -C scratch/var -j6 2>&1 | tee -a ot2_generateRef.log
mv scratch/var/exastencils scratch/var/exastencils.exe
make -C scratch/var clean
