aboutsummaryrefslogtreecommitdiff
path: root/tools/run_tool.sh
blob: 14d0e458408742494df69ebaf5899a5b8f5df61f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

if [ -z "$TOOL" ]; then
	echo "No tool selected (TOOL variable must be set)"
	exit 1
fi

CC="cc -std=c99 -pedantic -Wall -Wextra \
    -Wno-unused-parameter -Wno-unused-function -D$CUBETYPE \
    -D_POSIX_C_SOURCE=199309L"

if [ -n "$DEBUG" ]; then
	CC="$CC -fsanitize=address -g3"
	CUBEOBJ="debugcube.o"
else
	CC="$CC -O3"
	CUBEOBJ="cube.o"
fi

[ "$CUBETYPE" = "CUBE_AVX2" ] && CC="$CC -mavx2"

BIN="tools/run"
d="$(date +'%Y-%m-%d-%H-%M-%S')"

for t in tools/*; do
	if [ ! -d "$t" ] || [ -z "$(echo "$t" | grep "$TOOL")" ]; then
		continue
	fi
	toolname="$(basename "$t" .c)"
	$CC -o $BIN $t/*.c $CUBEOBJ || exit 1;
	$BIN | tee "tools/results/$toolname-$d.txt"
	break
done

rm -rf $BIN $CUBEOBJ

Generated with cgit - Back to sebastiano.tronto.net