#!/bin/sh 

# format,
#   runall clean
#   runall run

progname=$(basename $0)
pwd=`pwd`

if [ $# -eq 0 ]; then
    echo "Usage: $progname (clean|run)" >&2;
    exit 1
fi

ABAC_PROVER_PATH=`which abac_prover_yap | sed 's/\/abac_prover_yap//'`
export ABAC_PROVER_PATH

if [ "$1" = "clean" ]; then
    rm -rf allout.tmp 
    for i in `ls -1 `; do
        if [ -d $i ]; then
            printf "\n ==> CLEANING on %s\n" "$i" >& 2 ;
            cd $i
            make realclean
            cd $pwd
        fi
    done
elif [ "$1" = "run" ] ; then
    for i in `ls -1 `; do
        if [ -d $i ]; then
            printf "\n ==> RUN on %s\n" "$i" ;
            cd $i
            ./run_test
            cd $pwd
        fi
    done
fi 
