-
Notifications
You must be signed in to change notification settings - Fork 9
/
build_cvmix.sh
executable file
·71 lines (62 loc) · 1.48 KB
/
build_cvmix.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
#!/bin/bash
# This script builds CVMix code
# Python2 is required to build CVMix. Starting from v0.95-beta, Python3 is supported.
#
# Qing Li, 20190706
function usage() {
echo -e "\nBuild CVMix source code\n"
echo -e "Usage:\n$0 [arguments]\n"
echo -e "Build the source code without cleaning the old build"
echo -e "if no arguments are used\n"
echo -e "Arguments:"
echo -e " -build: build source code"
echo -e " -clean: clean old build\n"
}
# set paths
# gotmwork environment file
gotmwork_env_file="${HOME}/.gotmwork_env.sh"
if [[ -f ${gotmwork_env_file} ]]; then
source ${gotmwork_env_file}
else
echo "** GOTMWORK environment not set. Use set_gotmwork_env.sh to set it up."
exit 1
fi
srcdir="${CVMIX_ROOT}/src"
# flags to build and clean build
l_build=false
l_clean=false
# check input arguments
if [[ $# == 0 ]]; then
# build the source code by defaut
l_build=true
else
for param in "$@"; do
shift
case $param in
-build)
l_build=true
;;
-clean)
l_clean=true
;;
*)
usage
exit 1
;;
esac
done
fi
# clean build
if [[ "${l_clean}" == "true" ]]; then
echo "** Cleanning old CVMix build..."
cd ${srcdir}
make allclean
cd - &> /dev/null
fi
# build
if [[ "${l_build}" == "true" ]]; then
echo "** Building CVMix..."
cd ${srcdir}
make
cd - &> /dev/null
fi