makerelease.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/sh
  2. srcdir="$(dirname "$0")"
  3. [ "$(echo "$srcdir" | cut -c1)" = '/' ] || srcdir="$PWD/$srcdir"
  4. die() { echo "$*"; exit 1; }
  5. # Import the makerelease.lib
  6. # https://bues.ch/cgit/misc.git/tree/makerelease.lib
  7. for path in $(echo "$PATH" | tr ':' ' '); do
  8. [ -f "$MAKERELEASE_LIB" ] && break
  9. MAKERELEASE_LIB="$path/makerelease.lib"
  10. done
  11. [ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."
  12. hook_get_version()
  13. {
  14. version="$(cat version.txt)"
  15. }
  16. hook_testbuild()
  17. {
  18. default_hook_testbuild "$1/firmware"
  19. }
  20. do_build()
  21. {
  22. local fwdir="$1"
  23. local targetdir="$2"
  24. shift 2
  25. echo
  26. echo "Building configuration: $*"
  27. mkdir -p "$targetdir"
  28. echo "$*" | tr '[:space:]' '\n' > "$targetdir/build_config.txt"
  29. make -C "$fwdir" all "$@" C=1
  30. echo "Fuse configuration:" > "$targetdir/fuses.txt"
  31. echo >> "$targetdir/fuses.txt"
  32. make --no-print-directory -C "$fwdir" print_fuses "$@" >> "$targetdir/fuses.txt"
  33. mv "$fwdir"/*.hex "$targetdir"/
  34. make -C "$fwdir" distclean "$@"
  35. }
  36. hook_pre_archives()
  37. {
  38. # Build the hex files.
  39. for dev in t13 t25 t45 t85 m88p m328p; do
  40. local fwdir="$2/firmware"
  41. local targetdir="$2/hex/$(echo "$dev" | sed -e 's/t/attiny/' -e 's/m/atmega/')"
  42. do_build "$fwdir" "$targetdir" DEV=$dev
  43. done
  44. }
  45. project=simplepwm
  46. makerelease "$@"