-
Notifications
You must be signed in to change notification settings - Fork 87
/
build.sh
112 lines (94 loc) · 1.67 KB
/
build.sh
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# echo $1
# echo $2
BUILD=$2
dec=\=\=\=\=\=\=
build_success() {
tput setaf 2
tput bold
echo $dec Build Succeeded $dec
tput sgr0
}
build_success_launch() {
tput setaf 2
tput bold
echo $dec Build Succeeded: Launching bin/$BUILD/$NAME $dec
tput sgr0
}
build_fail() {
tput setaf 1
tput bold
echo $dec Build Failed: Review the compile errors above $dec
tput sgr0
}
launch() {
tput setaf 2
tput bold
echo $dec Launching bin/$BUILD/$NAME $dec
tput sgr0
}
launch_prod() {
tput setaf 2
tput bold
echo $dec Launching Production Build: $NAME $dec
tput sgr0
}
profiler_done() {
tput setaf 2
tput bold
echo $dec Profiler Completed: View $PROF_ANALYSIS_FILE for details $dec
tput sgr0
}
profiler_error() {
tput setaf 1
tput bold
echo $dec Error: Profiler must be run on Debug build. $dec
tput sgr0
}
tput setaf 4
if [ $1 == 'buildrun' ] ; then
if $MAKE_EXEC BUILD=$BUILD; then
build_success_launch
bin/$BUILD/$NAME
else
build_fail
fi
elif [ $1 == 'build' ] ; then
if $MAKE_EXEC BUILD=$BUILD; then
build_success
else
build_fail
fi
elif [ $1 == 'rebuild' ] ; then
if $MAKE_EXEC BUILD=$BUILD rebuild; then
build_success
else
build_fail
fi
elif [ $1 == 'run' ] ; then
launch
bin/$BUILD/$NAME
elif [ $1 == 'buildprod' ] ; then
if $MAKE_EXEC BUILD=$BUILD buildprod; then
build_success
else
build_fail
fi
elif [ $1 == 'profile' ] ; then
if [ $BUILD == 'Debug' ] ; then
if $MAKE_EXEC BUILD=$BUILD; then
build_success_launch
tput sgr0
bin/$BUILD/$NAME
tput setaf 4
gprof bin/Debug/$NAME gmon.out > $PROF_ANALYSIS_FILE
profiler_done
else
build_fail
fi
else
profiler_error
fi
else
echo Command not recognized
fi
tput sgr0