-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (53 loc) · 1.28 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
BIN := vss
VERSION := $$(make -s show-version)
CURRENT_REVISION := $(shell git rev-parse --short HEAD)
BUILD_LDFLAGS := "-s -w -X github.com/veltiosoft/go-vss.revision=$(CURRENT_REVISION)"
GOBIN ?= $(shell go env GOPATH)/bin
.PHONY: tag
tag:
git tag "v${VERSION}"
.PHONY: release
release: tag
git push origin "v${VERSION}"
.PHONY: build
build:
go build -o $(BIN) -ldflags $(BUILD_LDFLAGS) -trimpath cmd/vss/main.go
.PHONY: site
site: build
cp $(BIN) site
cd site && ./$(BIN) build
.PHONY: serve-site
serve-site: build
cp $(BIN) site
cd site && ./$(BIN) serve
.PHONY: selfupdate
selfupdate: build
./vss self update
.PHONY: show-version
show-version: $(GOBIN)/gobump
@gobump show -r .
$(GOBIN)/gobump:
@go install github.com/x-motemen/gobump/cmd/gobump@latest
.PHONY: cross
cross: $(GOBIN)/goxz
goxz -n $(BIN) -build-ldflags=$(BUILD_LDFLAGS) -trimpath ./cmd/vss
$(GOBIN)/goxz:
go install github.com/Songmu/goxz/cmd/goxz@latest
.PHONY: test
test: build
go test -shuffle=on -v ./...
.PHONY: bench
bench:
go test -v -bench=. -benchmem ./...
.PHONY: clean
clean:
rm -rf $(BIN) goxz
go clean
.PHONY: lint
lint: $(GOBIN)/golangci-lint
golangci-lint run ./...
$(GOBIN)/golangci-lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
.PHONY: fmt
fmt:
go fmt ./...