diff options
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 25 |
1 files changed, 21 insertions, 4 deletions
@@ -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 |