h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

commit fc8bdd6c8ad23868dc3722104eb710f01da03ef9
parent 93260168ed02de2eebd456e345c25f9066bb3a2c
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sat,  4 Nov 2023 21:57:21 +0100

Revert "Makefile changes"

This reverts commit 93260168ed02de2eebd456e345c25f9066bb3a2c.

Diffstat:
MMakefile | 9++-------
MREADME.md | 14++------------
Aconfigure.sh | 18++++++++++++++++++
3 files changed, 22 insertions(+), 19 deletions(-)

diff --git 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 @@ -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 @@ -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