-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (85 loc) · 3.31 KB
/
Makefile
File metadata and controls
111 lines (85 loc) · 3.31 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
GO ?= go
GOBIN = $(CURDIR)/build/bin
PACKAGE = github.com/NilFoundation/nil
# Default mode is debug
ifeq ($(MODE),release)
TAGS = "$(BUILD_TAGS)"
else
TAGS = "$(BUILD_TAGS),assert"
endif
GO_FLAGS =
GOBUILD = $(GO) build $(GO_FLAGS) -tags $(TAGS)
GOTEST = GODEBUG=cgocheck=0 $(GO) test -tags $(BUILD_TAGS),debug,assert,test,goexperiment.synctest $(GO_FLAGS) ./... -p 2
SC_COMMANDS = sync_committee sync_committee_cli proof_provider prover nil_block_generator relayer
COMMANDS += nild nil nil-load-generator indexer cometa faucet journald_forwarder nil-relay stresser $(SC_COMMANDS)
BINARY_NAMES := cometa=nil-cometa indexer=nil-indexer
get_bin_name = $(if $(filter $(1)=%,$(BINARY_NAMES)),$(patsubst $(1)=%,%,$(filter $(1)=%,$(BINARY_NAMES))),$(1))
RLPGEN_BIN := $(GOBIN)/rlpgen
all: $(COMMANDS)
$(RLPGEN_BIN): | $(GOBIN)
@echo "Building rlpgen"
$(GOBUILD) -o $@ ./nil/cmd/rlpgen
$(GOBIN):
@mkdir -p $@
.PHONY: generated
generated: rlp pb compile-contracts generate_mocks sync_committee_targets gen_rollup_contracts_bindings
.PHONY: test
test: generated
$(GOTEST) $(CMDARGS)
%.cmd: generated
@# Note: $* is replaced by the command name
$(eval BINNAME := $(call get_bin_name,$*))
@echo "Building $*"
@cd ./nil/cmd/$* && $(GOBUILD) -o $(GOBIN)/$(BINNAME)
@echo "Run \"$(GOBIN)/$(BINNAME)\" to launch $*."
%.runcmd: %.cmd
@$(GOBIN)/$* $(CMDARGS)
$(COMMANDS): %: generated %.cmd
include nil/internal/serialization/Makefile.inc
include nil/internal/db/Makefile.inc
include nil/internal/config/Makefile.inc
include nil/internal/execution/Makefile.inc
include nil/services/rpc/rawapi/proto/Makefile.inc
include nil/go-ibft/messages/proto/Makefile.inc
include nil/Makefile.inc
.PHONY: rlp
rlp: rlp_types rlp_config rlp_execution rlp_srlz rlp_db
.PHONY: pb
pb: pb_rawapi pb_ibft
SOL_FILES := $(wildcard nil/contracts/solidity/tests/*.sol nil/contracts/solidity/*.sol)
BIN_FILES := $(patsubst nil/contracts/solidity/%.sol, contracts/compiled/%.bin, $(SOL_FILES))
CHECK_LOCKS_DIRECTORIES := ./nil/internal/network \
./nil/internal/network/connection_manager \
./nil/internal/collate
# TODO: Uncomment the line below when all checks have passed to run checklocks across all directories
# CHECK_LOCKS_DIRECTORIES := $(shell find ./nil -type f -name "*.go" | xargs -I {} dirname {} | sort -u)
.PHONY: compile-bins
compile-bins:
cd nil/contracts && go generate generate.go
$(BIN_FILES): | compile-bins
# Solidity debug console
CONSOLE_SOL := nil/contracts/solidity/system/console.sol
CONSOLE_GO := nil/internal/vm/console/console_generated.go
$(CONSOLE_SOL) $(CONSOLE_GO): nil/contracts/genlog.py
python3 nil/contracts/genlog.py $(CONSOLE_SOL) $(CONSOLE_GO)
solidity_console: $(CONSOLE_SOL) $(CONSOLE_GO)
compile-contracts: solidity_console $(BIN_FILES)
golangci-lint:
golangci-lint run
format: generated
GOPROXY= go mod tidy
GOPROXY= go mod vendor
golangci-lint fmt
lint: format golangci-lint checklocks
checklocks: generated
@export GOFLAGS="$$GOFLAGS -tags=test,goexperiment.synctest"; \
for dir in $(CHECK_LOCKS_DIRECTORIES); do \
echo ">> Checking locks correctness in $$dir"; \
go run gvisor.dev/gvisor/tools/checklocks/cmd/checklocks "$$dir" || exit 1; \
done
rpcspec:
go run nil/cmd/spec_generator/spec_generator.go
clean:
go clean -cache
rm -fr build/*
rm -fr contracts/compiled/*