aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorbonmas14 <bonmas14@gmail.com>2025-08-03 17:08:34 +0000
committerbonmas14 <bonmas14@gmail.com>2025-08-03 17:08:34 +0000
commita4d37d76512c293b12aab1f77961f96d572557b7 (patch)
treeb355924f5415d191c1cd0d34d7f2590f28b4d34e /build.sh
parent1cf89852f951b59b89f2a8bd7b54a0b0b74d439c (diff)
downloadungrateful-a4d37d76512c293b12aab1f77961f96d572557b7.tar.gz
ungrateful-a4d37d76512c293b12aab1f77961f96d572557b7.zip
Small changes
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh25
1 files changed, 21 insertions, 4 deletions
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