forked from Foxboron/sbctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (54 loc) · 1.87 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
PROGNM ?= sbctl
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
SHRDIR ?= $(PREFIX)/share
DOCDIR ?= $(PREFIX)/share/doc
MANDIR ?= $(PREFIX)/share/man
MANS = $(basename $(wildcard docs/*.txt))
GOFLAGS ?= -buildmode=pie -trimpath
SOURCES = $(shell go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' ./...)
TAG = $(shell git describe --abbrev=0 --tags)
all: man build
build: sbctl
man: $(MANS)
$(MANS):
docs/sbctl.%: docs/sbctl.%.txt docs/asciidoc.conf
a2x --no-xmllint --asciidoc-opts="-f docs/asciidoc.conf" -d manpage -f manpage -D docs $<
sbctl: $(SOURCES)
go build ./cmd/$@
.PHONY: completion
completion:
./sbctl completion bash | install -Dm644 /dev/stdin "$(DESTDIR)$(SHRDIR)/bash-completion/completions/sbctl"
./sbctl completion zsh | install -Dm644 /dev/stdin "$(DESTDIR)$(SHRDIR)/usr/share/zsh/site-functions/_sbctl"
./sbctl completion fish | install -Dm644 /dev/stdin "$(DESTDIR)$(SHRDIR)/usr/share/fish/vendor_completions.d/sbctl.fish"
install: man completion
install -Dm755 sbctl -t $(DESTDIR)$(BINDIR)
for manfile in $(MANS); do \
install -Dm644 $$manfile -t $(DESTDIR)$(MANDIR)/man$${manfile##*.}; \
done;
install -Dm644 LICENSE -t $(DESTDIR)$(SHRDIR)/licenses/$(PROGNM)
.PHONY: release
release:
mkdir -p releases
git archive --prefix=${PROGNM}-${TAG}/ -o releases/${PROGNM}-${TAG}.tar.gz ${TAG};
gpg --detach-sign -o releases/${PROGNM}-${TAG}.tar.gz.sig releases/${PROGNM}-${TAG}.tar.gz
hub release create -m "Release: ${TAG}" -a releases/${PROGNM}-${TAG}.tar.gz.sig -a releases/${PROGNM}-${TAG}.tar.gz ${TAG}
.PHONY: push-aur
push-aur:
git subtree push -P "contrib/aur/sbctl-git" aur:sbctl-git.git master
clean:
rm -f $(MANS)
rm -f sbctl
.PHONY: deps
deps:
go get honnef.co/go/tools/cmd/[email protected]
.PHONY: lint
lint:
go vet ./...
staticcheck ./...
.PHONY: test
test:
go test -v ./...
.PHONY: integration
integration:
go test -v tests/integration_test.go