makerelease.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. make -C "$fwdir" all "$@" C=1
  29. echo "Fuse configuration:" > "$targetdir/fuses.txt"
  30. echo >> "$targetdir/fuses.txt"
  31. make --no-print-directory -C "$fwdir" print_fuses "$@" >> "$targetdir/fuses.txt"
  32. mv "$fwdir"/*.hex "$targetdir"/
  33. make -C "$fwdir" distclean "$@"
  34. }
  35. hook_pre_archives()
  36. {
  37. # Build the hex files.
  38. for dev in t13 t25 t45 t85 m328p; do
  39. local fwdir="$2/firmware"
  40. local targetdir="$2/hex/$(echo "$dev" | sed -e 's/t/attiny/' -e 's/m/atmega/')"
  41. do_build "$fwdir" "$targetdir" DEV=$dev
  42. done
  43. }
  44. project=pbwake
  45. makerelease "$@"