forked from Foxboron/sbctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (63 loc) · 2.41 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
PROGNM := sbctl
PREFIX := /usr/local
BINDIR := $(PREFIX)/bin
LIBDIR := $(PREFIX)/lib
SHRDIR := $(PREFIX)/share
DOCDIR := $(PREFIX)/share/doc
MANDIR := $(PREFIX)/share/man
MANS = $(basename $(wildcard docs/*.txt))
GOFLAGS ?= -buildmode=pie -trimpath
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 $<
.PHONY: sbctl
sbctl:
go build -o $@ ./cmd/$@
.PHONY: completions
completions: sbctl
./sbctl completion bash | install -D /dev/stdin contrib/completions/bash-completion/completions/sbctl
./sbctl completion zsh | install -D /dev/stdin contrib/completions/zsh/site-functions/_sbctl
./sbctl completion fish | install -D /dev/stdin contrib/completions/fish/vendor_completions.d/sbctl.fish
install: sbctl completions man
install -Dm755 sbctl -t '$(DESTDIR)$(BINDIR)'
for manfile in $(MANS); do \
install -Dm644 "$$manfile" -t '$(DESTDIR)$(MANDIR)/man'"$${manfile##*.}"; \
done;
install -Dm644 contrib/completions/bash-completion/completions/sbctl '$(DESTDIR)$(SHRDIR)/bash-completion/completions/sbctl'
install -Dm644 contrib/completions/zsh/site-functions/_sbctl '$(DESTDIR)$(SHRDIR)/zsh/site-functions/_sbctl'
install -Dm644 contrib/completions/fish/vendor_completions.d/sbctl.fish '$(DESTDIR)$(SHRDIR)/fish/vendor_completions.d/sbctl.fish'
install -Dm755 contrib/kernel-install/91-sbctl.install '$(DESTDIR)$(LIBDIR)/kernel/install.d/91-sbctl.install'
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: lint
lint:
go vet ./...
go run honnef.co/go/tools/cmd/[email protected] ./...
.PHONY: test
test:
go test -v ./...
.PHONY: integration
integration:
go test -v tests/integration_test.go
.PHONY: local-aur
.ONESHELL:
local-aur:
cd ./contrib/aur/sbctl-git
mkdir -p ./src
ln -srfT $(CURDIR) ./src/sbctl
makepkg --holdver --syncdeps --noextract --force