#!/bin/bash

directory=$(dirname "$(readlink -f "$0")")

echo export C_INCLUDE_PATH=$directory/include'${C_INCLUDE_PATH:+:${C_INCLUDE_PATH}}' > $directory/setup.sh
export C_INCLUDE_PATH=$directory/include 
echo export LD_LIBRARY_PATH=$directory/lib'${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> $directory/setup.sh

echo $C_INCLUDE_PATH

unamestr=$(uname -p)
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [[ "$unamestr" == 'x86_64' ]]; then
echo export PATH=$directory/bin/linux'${PATH:+:${PATH}}' >> $directory/setup.sh
else echo export PATH=$directory/bin/arm'${PATH:+:${PATH}}' >> $directory/setup.sh
fi
elif [[ "$OSTYPE" == "cygwin" ]]; then
echo export PATH=$directory/bin/cygwin'${PATH:+:${PATH}}' >> $directory/setup.sh
fi

cd $directory/lib
make clean
make
