Fork from inav at github. Modified for some special functions needs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
958 B

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