-
Notifications
You must be signed in to change notification settings - Fork 141
/
Makefile
79 lines (63 loc) · 2.19 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
79
PACKAGES=$(shell go list ./... | grep -v 'tests' | grep -v 'grpc/gen')
ifneq (,$(filter $(OS),Windows_NT MINGW64))
EXE = .exe
RM = del /q
else
RM = rm -rf
endif
all: build test
########################################
### Tools needed for development
devtools:
@echo "Installing devtools"
go install github.com/golangci/golangci-lint/cmd/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/NathanBaulch/[email protected]
go install github.com/pactus-project/protoc-gen-doc/cmd/[email protected]
go install github.com/bufbuild/buf/cmd/[email protected]
go install mvdan.cc/gofumpt@latest
go install github.com/pacviewer/jrpc-gateway/[email protected]
########################################
### Building
build:
go build -o ./build/pactus-daemon$(EXE) ./cmd/daemon
go build -o ./build/pactus-wallet$(EXE) ./cmd/wallet
go build -o ./build/pactus-shell$(EXE) ./cmd/shell
build_race:
go build -race -o ./build/pactus-daemon$(EXE) ./cmd/daemon
go build -race -o ./build/pactus-wallet$(EXE) ./cmd/wallet
build_gui:
go build -tags gtk -o ./build/pactus-gui$(EXE) ./cmd/gtk
########################################
### Testing
unit_test:
go test $(PACKAGES)
test:
go test ./... -covermode=atomic
test_race:
go test ./... --race
########################################
### Docker
docker:
docker build --tag pactus .
########################################
### proto
proto:
$(RM) www/grpc/gen
cd www/grpc/buf && buf generate --template buf.gen.yaml ../proto
########################################
### Formatting the code
fmt:
gofumpt -l -w .
check:
golangci-lint run --build-tags "${BUILD_TAG}" --timeout=20m0s
# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: build build_gui
.PHONY: test unit_test test_race
.PHONY: devtools proto
.PHONY: fmt check docker