#!/bin/bash

EXAMPLES='skalar skalar_stl jacobi jacobi_stl jacobi_oo_stl thread_17 densematrices_libs'
# EXAMPLES='template_seq'
#COMPTYPE='GCC_ CLANG_'
COMPTYPE='ONEAPI_'

LOG_FILE='compile.log'
rm -f ${LOG_FILE}

echo
echo '     Compile examples'
echo


for verz in ${EXAMPLES}
  do echo                                          2>&1 | tee -a  ${LOG_FILE}
    echo '-----------  '  $verz  '  -----------'   2>&1 | tee -a  ${LOG_FILE}
    pushd $verz
    echo                                           2>&1 | tee -a  ${LOG_FILE}
    pwd                                            >>  ../${LOG_FILE}
    for comp in ${COMPTYPE}
    do echo                                        2>&1 | tee -a  ../${LOG_FILE}
      echo '###########  '  $comp '  ###########'  2>&1 | tee -a  ../${LOG_FILE}
      echo                                         2>&1 | tee -a  ../${LOG_FILE}
      make clean COMPILER=${comp}                  2>&1 | tee -a  ../${LOG_FILE}
      make COMPILER=${comp}                        2>&1 | tee -a  ../${LOG_FILE}
#       make run COMPILER=${comp}                    2>&1 | tee -a  ../${LOG_FILE}
    done
    popd
  done
    
