diff options
author | bonmas14 <bonmas14@gmail.com> | 2025-08-02 23:20:37 +0000 |
---|---|---|
committer | bonmas14 <bonmas14@gmail.com> | 2025-08-02 23:20:37 +0000 |
commit | 1cf89852f951b59b89f2a8bd7b54a0b0b74d439c (patch) | |
tree | 884af08903beba5f0e1e8435df4a1c7015270487 /build.sh | |
download | ungrateful-1cf89852f951b59b89f2a8bd7b54a0b0b74d439c.tar.gz ungrateful-1cf89852f951b59b89f2a8bd7b54a0b0b74d439c.zip |
memory manipulation, strings, allocators list and logger.
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..4cf5e42 --- /dev/null +++ b/build.sh @@ -0,0 +1,49 @@ +#!/bin/env bash + +cc="gcc" +ld="gcc" + +rm -rf ./lib/ +rm -rf ./bin/ +mkdir ./lib/ +mkdir ./bin/ + +echo "[BUILD] entry.c" + +cflags="-std=c99 -Wall -Wextra -g -Wno-error -pedantic" +$cc $cflags \ + -c -o lib/ungrateful.o \ + -g src/ungrateful.c + +if [[ $? -ne 0 ]]; then + exit +fi + +if [[ $1 == "no_tests" ]]; then + exit +fi + +echo + +for test in tests/*.c; do + fname=$(basename -- "$test") + fname="${fname%.*}" + + echo "[BUILD] $test" + + $cc $cflags -o bin/$fname $test lib/ungrateful.o -Isrc/ +done + +for case in bin/*; do + if [[ $1 == "quiet" ]]; then + $case > /dev/null 2>&1 + else + $case + fi + + if [[ $? -eq 0 ]]; then + echo "[DONE] $case" + else + echo "[FAIL] $case" + fi +done |