-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
55 lines (43 loc) · 1.43 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
VERSION := $(shell git describe --tags --abbrev=0)
REVISION := $(shell git rev-parse --short HEAD)
LDFLAGS := -X 'main.version=$(VERSION)' \
-X 'main.revision=$(REVISION)'
NO_EMBED_PKGS := $(shell go list -e ./... | grep -v -e dashboard -e cmd)
GOIMPORTS ?= goimports
GOCILINT ?= golangci-lint
GO ?= go
GODOC ?= godoc
.DEFAULT_GOAL := help
SOURCES := $(shell find . -name "*.go" | grep -v -e "sobol/direction_numbers.go")
.PHONY: fmt
fmt: $(SOURCES) ## Formatting source codes.
@$(GOIMPORTS) -w $^
.PHONY: lint
lint: ## Run golint and go vet.
@$(GOCILINT) run ./...
.PHONY: test
test: ## Run tests with race condition checking.
@$(GO) test -race $(NO_EMBED_PKGS)
.PHONY: bench
bench: ## Run benchmarks.
@$(GO) test -bench=. -run=- -benchmem ./...
.PHONY: coverage
cover: ## Run the tests.
@$(GO) test -coverprofile=coverage.o ./...
@$(GO) tool cover -func=coverage.o
.PHONY: godoc
godoc: ## Run godoc http server
@echo "Please open http://localhost:6060/pkg/github.com/c-bata/goptuna/"
$(GODOC) -http=localhost:6060
.PHONY: generate
generate: ## Run go generate
@$(GO) generate ./...
.PHONY: build
build: ## Build example command lines.
mkdir -p ./bin/
$(GO) build -o ./bin/goptuna -ldflags "$(LDFLAGS)" cmd/main.go
./_examples/build.sh
.PHONY: help
help: ## Show help text
@echo "Commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-10s\033[0m %s\n", $$1, $$2}'