-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (31 loc) · 1.25 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
.PHONY: build test clean
APP = gina
VERSION = $(shell git describe --tags --abbrev=0)
GO = go
GO_BUILD = $(GO) build
GO_TEST = $(GO) test -v
GO_TOOL = $(GO) tool
GOOS = ""
GOARCH = ""
GO_PKGROOT = ./...
GO_PACKAGES = $(shell $(GO_LIST) $(GO_PKGROOT))
GINA_SRCS = $(shell find cmd/gina -name "*.go" -not -name '*_test.go')
GO_LDFLAGS = -ldflags '-X main.Version=${VERSION}'
build: ## Build project
$(GO_BUILD) $(GO_LDFLAGS) -o $(APP) ./cmd/gina/...
clean: ## Clean project
-rm -rf cover.out cover.html $(APP)
test: ## Start imaging package test
env GOOS=$(GOOS) $(GO_TEST) -cover $(GO_PKGROOT) -coverprofile=cover.out
$(GO_TOOL) cover -html=cover.out -o cover.html
test-gina: ## start gina package test
env GOOS=$(GOOS) $(GO_TEST) -cover ./cmd/gina/... -coverprofile=cover.out
$(GO_TOOL) cover -html=cover.out -o cover.html
bench: ## Start benchmark
env GOOS=$(GOOS) $(GO_TEST) -bench .
compare-bench: ## Start compare benchmark between current and original code
cob --threshold 0.1 --base "d471645c770227ca1e63837f1a52cb647e30a11a"
.DEFAULT_GOAL := help
help:
@grep -E '^[0-9a-zA-Z_-]+[[:blank:]]*:.*?## .*$$' $(MAKEFILE_LIST) | sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[1;32m%-15s\033[0m %s\n", $$1, $$2}'