diff options
Diffstat (limited to 'tools/run_tool.sh')
| -rwxr-xr-x | tools/run_tool.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/run_tool.sh b/tools/run_tool.sh new file mode 100755 index 0000000..21b6ce9 --- /dev/null +++ b/tools/run_tool.sh | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | if [ -z "$TOOL" ]; then | ||
| 4 | echo "No tool selected (TOOL variable must be set)" | ||
| 5 | exit 1 | ||
| 6 | fi | ||
| 7 | |||
| 8 | CC="cc -std=c99 -pedantic -Wall -Wextra \ | ||
| 9 | -Wno-unused-parameter -Wno-unused-function -O3 -D$CUBETYPE \ | ||
| 10 | -D_POSIX_C_SOURCE=199309L" | ||
| 11 | |||
| 12 | [ "$CUBETYPE" = "CUBE_AVX2" ] && CC="$CC -mavx2" | ||
| 13 | |||
| 14 | BIN="tools/run" | ||
| 15 | CUBEOBJ="cube.o" | ||
| 16 | d="$(date +'%Y-%m-%d-%H-%M-%S')" | ||
| 17 | |||
| 18 | for t in tools/*; do | ||
| 19 | if [ ! -d "$t" ] || [ -z "$(echo "$t" | grep "$TOOL")" ]; then | ||
| 20 | continue | ||
| 21 | fi | ||
| 22 | $CC -o $BIN $t/*.c $CUBEOBJ || exit 1; | ||
| 23 | $BIN | ||
| 24 | break | ||
| 25 | done | ||
| 26 | |||
| 27 | rm -rf $BIN $CUBEOBJ | ||
