forked from iNavFlight/inav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·49 lines (41 loc) · 1.26 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
#!/usr/bin/env bash
set -e
if [[ $# == 0 ]]; then
echo -e "\
Usage syntax: ./build.sh <TARGET>
Notes:
* You can specify multiple targets.
./build.sh <TARGET_1> <TARGET_2> <TARGET_N>
* To get a list of all targets use \"help\". Hint: pipe the output through a pager.
./build.sh help | less
* To build all targets use \"all\"
./build.sh all
* To clean a target prefix it with \"clean_\".
./build.sh clean_MATEKF405SE
* To clean all targets just use \"clean\".
./build.sh clean"
exit 1
fi
if [ -z "$(docker images -q inav-build)" ]; then
echo -e "*** Building image\n"
docker build -t inav-build --build-arg USER_ID="$(id -u)" --build-arg GROUP_ID="$(id -g)" .
echo -ne "\n"
fi
if [ ! -d ./build ]; then
echo -e "*** Creating build directory\n"
mkdir ./build && chmod 777 ./build
fi
if [ ! -d ./downloads ]; then
echo -e "*** Creating downloads directory\n"
mkdir ./downloads && chmod 777 ./downloads
fi
if [ ! -d ./tools ]; then
echo -e "*** Creating tools directory\n"
mkdir ./tools && chmod 777 ./tools
fi
echo -e "*** Building targets [$@]\n"
docker run --rm -it -v "$(pwd)":/src inav-build $@
if [ -z "$(ls ./build/*.hex &> /dev/null)" ]; then
echo -e "\n*** Built targets in ./build:"
stat -c "%n (%.19y)" ./build/*.hex
fi