aboutsummaryrefslogtreecommitdiff
path: root/source/build.sh
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@keyfried.com>2025-10-12 15:24:32 +0200
committerRaymaekers Luca <luca@spacehb.net>2025-10-12 15:24:32 +0200
commit90099147cf34336ffd621f35f550e32977b97e2f (patch)
tree4eb713e78748fe5b31514886e822c245a6e9e52e /source/build.sh
parent376eadd28320e21b12488c9cbb3f154f2d573778 (diff)
checkpoint
Diffstat (limited to 'source/build.sh')
-rwxr-xr-xsource/build.sh40
1 files changed, 38 insertions, 2 deletions
diff --git a/source/build.sh b/source/build.sh
index 317e9a4..e8c89bd 100755
--- a/source/build.sh
+++ b/source/build.sh
@@ -4,11 +4,47 @@ ScriptDir="$(dirname "$(readlink -f "$0")")"
cd "$ScriptDir"
BuildDir="$ScriptDir"/../build
+CompilerFlags="
+-DIMPORT_ID=1
+"
+
+WarningFlags="
+-Wall
+-Wextra
+-Wno-unused-variable
+-Wno-unused-parameter
+-Wno-unused-but-set-variable
+-Wno-maybe-uninitialized
+-Wno-sign-compare
+"
+
+Mode="$1"
+if [ "$Mode" != "release" ]
+then
+ Mode="debug"
+fi
+printf '[Mode %s]\n' "$Mode"
+
+if [ "$Mode" = "debug" ]
+then
+ CompilerFlags="$CompilerFlags
+ -DDEBUG=1
+ -ggdb -g3
+ "
+elif [ "$Mode" = "release" ]
+then
+ CompilerFlags="$CompilerFlags
+ -O3
+ "
+fi
+
mkdir -p "$BuildDir"
+
printf 'chatty.c\n'
-gcc -DDEBUG -ggdb -Wall -pedantic -std=c11 -I external -o "$BuildDir"/chatty chatty.c
+gcc $CompilerFlags $WarningFlags -I external -o "$BuildDir"/chatty chatty.c
+
printf 'server.c\n'
-gcc -DDEBUG -ggdb -Wall -pedantic -std=c99 -o "$BuildDir"/server server.c
+gcc $CompilerFlags $WarningFlags -o "$BuildDir"/server server.c
# printf 'archived/input_box.c\n'
# gcc -DDEBUG -ggdb -Wall -pedantic -std=c11 -I external -I . -o "$BuildDir"/input_box archived/input_box.c