From a4d37d76512c293b12aab1f77961f96d572557b7 Mon Sep 17 00:00:00 2001 From: bonmas14 Date: Sun, 3 Aug 2025 17:08:34 +0000 Subject: Small changes --- build.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'build.sh') diff --git a/build.sh b/build.sh index 4cf5e42..7984d22 100755 --- a/build.sh +++ b/build.sh @@ -2,23 +2,33 @@ cc="gcc" ld="gcc" +ar="ar" + +proc=$(nproc) rm -rf ./lib/ rm -rf ./bin/ +rm -rf ./obj/ mkdir ./lib/ mkdir ./bin/ +mkdir ./obj/ + +echo "[BUILD] ungrateful.c" -echo "[BUILD] entry.c" +cflags="-std=c99 -fPIC -Wall -Wextra -g -Wno-error -pedantic" -cflags="-std=c99 -Wall -Wextra -g -Wno-error -pedantic" $cc $cflags \ - -c -o lib/ungrateful.o \ + -c -o obj/ungrateful.o \ -g src/ungrateful.c if [[ $? -ne 0 ]]; then exit fi +$ar rcs lib/libungrateful.a obj/ungrateful.o + +# ------------ Tests from here +# if [[ $1 == "no_tests" ]]; then exit fi @@ -31,9 +41,16 @@ for test in tests/*.c; do echo "[BUILD] $test" - $cc $cflags -o bin/$fname $test lib/ungrateful.o -Isrc/ + $cc $cflags -o bin/$fname $test -Llib/ -Isrc/ -lungrateful & + + if [[ $(jobs -r -p | wc -l) -ge $proc ]]; then + wait + fi done +wait +echo + for case in bin/*; do if [[ $1 == "quiet" ]]; then $case > /dev/null 2>&1 -- cgit v1.2.3-70-g09d2