-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (43 loc) · 2.01 KB
/
Makefile
File metadata and controls
59 lines (43 loc) · 2.01 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
56
57
58
59
ROOT_PROJECT_NAME := "hcc"
PROJECT_NAME := "violin-novnc"
BINARY_NAME := "violin-novnc"
PKG_LIST := $(shell go list ${ROOT_PROJECT_NAME}/${PROJECT_NAME}/...)
PROTO_PROJECT_NAME := "melody"
PACKAGING_SCRIPT_FILE := "packaging.sh"
.PHONY: all build clean gofmt goreport goreport_deb test coverage coverhtml lint
all: build
copy_dir: ## Copy project folder to GOPATH
@mkdir -p $(GOPATH)/src/${ROOT_PROJECT_NAME}
@rm -rf $(GOPATH)/src/${ROOT_PROJECT_NAME}/${PROJECT_NAME}
@cp -Rp `pwd` $(GOPATH)/src/${ROOT_PROJECT_NAME}/${PROJECT_NAME}
lint_dep: ## Get the dependencies for golint
@$(GOROOT)/bin/go get -u golang.org/x/lint/golint
lint: ## Lint the files
@$(GOPATH)/bin/golint -set_exit_status ${PKG_LIST}
test: ## Run unittests
@sudo -E $(GOROOT)/bin/go test -count=1 -v ${PKG_LIST}
race: ## Run data race detector
@sudo -E $(GOROOT)/bin/go test -race -v ${PKG_LIST}
coverage: ## Generate global code coverage report
@sudo -E $(GOROOT)/bin/go test -v -coverprofile=coverage.out ${PKG_LIST}
@$(GOROOT)/bin/go tool cover -func=coverage.out
coverhtml: coverage ## Generate global code coverage report in HTML
@$(GOROOT)/bin/go tool cover -html=coverage.out
gofmt: ## Run gofmt for go files
@find -name '*.go' -exec $(GOROOT)/bin/gofmt -s -w {} \;
goreport_dep: ## Get the dependencies for goreport
@make lint_dep
@$(GOROOT)/bin/go get -u github.com/gojp/goreportcard/cmd/goreportcard-cli
goreport: goreport_dep ## Make goreport
@git submodule sync --recursive
@git submodule update --init --recursive
@git --git-dir=$(PWD)/hcloud-badge/.git fetch --all
@git --git-dir=$(PWD)/hcloud-badge/.git checkout feature/dev
@git --git-dir=$(PWD)/hcloud-badge/.git pull origin feature/dev
@./hcloud-badge/hcloud_badge.sh $(PROJECT_NAME)
build: ## Build the binary file
@$(GOROOT)/bin/go build -o $(BINARY_NAME) main.go
clean: ## Remove previous build
@rm -f $(BINARY_NAME)
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'