-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (45 loc) · 1.64 KB
/
Copy pathMakefile
File metadata and controls
62 lines (45 loc) · 1.64 KB
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
BINARY ?= burrow
PKG ?= ./cmd/burrow
VERSION ?= dev
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS = -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)
MAN_DIR ?= man/man1
MAN_FILE = $(MAN_DIR)/burrow.1
COMPLETIONS_DIR ?= completions
COMPLETION_BASH = $(COMPLETIONS_DIR)/burrow.bash
COMPLETION_ZSH = $(COMPLETIONS_DIR)/_burrow
COMPLETION_FISH = $(COMPLETIONS_DIR)/burrow.fish
.PHONY: build test coverage install manpages clean-manpages completions clean-completions
build:
mkdir -p bin
go build -ldflags '$(LDFLAGS)' -o bin/$(BINARY) $(PKG)
test:
go test ./...
coverage:
go test ./... -coverprofile=coverage.out
go tool cover -func=coverage.out
install:
go install -ldflags '$(LDFLAGS)' $(PKG)
manpages: $(MAN_FILE)
$(MAN_FILE): cmd/burrow-manpages/main.go
mkdir -p $(MAN_DIR)
go run ./cmd/burrow-manpages > $@
clean-manpages:
rm -rf $(MAN_DIR)
# Shell completion scripts. Each release archive (and Homebrew cask, AUR
# package, Scoop manifest) ships these so users get tab-completion installed
# automatically. Generated from `burrow completion <shell>` so the source of
# truth is the running CLI, not a hand-edited static file.
completions: $(COMPLETION_BASH) $(COMPLETION_ZSH) $(COMPLETION_FISH)
$(COMPLETION_BASH): bin/$(BINARY)
mkdir -p $(COMPLETIONS_DIR)
./bin/$(BINARY) completion bash > $@
$(COMPLETION_ZSH): bin/$(BINARY)
mkdir -p $(COMPLETIONS_DIR)
./bin/$(BINARY) completion zsh > $@
$(COMPLETION_FISH): bin/$(BINARY)
mkdir -p $(COMPLETIONS_DIR)
./bin/$(BINARY) completion fish > $@
clean-completions:
rm -rf $(COMPLETIONS_DIR)