-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (37 loc) · 1.11 KB
/
Copy pathMakefile
File metadata and controls
55 lines (37 loc) · 1.11 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.PHONY: test exec cover devtools env cloc
GOMOD:=github.com/sunmxt/arbiter
PROJECT_ROOT:=$(shell pwd)
BUILD_DIR:=build
REVISION:=$(shell git rev-parse HEAD || cat REVISION)
ifeq ($(USE_GLOBAL_GOPATH),)
export GOPATH:=$(PROJECT_ROOT)/$(BUILD_DIR)
endif
export PATH:=$(GOPATH)/bin:$(PATH)
COVERAGE_DIR:=coverage
all: cover
$(COVERAGE_DIR):
mkdir -p $(COVERAGE_DIR)
build:
mkdir build
bin: build/bin
mkdir bin
env:
@echo "export PROJECT_ROOT=\"$(PROJECT_ROOT)\""
@echo "export GOPATH=\"\$${PROJECT_ROOT}/build\""
@echo "export PATH=\"\$${PROJECT_ROOT}/bin:\$${PATH}\""
cover: coverage test
go tool cover -html=$(COVERAGE_DIR)/coverage.out -o $(COVERAGE_DIR)/coverage.html
test: coverage
go test -v -coverprofile=$(COVERAGE_DIR)/coverage.out -cover ./
go tool cover -func=$(COVERAGE_DIR)/coverage.out
cloc:
cloc . --exclude-dir=ci,mocks
devtools: $(GOPATH)/bin/gopls $(GOPATH)/bin/goimports
exec:
$(CMD)
build/bin: bin build
test -d build/bin || ln -s $$(pwd)/bin build/bin
$(GOPATH)/bin/gopls: bin
go get -u golang.org/x/tools/gopls
$(GOPATH)/bin/goimports: bin
go get -u golang.org/x/tools/cmd/goimports