diff options
Diffstat (limited to 'source/build.sh')
| -rwxr-xr-x | source/build.sh | 40 |
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 |
