github.com/wtsi-ssg/wrstat@v1.1.4-0.20221008232152-3030622a8cf8/Makefile (about) 1 PKG := github.com/wtsi-ssg/wrstat 2 VERSION := $(shell git describe --tags --always --long --dirty) 3 TAG := $(shell git describe --abbrev=0 --tags) 4 LDFLAGS = -ldflags "-X ${PKG}/cmd.Version=${VERSION}" 5 export GOPATH := $(shell go env GOPATH) 6 PATH := $(PATH):${GOPATH}/bin 7 8 default: install 9 10 # We require CGO_ENABLED=1 for getting group information to work properly; the 11 # pure go version doesn't work on all systems such as those using LDAP for 12 # groups 13 14 build: export CGO_ENABLED = 1 15 build: 16 go build -tags netgo ${LDFLAGS} 17 18 install: export CGO_ENABLED = 1 19 install: 20 @rm -f ${GOPATH}/bin/wrstat 21 @go install -tags netgo ${LDFLAGS} 22 @echo installed to ${GOPATH}/bin/wrstat 23 24 test: export CGO_ENABLED = 1 25 test: 26 @go test -tags netgo --count 1 ./... 27 28 race: export CGO_ENABLED = 1 29 race: 30 go test -tags netgo -race --count 1 ./... 31 32 bench: export CGO_ENABLED = 1 33 bench: 34 go test -tags netgo --count 1 -run Bench -bench=. ./... 35 36 # curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.48 37 lint: 38 @golangci-lint run 39 40 clean: 41 @rm -f ./wrstat 42 @rm -f ./dist.zip 43 44 dist: export CGO_ENABLED = 1 45 # go get -u github.com/gobuild/gopack 46 # go get -u github.com/aktau/github-release 47 dist: 48 gopack pack --os linux --arch amd64 -o linux-dist.zip 49 github-release release --tag ${TAG} --pre-release 50 github-release upload --tag ${TAG} --name wrstat-linux-x86-64.zip --file linux-dist.zip 51 @rm -f wrstat linux-dist.zip 52 53 .PHONY: test race bench lint build install clean dist