-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
73 lines (57 loc) · 2.18 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
PREFIX=/usr/local
VERSION=2.0.2
DISTFILES=AUTHOR COPYING INSTALL README Makefile config user.auth main.go snowbox.8 debian init.d changelog snowbox.service usr.sbin.snowbox
all: snowbox
snowbox:
go build -o snowbox main.go
foxbox:
go build -o foxbox foxbox.go
clean:
rm -f snowbox foxbox
install: install-bin install-conf install-doc
@echo "Done."
install-bin: snowbox
@echo "Installing binary into" $(DESTDIR)$(PREFIX)/sbin/snowbox
@install -D -m 0755 -s snowbox $(DESTDIR)$(PREFIX)/sbin/snowbox
install-conf:
@if [ ! -f "$(DESTDIR)/etc/snowbox/config" ]; then \
echo "Installing config" $(DESTDIR)/etc/snowbox/config; \
install -D -m 0600 config $(DESTDIR)/etc/snowbox/config; \
fi
@if [ ! -f "$(DESTDIR)/etc/snowbox/user.auth" ]; then \
echo "Installing config" $(DESTDIR)/etc/snowbox/user.auth; \
install -D -m 0600 user.auth $(DESTDIR)/etc/snowbox/user.auth; \
fi
@if [ ! -f "$(DESTDIR)/etc/init.d/snowbox" ]; then \
echo "Installing" $(DESTDIR)/etc/init.d/snowbox; \
install -D -m 0755 init.d/snowbox $(DESTDIR)/etc/init.d/snowbox; \
fi
@if [ ! -f "$(DESTDIR)/lib/systemd/system/snowbox.service" ]; then \
echo "Installing "$(DESTDIR)/lib/systemd/system/snowbox.service; \
install -D -m 0644 snowbox.service $(DESTDIR)/lib/systemd/system/snowbox.service; \
fi
install-doc:
@install -D -m 0644 snowbox.8 $(DESTDIR)$(PREFIX)/man/man8/snowbox.8
uninstall: uninstall-bin uninstall-doc
@echo "Use make uninstall-conf to remove the configuration in /etc"
uninstall-bin:
rm -f $(DESTDIR)$(PREFIX)/sbin/snowbox
rm -f $(DESTDIR)/etc/init.d/snowbox
uninstall-doc:
rm -f $(DESTDIR)$(PREFIX)/man/man8/snowbox.8
uninstall-conf:
rm -rf /etc/snowbox
rm -f /etc/init.d/snowbox
rm -f /lib/systemd/system/snowbox.service
dist:
mkdir snowbox-$(VERSION)
cp -r $(DISTFILES) snowbox-$(VERSION)
tar -czf snowbox-$(VERSION).tar.gz snowbox-$(VERSION)
rm -rf snowbox-$(VERSION)
dist-binary: snowbox
mkdir snowbox-$(VERSION)-amd64
cp -r snowbox $(DISTFILES) snowbox-$(VERSION)-amd64
tar -czf snowbox-$(VERSION)-amd64.tar.gz snowbox-$(VERSION)-amd64
rm -rf snowbox-$(VERSION)-amd64
ssl-cert:
openssl req -new -x509 -nodes -out snowbox.cert -keyout snowbox.key -days 365 -subj '/CN=localhost'