aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xconfigure.sh10
-rwxr-xr-xtest/test.sh12
2 files changed, 13 insertions, 9 deletions
diff --git a/configure.sh b/configure.sh
index b9779c2..e4a142d 100755
--- a/configure.sh
+++ b/configure.sh
@@ -1,8 +1,9 @@
1#!/bin/sh 1#!/bin/sh
2 2
3detect() { cc -march=native -dM -E - < /dev/null | grep "$1"; } 3detectarch() { cc -march=native -dM -E - </dev/null | grep "$1"; }
4detectsan() { cc -fsanitize=$1 -dM -E -x c - </dev/null | grep "SANITIZE"; }
4 5
5[ -n "$(detect __AVX2__)" ] && detected="AVX2" 6[ -n "$(detectarch __AVX2__)" ] && detected="AVX2"
6 7
7TYPE=${TYPE-"$detected"} 8TYPE=${TYPE-"$detected"}
8 9
@@ -11,7 +12,10 @@ echo "Using CUBE_$TYPE"
11STD="-std=c99" 12STD="-std=c99"
12WFLAGS="-pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function" 13WFLAGS="-pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function"
13[ "$TYPE" = "AVX2" ] && AVX="-mavx2" 14[ "$TYPE" = "AVX2" ] && AVX="-mavx2"
14[ "$(uname)" = "Linux" ] && SAN="-fsanitize=address -fsanitize=undefined" 15
16[ -n "$(detectsan address)" ] && ADDR="-fsanitize=address"
17[ -n "$(detectsan undefined)" ] && UNDEF="-fsanitize=undefined"
18SAN="$ADDR $UNDEF"
15 19
16CFLAGS="$STD $WFLAGS $AVX -O3" 20CFLAGS="$STD $WFLAGS $AVX -O3"
17DBGFLAGS="$STD $WFLAGS $AVX -g3 -DDEBUG" 21DBGFLAGS="$STD $WFLAGS $AVX -g3 -DDEBUG"
diff --git a/test/test.sh b/test/test.sh
index 68b87aa..3adee3a 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -1,15 +1,15 @@
1#!/bin/sh 1#!/bin/sh
2 2
3detectsan() { cc -fsanitize=$1 -dM -E -x c - </dev/null | grep "SANITIZE"; }
4
3re="${TEST:-$@}" 5re="${TEST:-$@}"
4 6
5CC="cc -DDEBUG -std=c99 -pedantic -Wall -Wextra \ 7CC="cc -DDEBUG -std=c99 -pedantic -Wall -Wextra \
6 -Wno-unused-parameter -Wno-unused-function -g3 -D$CUBETYPE" 8 -Wno-unused-parameter -Wno-unused-function -g3 -D$CUBETYPE"
7if [ "$CUBETYPE" = "CUBE_AVX2" ]; then 9
8 CC="$CC -mavx2" 10[ "$CUBETYPE" = "CUBE_AVX2" ] && CC="$CC -mavx2"
9fi 11[ -n "$(detectsan address)" ] && CC="$CC -fsanitize=address"
10if [ "$(uname)" != "OpenBSD" ]; then 12[ -n "$(detectsan undefined)" ] && CC="$CC -fsanitize=undefined"
11 CC="$CC -fsanitize=address -fsanitize=undefined"
12fi
13 13
14TESTBIN="test/run" 14TESTBIN="test/run"
15TESTOUT="test/last.out" 15TESTOUT="test/last.out"

Generated with cgit - Back to sebastiano.tronto.net