aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-10-02 18:37:36 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-10-03 10:25:03 +0200
commitb8d17736ce2c85174a47c7200ef6d19a51d0c347 (patch)
treee62a8eb0c2ccf05be9b0b0791915e9aa1fca46e8
parent8d3fe446815a1631876e4170747bc6cb03a6bbf8 (diff)
downloadnissy-core-b8d17736ce2c85174a47c7200ef6d19a51d0c347.tar.gz
nissy-core-b8d17736ce2c85174a47c7200ef6d19a51d0c347.zip
Do not run make clean automatically on every build and other Makefile changes
-rw-r--r--.gitignore1
-rw-r--r--Makefile37
-rwxr-xr-xtest/test.sh4
-rwxr-xr-xtools/tool.sh (renamed from tools/run_tool.sh)5
4 files changed, 23 insertions, 24 deletions
diff --git a/.gitignore b/.gitignore
index 2e79f0a..71c8d32 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,4 +19,5 @@ test/last.*
19tools/results 19tools/results
20.vscode 20.vscode
21*.o 21*.o
22*.so
22*.s 23*.s
diff --git a/Makefile b/Makefile
index 5c655b7..4744458 100644
--- a/Makefile
+++ b/Makefile
@@ -1,36 +1,39 @@
1include config.mk 1include config.mk
2 2
3all: cube.o debugcube.o 3all: nissy.o
4 4
5cube.s: clean 5nissy.s:
6 ${CC} ${MACROS} ${CFLAGS} -c -S -o cube.s src/nissy.c 6 ${CC} ${MACROS} ${CFLAGS} -c -S -o nissy.s src/nissy.c
7 7
8cube.o: clean 8nissy.o:
9 ${CC} ${MACROS} ${CFLAGS} -c -o cube.o src/nissy.c 9 ${CC} ${MACROS} ${CFLAGS} -c -o nissy.o src/nissy.c
10 10
11debugcube.o: clean 11nissy.so:
12 ${CC} ${MACROS} ${DBGFLAGS} -c -o debugcube.o src/nissy.c 12 ${CC} ${MACROS} ${CFLAGS} -c -shared -o nissy.so src/nissy.c
13
14debugnissy.o:
15 ${CC} ${MACROS} ${DBGFLAGS} -c -o debugnissy.o src/nissy.c
13 16
14clean: 17clean:
15 rm -rf *.o run 18 rm -rf *.o run
16 19
17test: debugcube.o 20test: debugnissy.o
18 CC="${CC} ${MACROS} ${DBGFLAGS}" ./test/test.sh 21 CC="${CC} ${MACROS} ${DBGFLAGS}" OBJ=debugnissy.o ./test/test.sh
19 22
20tool: cube.o 23tool: nissy.o
21 mkdir -p tools/results 24 mkdir -p tools/results
22 CC="${CC} ${MACROS} ${CFLAGS}" CUBEOBJ=cube.o ./tools/run_tool.sh 25 CC="${CC} ${MACROS} ${CFLAGS}" OBJ=nissy.o ./tools/tool.sh
23 26
24debugtool: debugcube.o 27debugtool: debugnissy.o
25 mkdir -p tools/results 28 mkdir -p tools/results
26 CC="${CC} ${MACROS} ${DBGFLAGS}" CUBEOBJ=debugcube.o ./tools/run_tool.sh 29 CC="${CC} ${MACROS} ${DBGFLAGS}" OBJ=debugnissy.o ./tools/tool.sh
27 30
28shell: cube.o 31shell: nissy.o
29 mkdir -p tables 32 mkdir -p tables
30 ${CC} ${MACROS} ${CFLAGS} -o run cube.o shell.c 33 ${CC} ${MACROS} ${CFLAGS} -o run nissy.o shell.c
31 34
32debugshell: debugcube.o 35debugshell: debugnissy.o
33 mkdir -p tables 36 mkdir -p tables
34 ${CC} ${MACROS} ${DBGFLAGS} -o run debugcube.o shell.c 37 ${CC} ${MACROS} ${DBGFLAGS} -o run debugnissy.o shell.c
35 38
36.PHONY: all clean test tool debugtool shell debugshell 39.PHONY: all clean test tool debugtool shell debugshell
diff --git a/test/test.sh b/test/test.sh
index 14b4ca3..a675286 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -5,7 +5,6 @@ re="${TEST:-$@}"
5TESTBIN="test/run" 5TESTBIN="test/run"
6TESTOUT="test/last.out" 6TESTOUT="test/last.out"
7TESTERR="test/last.err" 7TESTERR="test/last.err"
8CUBEOBJ="debugcube.o"
9 8
10for t in test/*; do 9for t in test/*; do
11 if [ -n "$re" ] && !(echo "$t" | grep -q "$re"); then 10 if [ -n "$re" ] && !(echo "$t" | grep -q "$re"); then
@@ -14,7 +13,7 @@ for t in test/*; do
14 13
15 # Verify if $t is a directory and if its name starts with three digits 14 # Verify if $t is a directory and if its name starts with three digits
16 if [ -d "$t" ] && basename "$t" | grep -Eq '^[0-9]{3}'; then 15 if [ -d "$t" ] && basename "$t" | grep -Eq '^[0-9]{3}'; then
17 $CC -o $TESTBIN "$t"/*.c $CUBEOBJ || exit 1 16 $CC -o $TESTBIN "$t"/*.c $OBJ || exit 1
18 for cin in "$t"/*.in; do 17 for cin in "$t"/*.in; do
19 c=$(echo "$cin" | sed 's/\.in//') 18 c=$(echo "$cin" | sed 's/\.in//')
20 cout="$c.out" 19 cout="$c.out"
@@ -32,4 +31,3 @@ for t in test/*; do
32done 31done
33 32
34echo "All tests passed!" 33echo "All tests passed!"
35rm -rf $TESTBIN $TESTOUT $TESTERR $CUBEOBJ
diff --git a/tools/run_tool.sh b/tools/tool.sh
index 2216a66..64bfd89 100755
--- a/tools/run_tool.sh
+++ b/tools/tool.sh
@@ -15,11 +15,8 @@ for t in tools/*; do
15 continue 15 continue
16 fi 16 fi
17 toolname="$(basename "$t" .c)" 17 toolname="$(basename "$t" .c)"
18 $CC -o $BIN "$t"/*.c "$CUBEOBJ" || exit 1; 18 $CC -o $BIN "$t"/*.c "$OBJ" || exit 1;
19 $BIN $TOOLARGS \ 19 $BIN $TOOLARGS \
20 | tee "tools/results/$toolname-$d.txt" "tools/results/last.out" 20 | tee "tools/results/$toolname-$d.txt" "tools/results/last.out"
21 break 21 break
22done 22done
23
24# $BIN is kept so it can be run manually for profiling
25rm -rf "$CUBEOBJ"

Generated with cgit - Back to sebastiano.tronto.net