#!/bin/sh
compdir=$HOME/phase_nims
parallel=2d
code=OPEN
#makef=Makefile.gfort3d
makef=Makefile.uc
currdir=`pwd`
if [ $# -eq 1 ];then
  parallel=$1
fi
if [ $# -eq 2 ];then
  code=$2
fi
if [ $# -eq 3 ];then
  makef=$3
fi

mkdir -p $compdir

para=ORG_Parallel
if [ "${parallel}" = "3d" ];then
  para=3D_Parallel
fi
echo 'parallel : ' ${para}
./get_parallel_source_code.pl $para . $compdir/src${parallel}
./get_source_code.pl $code $compdir/src${parallel} $compdir/src${parallel}_${code}
cd $compdir/src${parallel}_${code}
make -f ${makef}
cd ${currdir}
