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 ++++++++++++++++++++++++++++-- deps/zlib-1.3.1/.gitignore | 6 ++++++ deps/zlib-1.3.1/Makefile | 5 ----- 3 files changed, 34 insertions(+), 7 deletions(-) delete mode 100644 deps/zlib-1.3.1/Makefile 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 diff --git a/deps/zlib-1.3.1/.gitignore b/deps/zlib-1.3.1/.gitignore index 567609b..bd39d93 100644 --- a/deps/zlib-1.3.1/.gitignore +++ b/deps/zlib-1.3.1/.gitignore @@ -1 +1,7 @@ build/ + +configure.log +zconf.h +zlib.pc + +Makefile diff --git a/deps/zlib-1.3.1/Makefile b/deps/zlib-1.3.1/Makefile deleted file mode 100644 index 6bba86c..0000000 --- a/deps/zlib-1.3.1/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: - -@echo "Please use ./configure first. Thank you." - -distclean: - make -f Makefile.in distclean -- cgit v1.2.3-70-g09d2