summary refs log tree commit diff stats
path: root/Makefile
blob: 598ff00855ba8601a9f5659abad0e653fea17d2e (plain) (blame)
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
PREFIX?=/usr/local
_INSTDIR=$(PREFIX)
BINDIR?=$(_INSTDIR)/getwtxt
GOFLAGS?=-tags netgo \
				 -ldflags '-extldflags "-static"' \
				 -buildmode pie

getwtxt: getwtxt.go go.mod go.sum
	go build $(GOFLAGS) \
		-o $@

RM?=rm -f

clean:
	$(RM) getwtxt

update:
	git pull --rebase

install:
	adduser -home $(BINDIR) --system --group getwtxt
	mkdir -p $(BINDIR)/assets/tmpl $(BINDIR)/docs
	install -m755 getwtxt $(BINDIR)
	install -m644 getwtxt.yml $(BINDIR)
	install -m644 assets/style.css $(BINDIR)/assets
	install -m644 assets/tmpl/index.html $(BINDIR)/assets/tmpl
	install -m644 README.md $(BINDIR)/docs
	install -m644 LICENSE $(BINDIR)/docs
	install -m644 etc/getwtxt.service /etc/systemd/system
	chown -R getwtxt:getwtxt $(BINDIR)

uninstall:
	systemctl stop getwtxt >/dev/null 2>&1
	systemctl disable getwtxt >/dev/null 2>&1
	rm -rf $(BINDIR)
	rm -f /etc/systemd/system/getwtxt.service
	userdel getwtxt