Merge branch 'master' into HDZero_SD_Support
[inav.git] / build.sh
blob58db51aa421c53699bc909dfad2fda6b5ef1d7db
1 #!/usr/bin/env bash
2 set -e
4 if [[ $# == 0 ]]; then
5 echo -e "\
6 Usage syntax: ./build.sh <TARGET>
8 Notes:
9 * You can specify multiple targets.
10 ./build.sh <TARGET_1> <TARGET_2> <TARGET_N>
11 * To get a list of all targets use \"help\". Hint: pipe the output through a pager.
12 ./build.sh help | less
13 * To build all targets use \"all\"
14 ./build.sh all
15 * To clean a target prefix it with \"clean_\".
16 ./build.sh clean_MATEKF405SE
17 * To clean all targets just use \"clean\".
18 ./build.sh clean"
19 exit 1
22 if [ -z "$(docker images -q inav-build)" ]; then
23 echo -e "*** Building image\n"
24 docker build -t inav-build .
25 echo -ne "\n"
28 if [ ! -d ./build ]; then
29 echo -e "*** Creating build directory\n"
30 mkdir ./build
33 echo -e "*** Building targets [$@]\n"
34 docker run --rm -it -v "$(pwd)":/src inav-build $@
36 if ls ./build/*.hex &> /dev/null; then
37 echo -e "\n*** Built targets in ./build:"
38 stat -c "%n (%.19y)" ./build/*.hex