diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-02 18:37:36 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-03 10:25:03 +0200 |
| commit | b8d17736ce2c85174a47c7200ef6d19a51d0c347 (patch) | |
| tree | e62a8eb0c2ccf05be9b0b0791915e9aa1fca46e8 | |
| parent | 8d3fe446815a1631876e4170747bc6cb03a6bbf8 (diff) | |
| download | nissy-core-b8d17736ce2c85174a47c7200ef6d19a51d0c347.tar.gz nissy-core-b8d17736ce2c85174a47c7200ef6d19a51d0c347.zip | |
Do not run make clean automatically on every build and other Makefile changes
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 37 | ||||
| -rwxr-xr-x | test/test.sh | 4 | ||||
| -rwxr-xr-x | tools/tool.sh (renamed from tools/run_tool.sh) | 5 |
4 files changed, 23 insertions, 24 deletions
| @@ -19,4 +19,5 @@ test/last.* | |||
| 19 | tools/results | 19 | tools/results |
| 20 | .vscode | 20 | .vscode |
| 21 | *.o | 21 | *.o |
| 22 | *.so | ||
| 22 | *.s | 23 | *.s |
| @@ -1,36 +1,39 @@ | |||
| 1 | include config.mk | 1 | include config.mk |
| 2 | 2 | ||
| 3 | all: cube.o debugcube.o | 3 | all: nissy.o |
| 4 | 4 | ||
| 5 | cube.s: clean | 5 | nissy.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 | ||
| 8 | cube.o: clean | 8 | nissy.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 | ||
| 11 | debugcube.o: clean | 11 | nissy.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 | |||
| 14 | debugnissy.o: | ||
| 15 | ${CC} ${MACROS} ${DBGFLAGS} -c -o debugnissy.o src/nissy.c | ||
| 13 | 16 | ||
| 14 | clean: | 17 | clean: |
| 15 | rm -rf *.o run | 18 | rm -rf *.o run |
| 16 | 19 | ||
| 17 | test: debugcube.o | 20 | test: debugnissy.o |
| 18 | CC="${CC} ${MACROS} ${DBGFLAGS}" ./test/test.sh | 21 | CC="${CC} ${MACROS} ${DBGFLAGS}" OBJ=debugnissy.o ./test/test.sh |
| 19 | 22 | ||
| 20 | tool: cube.o | 23 | tool: 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 | ||
| 24 | debugtool: debugcube.o | 27 | debugtool: 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 | ||
| 28 | shell: cube.o | 31 | shell: 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 | ||
| 32 | debugshell: debugcube.o | 35 | debugshell: 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:-$@}" | |||
| 5 | TESTBIN="test/run" | 5 | TESTBIN="test/run" |
| 6 | TESTOUT="test/last.out" | 6 | TESTOUT="test/last.out" |
| 7 | TESTERR="test/last.err" | 7 | TESTERR="test/last.err" |
| 8 | CUBEOBJ="debugcube.o" | ||
| 9 | 8 | ||
| 10 | for t in test/*; do | 9 | for 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 | |||
| 32 | done | 31 | done |
| 33 | 32 | ||
| 34 | echo "All tests passed!" | 33 | echo "All tests passed!" |
| 35 | rm -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 |
| 22 | done | 22 | done |
| 23 | |||
| 24 | # $BIN is kept so it can be run manually for profiling | ||
| 25 | rm -rf "$CUBEOBJ" | ||
