From 9c1659d91a331735f88c127aa236a59153e23dfc Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 4 Nov 2023 22:07:15 +0100 Subject: Reverted some Makefile changes, cleanup --- Makefile | 2 +- README.md | 21 +++++++++++++++++++-- configure.sh | 12 ++++++------ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 082b740..304433f 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ all: cube.o debugcube.o cube.o: clean ${CC} -D${CUBETYPE} ${CFLAGS} -c -o cube.o src/cube.c -debugcube.o: +debugcube.o: clean ${CC} -D${CUBETYPE} ${DBGFLAGS} -c -o debugcube.o src/cube.c clean: diff --git a/README.md b/README.md index b95977e..616c066 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,30 @@ Work in progress. There is some documentation at the bottom of this page, but do not believe it. Everything is in a state of flux and can change without notice. -## Running tests +## Building and running tests + +First run + +``` +$ ./configure.sh +``` + +or `TYPE=AVX2 ./configure.sh` if you want to use AVX2 instructions. + +Then ``` -$ ./configure.sh # Run 'TYPE=AVX2 ./configure.sh' to use AVX2 instead $ make test ``` +to run the tests. You can also run + +``` +$ make benchmark +``` + +for benchmarks. + ## TODO: ### Cleanup / refactor diff --git a/configure.sh b/configure.sh index 17673fc..74df81e 100755 --- a/configure.sh +++ b/configure.sh @@ -1,12 +1,12 @@ #!/bin/sh -CFLAGS="-std=c99 -pthread -pedantic -Wall -Wextra -Wno-unused-parameter -O3" -DBGFLAGS="-DDEBUG -std=c99 -pthread -pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -g3 -fsanitize=address -fsanitize=undefined" +STD="-std=c99" +WFLAGS="-pedantic -Wall -Wextra -Wno-unused-parameter" +[ "$TYPE" = "AVX2" ] && AVX="-mavx2" +[ "$(uname)" = "Linux" ] && SAN="-fsanitize=address -fsanitize=undefined" -if [ "$TYPE" = "AVX2" ]; then - CFLAGS="$CFLAGS -mavx2" - DBGFLAGS="$DBGFLAGS -mavx2" -fi +CFLAGS="$STD $WFLAGS $AVX -O3" +DBGFLAGS="$STD $WFLAGS $AVX -g3 -DDEBUG" { echo "CUBETYPE = CUBE_$TYPE"; -- cgit v1.3