-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
54 lines (43 loc) · 1.53 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
PKG := github.com/wtsi-ssg/wrstat/v6
VERSION := $(shell git describe --tags --always --long --dirty)
TAG := $(shell git describe --abbrev=0 --tags)
LDFLAGS = -ldflags "-X ${PKG}/cmd.Version=${VERSION}"
export GOPATH := $(shell go env GOPATH)
PATH := $(PATH):${GOPATH}/bin
default: install
# We require CGO_ENABLED=1 for getting group information to work properly; the
# pure go version doesn't work on all systems such as those using LDAP for
# groups
build: export CGO_ENABLED = 1
build:
go build -tags netgo ${LDFLAGS}
install: export CGO_ENABLED = 1
install:
@rm -f ${GOPATH}/bin/wrstat
@go install -tags netgo ${LDFLAGS}
@echo installed to ${GOPATH}/bin/wrstat
test: export CGO_ENABLED = 1
test:
@go test -tags netgo --count 1 ./...
race: export CGO_ENABLED = 1
race:
go test -tags netgo -race --count 1 ./...
bench: export CGO_ENABLED = 1
bench:
go test -tags netgo --count 1 -run Bench -bench=. ./...
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1
lint: export CGO_ENABLED = 1
lint:
@golangci-lint run --timeout 2m
clean:
@rm -f ./wrstat
@rm -f ./dist.zip
dist: export CGO_ENABLED = 1
# go get -u github.com/gobuild/gopack
# go get -u github.com/aktau/github-release
dist:
gopack pack --os linux --arch amd64 -o linux-dist.zip
github-release release --tag ${TAG} --pre-release
github-release upload --tag ${TAG} --name wrstat-linux-x86-64.zip --file linux-dist.zip
@rm -f wrstat linux-dist.zip
.PHONY: test race bench lint build install clean dist