aboutsummaryrefslogtreecommitdiff
path: root/source/build.sh
blob: e8c89bd18cece7c7e3844d1674257f789d20432b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

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 $CompilerFlags $WarningFlags -I external -o "$BuildDir"/chatty chatty.c

printf 'server.c\n'
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