#!/bin/sh
cd "$(dirname "$(realpath "$0")")"
set -e

TARGET="ex1.cu ex2.cu ex3.cu ex4.cu"

if [ $# -gt 0 ]
then TARGET=$1
fi

rm -fr bin
mkdir -p bin

for target in $TARGET
do nvcc src/$target -o bin/${target%.cu}.out
done

for target in $TARGET
do ./bin/${target%.cu}.out
done
