-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (33 loc) · 930 Bytes
/
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
PROJECT_NAME := "binutils"
PKG := "github.com/amarin/$(PROJECT_NAME)"
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
.PHONY: all dep build clean test coverage coverhtml lint tidy
all: build
## Lint the files
lint:
@golint -set_exit_status ${PKG_LIST}
## Run unittests
test:
@go test -short ${PKG_LIST}
## Tidy go dependencies
tidy:
@go mod tidy
## Get the dependencies
dep: tidy
@go get -v -d ./...
## Run data race detector
race: dep
@go test -race -short ${PKG_LIST}
## Run memory sanitizer
msan: dep
@go test -msan -short ${PKG_LIST}
## Remove previous build
clean:
@rm -f $(PROJECT_NAME)
## Build the binary file
build: dep
@go build -i -v $(PKG)
## Display this help screen
help:
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'