From 4abb81c230bfcd599ccceb2b1bcbdcadbd859537 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 11 Jul 2024 15:18:16 +0200 Subject: Cleanup makefile and tools --- Makefile | 6 +++--- TODO.txt | 1 - configure.sh | 5 +++-- test/test.sh | 12 ------------ tools/run_tool.sh | 14 +------------- tools/stats_tables_h48/stats_tables_h48.c | 2 +- 6 files changed, 8 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index cdf5bcd..8ff5f47 100644 --- 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 index ac989c8..d6f79a8 100644 --- 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 index d5586db..76d02de 100755 --- 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 index 8e50cf5..33613b1 100755 --- a/test/test.sh +++ b/test/test.sh @@ -1,19 +1,7 @@ #!/bin/sh -detectsan() { - cc -fsanitize=$1 -dM -E -x c - /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 index 14d0e45..495d68c 100755 --- 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 index fc8c981..7c6bc3c 100644 --- 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)); -- cgit v1.3