-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_cleanup.sh
executable file
·68 lines (63 loc) · 1.6 KB
/
build_cleanup.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
#!/bin/sh
CMAKE=$(which cmake)
MAKE=$(which make)
MKDIR=$(which mkdir)
SRCDIR=$(pwd)
BUILDIR=$(pwd)/build
RM=$(which rm)
LOGGING="ON"
CANLOG="ON"
NMEAPDBG="OFF"
TARGET="DEBUG"
if [ $# -lt 1 ]
then
echo "Help: $0 build|clean|check"
exit 1
fi
if [ "$1" = "build" ]; then
echo "0% ---- Building project will start"
echo "0% ---- Creating a Temporary build directory"
$MKDIR $BUILDIR
cd $BUILDIR
echo "alias croot='cd $BUILDIR'" >> ~/.bashrc
. ~/.bashrc
echo "25% ---- configuring project environment"
$CMAKE -DCMAKE_BUILD_TYPE=$TARGET -DLOGDEBUG=$LOGGING -DCANDATALOGGER=$CANLOG -DNMEAPDEBUG=$NMEAPDBG -G "Eclipse CDT4 - Unix Makefiles" $SRCDIR >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "50% ---- building project"
$MAKE >/dev/null 2>./make.log
if [ $? -eq 0 ]
then
$MAKE install >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "100% ---- installation successfull"
exit 0
else
echo "100% ---- Error installing binary and dependencies"
fi
else
echo "100% ---- Failed Building project"
echo "100% ---- Please see make.log"
exit 2
fi
else
echo "100% ---- Failed preparing building environment"
echo "100% ---- please check all project dependencies"
exit 1
fi
elif [ "$1" = "clean" ]; then
echo "0% ---- project build cleanup"
$RM -rf $BUILDIR
echo "100% ---- All project cleanup done"
elif [ "$1" = "check" ]; then
echo "0% ---- project static code check"
./static_analyzer.sh
echo "100% ---- Static code check finished"
echo "100% ---- Please see the check report"
else
echo "Please enter an appropriate action"
echo "Help: $0 build|clean|check"
exit 1
fi