From fc8bdd6c8ad23868dc3722104eb710f01da03ef9 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 4 Nov 2023 21:57:21 +0100 Subject: Revert "Makefile changes" This reverts commit 93260168ed02de2eebd456e345c25f9066bb3a2c. --- Makefile | 9 ++------- README.md | 14 ++------------ configure.sh | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 19 deletions(-) create mode 100755 configure.sh diff --git a/Makefile b/Makefile index b2e6da6..082b740 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,11 @@ -# Set TYPE="AVX2" manually for advanced vector instructions -CUBETYPE = CUBE_${TYPE} +include config.mk -CFLAGS = -std=c99 -pthread -pedantic -Wall -Wextra -Wno-unused-parameter -O3 -mavx2 -DBGFLAGS = -DDEBUG -std=c99 -pthread -pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -g3 -fsanitize=address -fsanitize=undefined -mavx2 - -CC = cc all: cube.o debugcube.o cube.o: clean ${CC} -D${CUBETYPE} ${CFLAGS} -c -o cube.o src/cube.c -debugcube.o: clean +debugcube.o: ${CC} -D${CUBETYPE} ${DBGFLAGS} -c -o debugcube.o src/cube.c clean: diff --git a/README.md b/README.md index aab3e61..b95977e 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,13 @@ 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. -## Building and running tests - -Tests: +## Running tests ``` +$ ./configure.sh # Run 'TYPE=AVX2 ./configure.sh' to use AVX2 instead $ make test ``` -Benchmarks: - -``` -$ make benchmark -``` - -Prefix each make instruction with `TYPE=AVX2` to try the AVX2 version -(e.g. `TYPE=AVX2 make benchmark`). - ## TODO: ### Cleanup / refactor diff --git a/configure.sh b/configure.sh new file mode 100755 index 0000000..17673fc --- /dev/null +++ b/configure.sh @@ -0,0 +1,18 @@ +#!/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" + +if [ "$TYPE" = "AVX2" ]; then + CFLAGS="$CFLAGS -mavx2" + DBGFLAGS="$DBGFLAGS -mavx2" +fi + +{ +echo "CUBETYPE = CUBE_$TYPE"; +echo ""; +echo "CFLAGS = $CFLAGS"; +echo "DBGFLAGS = $DBGFLAGS"; +echo ""; +echo "CC = cc" +} > config.mk -- cgit v1.3