forked from NethermindEth/juno
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (56 loc) · 1.88 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.DEFAULT_GOAL := help
.PHONY: vm
ifeq ($(VM_DEBUG),true)
GO_TAGS = -tags vm_debug
VM_TARGET = debug
else
GO_TAGS =
VM_TARGET = all
endif
ifeq ($(shell uname -s),Darwin)
export CGO_LDFLAGS=-framework Foundation -framework SystemConfiguration
endif
juno: vm core-rust ## compile
@mkdir -p build
@go build $(GO_TAGS) -a -ldflags="-X main.Version=$(shell git describe --tags)" -o build/juno ./cmd/juno/
vm:
$(MAKE) -C vm/rust $(VM_TARGET)
core-rust:
$(MAKE) -C core/rust $(VM_TARGET)
generate: ## generate
mkdir -p mocks
go generate ./...
clean-testcache:
go clean -testcache
test: clean-testcache vm core-rust ## tests
go test $(GO_TAGS) ./...
test-cached: vm core-rust ## tests with existing cache
go test $(GO_TAGS) ./...
test-race: clean-testcache vm core-rust
go test $(GO_TAGS) ./... -race
benchmarks: vm core-rust ## benchmarking
go test $(GO_TAGS) ./... -run=^# -bench=. -benchmem
test-cover: vm core-rust ## tests with coverage
mkdir -p coverage
go test $(GO_TAGS) -coverpkg=./... -coverprofile=coverage/coverage.out -covermode=atomic ./...
go tool cover -html=coverage/coverage.out -o coverage/coverage.html
install-deps: | install-gofumpt install-mockgen install-golangci-lint## install some project dependencies
install-gofumpt:
go install mvdan.cc/gofumpt@latest
install-mockgen:
go install go.uber.org/mock/mockgen@latest
install-golangci-lint:
go install github.com/golangci/golangci-lint/cmd/[email protected]
lint:
@which golangci-lint || make install-golangci-lint
golangci-lint run
tidy: ## add missing and remove unused modules
go mod tidy
format: ## run go formatter
gofumpt -l -w .
clean: ## clean project builds
$(MAKE) -C vm/rust clean
$(MAKE) -C core/rust clean
@rm -rf ./build
help: ## show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'