commit 4abb81c230bfcd599ccceb2b1bcbdcadbd859537
parent 275d8c66d2aa4793d986bcc7939cb4adcd64e018
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Thu, 11 Jul 2024 15:18:16 +0200
Cleanup makefile and tools
Diffstat:
6 files changed, 8 insertions(+), 32 deletions(-)
diff --git a/Makefile b/Makefile
@@ -15,15 +15,15 @@ clean:
rm -rf *.o run
test: debugcube.o
- CUBETYPE=${CUBETYPE} TEST=${TEST} ./test/test.sh
+ CC="${CC} ${DBGFLAGS}" ./test/test.sh
tool: cube.o
mkdir -p tools/results
- CUBETYPE=${CUBETYPE} ./tools/run_tool.sh
+ CC="${CC} ${CFLAGS}" CUBEOBJ=cube.o ./tools/run_tool.sh
debugtool: debugcube.o
mkdir -p tools/results
- CUBETYPE=${CUBETYPE} DEBUG=1 ./tools/run_tool.sh
+ CC="${CC} ${DBGFLAGS}" CUBEOBJ=debugcube.o ./tools/run_tool.sh
shell: cube.o
mkdir -p tables
diff --git a/TODO.txt b/TODO.txt
@@ -99,7 +99,6 @@ switch. Here NISS may be useful.
* transform edges only for h48 coord calculation
* ptable: since it is fully symmetric, do only U or U2 at depth 1
* use threads: how to detect at runtime? what is sane number to default to?
- pthreads or threads.h?
* multisolve with adaptive threading
* Trans: don't do full compose, for some trans composing perm is enough.
Split out sumco() as a separate function and refactor, optimize.
diff --git a/configure.sh b/configure.sh
@@ -21,9 +21,10 @@ WFLAGS="-pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function"
[ -n "$(detectsan address)" ] && ADDR="-fsanitize=address"
[ -n "$(detectsan undefined)" ] && UNDEF="-fsanitize=undefined"
SAN="$ADDR $UNDEF"
+LIBS="-lpthread"
-CFLAGS="$STD $WFLAGS $AVX -O3"
-DBGFLAGS="$STD $WFLAGS $SAN $AVX -g3 -DDEBUG"
+CFLAGS="$STD $LIBS $WFLAGS $AVX -O3"
+DBGFLAGS="$STD $LIBS $WFLAGS $SAN $AVX -g3 -DDEBUG"
echo "Cube type: CUBE_$TYPE"
echo "Compiler: ${CC:-cc}"
diff --git a/test/test.sh b/test/test.sh
@@ -1,19 +1,7 @@
#!/bin/sh
-detectsan() {
- cc -fsanitize=$1 -dM -E -x c - </dev/null 2>/dev/null \
- | grep "SANITIZE"
-}
-
re="${TEST:-$@}"
-CC="cc -DDEBUG -std=c99 -pedantic -Wall -Wextra \
- -Wno-unused-parameter -Wno-unused-function -g3 -D$CUBETYPE"
-
-[ "$CUBETYPE" = "CUBE_AVX2" ] && CC="$CC -mavx2"
-[ -n "$(detectsan address)" ] && CC="$CC -fsanitize=address"
-[ -n "$(detectsan undefined)" ] && CC="$CC -fsanitize=undefined"
-
TESTBIN="test/run"
TESTOUT="test/last.out"
TESTERR="test/last.err"
diff --git a/tools/run_tool.sh b/tools/run_tool.sh
@@ -5,19 +5,7 @@ if [ -z "$TOOL" ]; then
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"
+CC="$CC -D_POSIX_C_SOURCE=199309L"
BIN="tools/run"
d="$(date +'%Y-%m-%d-%H-%M-%S')"
diff --git a/tools/stats_tables_h48/stats_tables_h48.c b/tools/stats_tables_h48/stats_tables_h48.c
@@ -127,7 +127,7 @@ int getdata(int64_t size) {
return 0;
}
-int main() {
+int main(void) {
int64_t size;
srand(time(NULL));