#!/bin/bash

MATRIXDIR='/scratch/etdeboone/matrix'
MATRIX_ELS="${@:-$MATRIXDIR/matrix*/}"

BASE=$(realpath ../base)
MAKE="make -C ${BASE} "

for d in "$MATRIX_ELS" ;
do
	echo "Entering $d"
	pushd "$d";

	# Source constants
	. env.sh
	export FIG_DIR=$(realpath "./figures")
	export DATA_DIR=$(realpath "./data")

	mkdir -p $FIG_DIR $DATA_DIR

	$MAKE beacon;
	$MAKE clocks;
	$MAKE phases;
	$MAKE findks;
	#$MAKE reconstruct;
	echo "Popping"
	popd
done
