26 lines
485 B
Bash
Executable file
26 lines
485 B
Bash
Executable file
#!/bin/sh
|
|
cd "$(dirname "$(realpath "$0")")"
|
|
set -e
|
|
alias log="echo '[build.sh]'"
|
|
|
|
TARGET="main.cu"
|
|
MODULES="matrix.cu"
|
|
|
|
if [ $# -gt 0 ]
|
|
then targets="$@"
|
|
else targets="$TARGET"
|
|
fi
|
|
|
|
mkdir -p bin
|
|
|
|
cc=hipcc
|
|
ccargs="-O2"
|
|
#ccargs="$ccargs -g -G -Xcompiler -fsanitize=address"
|
|
|
|
for target in $targets
|
|
do
|
|
sources="$MODULES $target"
|
|
inputs="$(for src in $sources; do echo "src/$src"; done | xargs)"
|
|
rm -f bin/${target}.out
|
|
$cc $ccargs -o bin/${target}.out $modules $inputs
|
|
done
|