-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
123 lines (101 loc) · 4.89 KB
/
Makefile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
BINARY_NAME = hellocontest
VERSION_NUMBER ?= $(shell git describe --tags | sed -E 's#v##')
ARCH = x86_64
DESTDIR ?=
BINDIR ?= /usr/bin
SHAREDIR ?= /usr/share
APPIMAGETOOL ?= appimagetool
all: clean test build
clean:
go clean
rm -f ${BINARY_NAME}
deps:
go get -v -t -d ./...
generate:
go generate ./core/pb
go generate ./core/session
version_number:
@echo ${VERSION_NUMBER}
test:
go test -v -timeout=30s ./...
build:
go build -trimpath -buildmode=pie -mod=readonly -modcacherw -v -ldflags "-linkmode external -extldflags \"${LDFLAGS}\" -X main.version=${VERSION_NUMBER}" -o ${BINARY_NAME}
run: build
./${BINARY_NAME}
cache_deps:
go install github.com/gotk3/gotk3/glib
go install github.com/gotk3/gotk3/cairo
go install github.com/gotk3/gotk3/pango
go install github.com/gotk3/gotk3/gdk
go install github.com/gotk3/gotk3/gtk
config:
xdg-open ~/.config/hamradio/hellocontest.json
config_backup:
mkdir -p ./.config_backup
cp -f ~/.config/hamradio/hellocontest.* ./.config_backup
config_restore:
mkdir -p ~/.config/hamradio
cp -f ./.config_backup/*.* ~/.config/hamradio
config_clear:
rm -f ~/.config/hamradio/hellocontest.*
install:
mkdir -p ${DESTDIR}${BINDIR}
cp ./${BINARY_NAME} ${DESTDIR}${BINDIR}/${BINARY_NAME}
mkdir -p ${DESTDIR}${SHAREDIR}/applications
cp ./.assets/${BINARY_NAME}.desktop ${DESTDIR}${SHAREDIR}/applications/${BINARY_NAME}.desktop
mkdir -p ${DESTDIR}${SHAREDIR}/icons/hicolor/256x256/apps/
cp ./.assets/${BINARY_NAME}-256x256.png ${DESTDIR}${SHAREDIR}/icons/hicolor/256x256/apps/${BINARY_NAME}.png
mkdir -p ${DESTDIR}${SHAREDIR}/icons/hicolor/128x128/apps/
cp ./.assets/${BINARY_NAME}-128x128.png ${DESTDIR}${SHAREDIR}/icons/hicolor/128x128/apps/${BINARY_NAME}.png
mkdir -p ${DESTDIR}${SHAREDIR}/icons/hicolor/48x48/apps/
cp ./.assets/${BINARY_NAME}-48x48.png ${DESTDIR}${SHAREDIR}/icons/hicolor/48x48/apps/${BINARY_NAME}.png
mkdir -p ${DESTDIR}${SHAREDIR}/icons/hicolor/32x32/apps/
cp ./.assets/${BINARY_NAME}-32x32.png ${DESTDIR}${SHAREDIR}/icons/hicolor/32x32/apps/${BINARY_NAME}.png
mkdir -p ${DESTDIR}${SHAREDIR}/icons/hicolor/16x16/apps/
cp ./.assets/${BINARY_NAME}-16x16.png ${DESTDIR}${SHAREDIR}/icons/hicolor/16x16/apps/${BINARY_NAME}.png
mkdir -p ${DESTDIR}${SHAREDIR}/icons/hicolor/scalable/apps/
cp ./.assets/${BINARY_NAME}.svg ${DESTDIR}${SHAREDIR}/icons/hicolor/scalable/apps/${BINARY_NAME}.svg
uninstall:
rm -f ${DESTDIR}${BINDIR}/${BINARY_NAME}
rm -f ${DESTDIR}${SHAREDIR}/applications/${BINARY_NAME}.desktop
rm -f ${DESTDIR}${SHAREDIR}/icons/hicolor/256x256/apps/${BINARY_NAME}.png
rm -f ${DESTDIR}${SHAREDIR}/icons/hicolor/128x128/apps/${BINARY_NAME}.png
rm -f ${DESTDIR}${SHAREDIR}/icons/hicolor/48x48/apps/${BINARY_NAME}.png
rm -f ${DESTDIR}${SHAREDIR}/icons/hicolor/32x32/apps/${BINARY_NAME}.png
rm -f ${DESTDIR}${SHAREDIR}/icons/hicolor/16x16/apps/${BINARY_NAME}.png
rm -f ${DESTDIR}${SHAREDIR}/icons/hicolor/scalable/apps/${BINARY_NAME}.svg
update_icons:
gtk-update-icon-cache ${DESTDIR}${SHAREDIR}/icons/hicolor
checkout_latest:
git checkout `git tag --sort=committerdate | tail -1`
latest: clean checkout_latest test build
debpkg:
sed -i -E "s#!THE_VERSION!#${VERSION_NUMBER}#" ./.debpkg/DEBIAN/control
mkdir -p ./.debpkg${BINDIR}
cp ./${BINARY_NAME} ./.debpkg${BINDIR}/${BINARY_NAME}
chmod a+x ./.debpkg${BINDIR}/${BINARY_NAME}
mkdir -p ./.debpkg${SHAREDIR}/applications
cp ./.assets/${BINARY_NAME}.desktop ./.debpkg${SHAREDIR}/applications/${BINARY_NAME}.desktop
mkdir -p ./.debpkg${SHAREDIR}/icons/hicolor/256x256/apps/
cp ./.assets/${BINARY_NAME}-256x256.png ./.debpkg${SHAREDIR}/icons/hicolor/256x256/apps/${BINARY_NAME}.png
mkdir -p ./.debpkg${SHAREDIR}/icons/hicolor/128x128/apps/
cp ./.assets/${BINARY_NAME}-128x128.png ./.debpkg${SHAREDIR}/icons/hicolor/128x128/apps/${BINARY_NAME}.png
mkdir -p ./.debpkg${SHAREDIR}/icons/hicolor/48x48/apps/
cp ./.assets/${BINARY_NAME}-48x48.png ./.debpkg${SHAREDIR}/icons/hicolor/48x48/apps/${BINARY_NAME}.png
mkdir -p ./.debpkg${SHAREDIR}/icons/hicolor/32x32/apps/
cp ./.assets/${BINARY_NAME}-32x32.png ./.debpkg${SHAREDIR}/icons/hicolor/32x32/apps/${BINARY_NAME}.png
mkdir -p ./.debpkg${SHAREDIR}/icons/hicolor/16x16/apps/
cp ./.assets/${BINARY_NAME}-16x16.png ./.debpkg${SHAREDIR}/icons/hicolor/16x16/apps/${BINARY_NAME}.png
mkdir -p ./.debpkg${SHAREDIR}/icons/hicolor/scalable/apps/
cp ./.assets/${BINARY_NAME}.svg ./.debpkg${SHAREDIR}/icons/hicolor/scalable/apps/${BINARY_NAME}.svg
dpkg-deb --build ./.debpkg .
git restore ./.debpkg/DEBIAN/control
prepare_appimage:
mkdir -p ./.appimage${BINDIR}
cp ./${BINARY_NAME} ./.appimage${BINDIR}/${BINARY_NAME}
chmod a+x ./.appimage${BINDIR}/${BINARY_NAME}
cp ./.assets/${BINARY_NAME}.desktop ./.appimage/${BINARY_NAME}.desktop
cp ./.assets/${BINARY_NAME}-256x256.png ./.appimage/${BINARY_NAME}.png
cp ./.assets/${BINARY_NAME}.svg ./.appimage/${BINARY_NAME}.svg
appimage: prepare_appimage
env ARCH=${ARCH} ${APPIMAGETOOL} .appimage ${BINARY_NAME}-${VERSION_NUMBER}-${ARCH}.AppImage