aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-05 10:17:39 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-05 10:17:39 +0200
commite419ca484e62f2771766a87bfaedf75a5f99c2b1 (patch)
tree60bfdccf6c5f51ca4716ce9daece9fb40a9128ff
parentb17411249b17133f35833c202e6c2e4bf43b3298 (diff)
downloadnissy-core-e419ca484e62f2771766a87bfaedf75a5f99c2b1.tar.gz
nissy-core-e419ca484e62f2771766a87bfaedf75a5f99c2b1.zip
Changed build options TYPE -> ARCH
Diffstat (limited to '')
-rw-r--r--Makefile8
-rw-r--r--README.md2
-rwxr-xr-xconfigure.sh18
3 files changed, 19 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 0b7204e..8ec635c 100644
--- a/Makefile
+++ b/Makefile
@@ -3,19 +3,19 @@ include config.mk
3all: cube.o debugcube.o 3all: cube.o debugcube.o
4 4
5cube.s: clean 5cube.s: clean
6 ${CC} -D${CUBETYPE} ${CFLAGS} -c -S -o cube.s src/nissy.c 6 ${CC} -D${ARCH} ${CFLAGS} -c -S -o cube.s src/nissy.c
7 7
8cube.o: clean 8cube.o: clean
9 ${CC} -D${CUBETYPE} ${CFLAGS} -c -o cube.o src/nissy.c 9 ${CC} -D${ARCH} ${CFLAGS} -c -o cube.o src/nissy.c
10 10
11debugcube.o: clean 11debugcube.o: clean
12 ${CC} -D${CUBETYPE} ${DBGFLAGS} -c -o debugcube.o src/nissy.c 12 ${CC} -D${ARCH} ${DBGFLAGS} -c -o debugcube.o src/nissy.c
13 13
14clean: 14clean:
15 rm -rf *.o run 15 rm -rf *.o run
16 16
17test: debugcube.o 17test: debugcube.o
18 CC="${CC} -D${CUBETYPE} ${DBGFLAGS}" ./test/test.sh 18 CC="${CC} -D${ARCH} ${DBGFLAGS}" ./test/test.sh
19 19
20tool: cube.o 20tool: cube.o
21 mkdir -p tools/results 21 mkdir -p tools/results
diff --git a/README.md b/README.md
index 049c31d..d0ab136 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ incomplete. To compile correctly on these processors (e.g. Mac M1/M2/M3)
33you need to manually disable optimizations: 33you need to manually disable optimizations:
34 34
35``` 35```
36$ TYPE="" ./configure.sh # Can be combined with CC=... 36$ ARCH="PORTABLE" ./configure.sh # Can be combined with CC=...
37``` 37```
38 38
39Once the configuration is done, you can build with make 39Once the configuration is done, you can build with make
diff --git a/configure.sh b/configure.sh
index e12dc06..2b68478 100755
--- a/configure.sh
+++ b/configure.sh
@@ -12,15 +12,25 @@ detectsan() {
12 12
13[ -n "$(detectarch __AVX2__)" ] && detected="AVX2" 13[ -n "$(detectarch __AVX2__)" ] && detected="AVX2"
14[ -n "$(detectarch __ARM_NEON)" ] && detected="NEON" 14[ -n "$(detectarch __ARM_NEON)" ] && detected="NEON"
15[ -z "$detected" ] && detected="PORTABLE"
15 16
16TYPE=${TYPE-"$detected"} 17ARCH=${ARCH-"$detected"}
18
19case "$ARCH" in
20AVX2|NEON|PORTABLE)
21 ;;
22*)
23 echo "Error: architecture $ARCH not supported"
24 exit 1
25 ;;
26esac
17 27
18STD="-std=c99" 28STD="-std=c99"
19WFLAGS="-pedantic -Wall -Wextra" 29WFLAGS="-pedantic -Wall -Wextra"
20# -Wstringop-overflow seems to be causing problems when combined with -O3 30# -Wstringop-overflow seems to be causing problems when combined with -O3
21# Someone else complained here: https://access.redhat.com/solutions/6755371 31# Someone else complained here: https://access.redhat.com/solutions/6755371
22WNOFLAGS="-Wno-unused-parameter -Wno-unused-function -Wno-stringop-overflow" 32WNOFLAGS="-Wno-unused-parameter -Wno-unused-function -Wno-stringop-overflow"
23[ "$TYPE" = "AVX2" ] && AVX="-mavx2" 33[ "$ARCH" = "AVX2" ] && AVX="-mavx2"
24[ -n "$(detectsan address)" ] && ADDR="-fsanitize=address" 34[ -n "$(detectsan address)" ] && ADDR="-fsanitize=address"
25[ -n "$(detectsan undefined)" ] && UNDEF="-fsanitize=undefined" 35[ -n "$(detectsan undefined)" ] && UNDEF="-fsanitize=undefined"
26SAN="$ADDR $UNDEF" 36SAN="$ADDR $UNDEF"
@@ -29,11 +39,11 @@ LIBS="-lpthread"
29CFLAGS="$STD $LIBS $WFLAGS $WNOFLAGS $AVX -O3" 39CFLAGS="$STD $LIBS $WFLAGS $WNOFLAGS $AVX -O3"
30DBGFLAGS="$STD $LIBS $WFLAGS $WNOFLAGS $SAN $AVX -g3 -DDEBUG" 40DBGFLAGS="$STD $LIBS $WFLAGS $WNOFLAGS $SAN $AVX -g3 -DDEBUG"
31 41
32echo "Cube type: CUBE_$TYPE" 42echo "Selected architecture: $ARCH"
33echo "Compiler: ${CC:-cc}" 43echo "Compiler: ${CC:-cc}"
34 44
35{ 45{
36echo "CUBETYPE = CUBE_$TYPE"; 46echo "ARCH = $ARCH";
37echo ""; 47echo "";
38echo "CFLAGS = $CFLAGS"; 48echo "CFLAGS = $CFLAGS";
39echo "DBGFLAGS = $DBGFLAGS"; 49echo "DBGFLAGS = $DBGFLAGS";

Generated with cgit - Back to sebastiano.tronto.net