From 24017f67d5d22b8a110e57617222221e136d9a6c Mon Sep 17 00:00:00 2001 From: bonmas14 Date: Tue, 30 Sep 2025 15:06:44 +0000 Subject: linux build script --- build.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'build.sh') 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 -- cgit v1.2.3-70-g09d2