-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·42 lines (38 loc) · 938 Bytes
/
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
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
prepare_platform() {
mkdir build
cd build && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -D "CMAKE_TOOLCHAIN_FILE=../CMake/GNU-ARM-Toolchain.cmake" ../
}
build_app() {
if [ -d "build" ]; then
cd build && make
exit 1;
else
if [ -f "Makefile" ]; then
make
exit 1;
fi
fi
echo "-- ${RED}build folder not exist or not a make project${NC}"
exit 0;
}
if [ -d "build" ]; then
echo "-- ${RED}build dir already exist! ${NC}"
while getopts "fb" option; do
case $option in
f)
rm -r build
echo "-- ${GREEN}old build dir deleted with force!${NC}"
prepare_platform
;;
b)
echo "-- ${GREEN}building app with make${NC}"
build_app
;;
esac
done
exit
fi
prepare_platform