-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (29 loc) · 1.01 KB
/
Copy pathMakefile
File metadata and controls
39 lines (29 loc) · 1.01 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
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS := -s -w -X main.version=$(VERSION)
PREFIX ?= $(HOME)/.local
BIN := bin/gitident
.PHONY: all build test lint fmt install uninstall snapshot clean
all: lint test build
build:
go build -trimpath -ldflags '$(LDFLAGS)' -o $(BIN) ./cmd/gitident
ln -sf gitident bin/git-ident
test:
go test ./...
lint:
@test -z "$$(gofmt -l .)" || (echo "gofmt needed:"; gofmt -l .; exit 1)
go vet ./...
@command -v staticcheck >/dev/null && staticcheck ./... || echo "staticcheck not installed (go install honnef.co/go/tools/cmd/staticcheck@latest)"
fmt:
gofmt -w .
# Installs gitident and the git-ident symlink into $(PREFIX)/bin.
install: build
install -d $(PREFIX)/bin
install -m 0755 $(BIN) $(PREFIX)/bin/gitident
ln -sf gitident $(PREFIX)/bin/git-ident
uninstall:
rm -f $(PREFIX)/bin/gitident $(PREFIX)/bin/git-ident
# Local release dry run (needs goreleaser).
snapshot:
goreleaser release --snapshot --clean
clean:
rm -rf bin dist