aboutsummaryrefslogtreecommitdiffstats
path: root/makerelease.sh
blob: fbe294ef47ab2bf52b8bb9060e75dc7e208df966 (plain)
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
50
51
52
53
54
55
56
57
58
#!/bin/sh

srcdir="$(dirname "$0")"
[ "$(echo "$srcdir" | cut -c1)" = '/' ] || srcdir="$PWD/$srcdir"

die() { echo "$*"; exit 1; }

# Import the makerelease.lib
# https://bues.ch/cgit/misc.git/tree/makerelease.lib
for path in $(echo "$PATH" | tr ':' ' '); do
	[ -f "$MAKERELEASE_LIB" ] && break
	MAKERELEASE_LIB="$path/makerelease.lib"
done
[ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."

hook_get_version()
{
	version="$(cat version.txt)"
}

hook_testbuild()
{
	default_hook_testbuild "$1/firmware"
}

do_build()
{
	local fwdir="$1"
	local targetdir="$2"
	shift 2

	echo
	echo "Building configuration:  $*"
	mkdir -p "$targetdir"

	make -C "$fwdir" all "$@" C=1

	echo "Fuse configuration:" > "$targetdir/fuses.txt"
	echo >> "$targetdir/fuses.txt"
	make --no-print-directory -C "$fwdir" print_fuses "$@" >> "$targetdir/fuses.txt"

	mv "$fwdir"/*.hex "$targetdir"/
	make -C "$fwdir" distclean "$@"
}

hook_pre_archives()
{
	# Build the hex files.
	for dev in t13 t25 t45 t85 m88 m88p m328p; do
		local fwdir="$2/firmware"
		local targetdir="$2/hex/$(echo "$dev" | sed -e 's/t/attiny/' -e 's/m/atmega/')"

		do_build "$fwdir" "$targetdir" DEV=$dev
	done
}

project=simplepwm
makerelease "$@"
bues.ch cgit interface