commit 93260168ed02de2eebd456e345c25f9066bb3a2c
parent 3051b2342d67dcba2fdc0010fb26f5850964c4d9
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sat, 4 Nov 2023 11:06:12 +0100
Makefile changes
Diffstat:
3 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,11 +1,16 @@
-include config.mk
+# Set TYPE="AVX2" manually for advanced vector instructions
+CUBETYPE = CUBE_${TYPE}
+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:
+debugcube.o: clean
${CC} -D${CUBETYPE} ${DBGFLAGS} -c -o debugcube.o src/cube.c
clean:
diff --git a/README.md b/README.md
@@ -4,13 +4,23 @@ 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
+
+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
@@ -1,18 +0,0 @@
-#!/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