aboutsummaryrefslogtreecommitdiff
path: root/code/build.sh
blob: bfc9a60b0ac9eb3cd13739c70a3cd15eb18c8eec (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh

ThisDir="$(dirname "$(readlink -f "$0")")"
cd "$ThisDir"

mkdir ../build > /dev/null 2>&1

# Supported: clang, g++
Compiler="clang"

CompilerFlags="
-O0
-ggdb
-DHANDMADE_INTERNAL
-DHANDMADE_SLOW
-DOS_LINUX
-nostdinc++
"

WarningFlags="-Wall
-Wextra
-Wno-sign-compare
-Wno-unused-but-set-variable
-Wno-unused-variable
-Wno-write-strings
-Wno-pointer-arith
-Wno-unused-parameter
-Wno-unused-function"

ClangCompilerFlags="
-ftime-trace
"
ClangWarningFlags="
-Wno-null-dereference
-Wno-missing-braces
-Wno-vla-extension
-Wno-writable-strings
"

# Platform specific linker flags
LinuxLinkerFlags="
-lpthread
-lasound
-lm
-lX11
-lXfixes"

if [ "$Compiler" = "clang" ]
then
 CompilerFlags="$CompilerFlags $ClangCompilerFlags"
 WarningFlags="$WarningFlags $ClangWarningFlags"
fi

printf 'linux_handmade.cpp\n'
$Compiler \
 $CompilerFlags \
 $WarningFlags \
 -o ../build/linux_handmade \
 $LinuxLinkerFlags \
 libs/linuxhmh/linux_handmade.cpp

printf 'handmade.cpp\n'
$Compiler \
 $CompilerFlags \
 $WarningFlags \
 -shared \
 -o ../build/handmade.so \
 handmade.cpp