#!/bin/bash

DBG_FLAG=-g

source ./setupenv.sh
cd opencl_sgemm_lib
echo "Building lib ..."
make clean
make lib DBG_FLAG=${DBG_FLAG}

echo "Building test code ..."
arm-linux-gnueabihf-gcc  -c -O0 -I/usr/include  -g -I/opt/ti-processor-sdk-linux-k2hk-evm-03.00.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/include -idirafter /usr/include main.c
arm-linux-gnueabihf-gcc  -I/opt/ti-processor-sdk-linux-k2hk-evm-03.00.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/include -I/opt/ti-processor-sdk-linux-k2hk-evm-03.00.00.04/linux-devkit/sysroots/cortexa15hf-neon-linux-gnueabi/usr/include -idirafter /usr/include -Wall -Wfatal-errors -pg  -O0 -g main.o -o main -lrt -lpthread -lm  -L/opt/ti-processor-sdk-linux-k2hk-evm-03.00.00.04/linux-devkit/sysroots/cortexa15hf-neon-linux-gnueabi/lib -L/opt/ti-processor-sdk-linux-k2hk-evm-03.00.00.04/linux-devkit/sysroots/cortexa15hf-neon-linux-gnueabi/usr/lib -Wl,-rpath-link,/opt/ti-processor-sdk-linux-k2hk-evm-03.00.00.04/linux-devkit/sysroots/cortexa15hf-neon-linux-gnueabi/lib -Wl,-rpath-link,/opt/ti-processor-sdk-linux-k2hk-evm-03.00.00.04/linux-devkit/sysroots/cortexa15hf-neon-linux-gnueabi/usr/lib -lOpenCL -locl_util libcblas_atlas_arm/libcblas.a libcblas_atlas_arm/libatlas.a libgemm_dsp.a -lstdc++ -locl_util 

#Run the program on the K2H12
#./main-g
