aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorbonmas14 <bonmas14@gmail.com>2025-09-30 15:06:44 +0000
committerbonmas14 <bonmas14@gmail.com>2025-09-30 15:06:44 +0000
commit24017f67d5d22b8a110e57617222221e136d9a6c (patch)
tree7706ffc9fcecca075c92148ee0f40a2bf3e084d4 /build.sh
parent51ecf18f6ce5b9e06ec61423548270b4746f379d (diff)
downloadungrateful-24017f67d5d22b8a110e57617222221e136d9a6c.tar.gz
ungrateful-24017f67d5d22b8a110e57617222221e136d9a6c.zip
linux build scriptHEADmain
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh30
1 files changed, 28 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index e67c3ab..7bb62f6 100755
--- a/build.sh
+++ b/build.sh
@@ -4,7 +4,23 @@ cc="gcc"
ld="gcc"
ar="ar"
-cflags="-std=c99 -fPIC -Wall -Wno-unused-function -Wextra -g -Wno-error -pedantic -lm -ffast-math"
+config=${1,-"deb"}
+
+cflags=" -std=c99"
+
+cflags+=" -Wall"
+cflags+=" -Wno-unused-function"
+cflags+=" -Wextra"
+cflags+=" -Wno-error"
+cflags+=" -pedantic"
+
+cflags+=" -fPIC -ffast-math -lm"
+
+if [ "$config" == "rel" ]; then
+ cflags+=" -s -O3"
+else
+ cflags+=" -g -Og"
+fi
proc=$(nproc)
@@ -18,6 +34,16 @@ mkdir ./lib/
mkdir ./bin/
mkdir ./obj/
+
+if [ "$config" == "deps" ]; then
+ pushd deps/zlib-1.3.1
+ bash ./configure
+ make -j $proc all
+ sudo make install
+ make clean
+ popd
+fi
+
echo "[BUILD] ungrateful.c"
$cc $cflags \
@@ -32,7 +58,7 @@ echo "[BUILD] cynic.c"
$cc $cflags -Isrc/ \
-c -o obj/cynic.o \
- -g src/cynic.c
+ -g src/cynic.c -lz
if [[ $? -ne 0 ]]; then
exit