#!/bin/bash
#
icc -c -g -I${LHPC_ROOTFFTW}/include fftw3_prb.c >& compiler.txt
if [ $? -ne 0 ]; then
  echo "Errors compiling fftw3_prb.c."
  exit
fi
#rm compiler.txt
#
icc fftw3_prb.o -lfftw3 -lm
if [ $? -ne 0 ]; then
  echo "Errors linking and loading fftw3_prb.o."
  exit
fi
#
rm fftw3_prb.o
#
mv a.out fftw3_prb
./fftw3_prb > fftw3_prb_output.txt
if [ $? -ne 0 ]; then
  echo "Errors running fftw3_prb."
  exit
fi
#
echo "Program output written to fftw3_prb_output.txt"
