forked from filecoin-project/venus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
147 lines (104 loc) · 4.36 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
export CGO_CFLAGS_ALLOW=-D__BLST_PORTABLE__
export CGO_CFLAGS=-D__BLST_PORTABLE__
GO?=go
all: build
.PHONY: all
## variables
# git modules that need to be loaded
MODULES:=
ldflags=-X=github.com/filecoin-project/venus/pkg/constants.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
ifneq ($(strip $(LDFLAGS)),)
ldflags+=-extldflags=$(LDFLAGS)
endif
GOFLAGS+=-ldflags="$(ldflags)"
## FFI
FFI_PATH:=extern/filecoin-ffi/
FFI_DEPS:=.install-filcrypto
FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))
$(FFI_DEPS): build-dep/.filecoin-install ;
build-dep/.filecoin-install: $(FFI_PATH)
$(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%)
@touch $@
MODULES+=$(FFI_PATH)
BUILD_DEPS+=build-dep/.filecoin-install
CLEAN+=build-dep/.filecoin-install
## modules
build-dep:
mkdir $@
$(MODULES): build-dep/.update-modules;
# dummy file that marks the last time modules were updated
build-dep/.update-modules: build-dep;
git submodule update --init --recursive
touch $@
gen-all: cborgen gogen inline-gen api-gen bundle-gen state-type-gen
### devtool ###
cborgen:
cd venus-devtool && $(GO) run ./cborgen/*.go
gogen:
cd venus-shared && $(GO) generate ./...
inline-gen:
cd venus-devtool && $(GO) run ./inline-gen/main.go ../ ./inline-gen/inlinegen-data.json
test-venus-shared:
cd venus-shared && $(GO) test -covermode=set ./...
bundle-gen:
cd venus-devtool && $(GO) run ./bundle-gen/*.go --dst ./../venus-shared/actors/builtin_actors_gen.go
state-type-gen:
cd venus-devtool && $(GO) run ./state-type-gen/*.go --dst ./../venus-shared/types
api-gen:
find ./venus-shared/api/ -name 'client_gen.go' -delete
find ./venus-shared/api/ -name 'proxy_gen.go' -delete
cd ./venus-devtool/ && $(GO) run ./api-gen/ proxy
cd ./venus-devtool/ && $(GO) run ./api-gen/ client
cd ./venus-devtool/ && $(GO) run ./api-gen/ doc
cd ./venus-devtool/ && $(GO) run ./api-gen/ mock
compatible-all: compatible-api compatible-actor
compatible-api: api-checksum api-diff api-perm
api-checksum:
cd venus-devtool && $(GO) run ./compatible/apis/*.go checksum > ../venus-shared/compatible-checks/api-checksum.txt
api-diff:
cd venus-devtool && $(GO) run ./compatible/apis/*.go diff > ../venus-shared/compatible-checks/api-diff.txt
api-perm:
cd venus-devtool && $(GO) run ./compatible/apis/*.go perm > ../venus-shared/compatible-checks/api-perm.txt
compatible-actor: actor-templates actor-sources actor-render actor-replica
actor-templates:
cd venus-devtool && $(GO) run ./compatible/actors/*.go templates --dst ../venus-shared/actors/ > ../venus-shared/compatible-checks/actor-templates.txt
actor-sources:
cd venus-devtool && $(GO) run ./compatible/actors/*.go sources > ../venus-shared/compatible-checks/actor-sources.txt
actor-render:
cd venus-devtool && $(GO) run ./compatible/actors/*.go render ../venus-shared/actors/
actor-replica:
cd venus-devtool && $(GO) run ./compatible/actors/*.go replica --dst ../venus-shared/actors/
test:test-venus-shared
$(GO) build -o genesis-file-server ./tools/genesis-file-server
$(GO) build -o gengen ./tools/gengen
./gengen --keypath ./fixtures/live --out-car ./fixtures/live/genesis.car --out-json ./fixtures/live/gen.json --config ./fixtures/setup.json
./gengen --keypath ./fixtures/test --out-car ./fixtures/test/genesis.car --out-json ./fixtures/test/gen.json --config ./fixtures/setup.json
$(GO) test $$(go list ./... | grep -v /venus-shared/) -timeout=30m -v -integration=true -unit=false
$(GO) test $$(go list ./... | grep -v /venus-shared/) -timeout=30m -v -integration=false -unit=true
lint: $(BUILD_DEPS)
golangci-lint run
deps: $(BUILD_DEPS)
dist-clean:
git clean -xdff
git submodule deinit --all -f
build: $(BUILD_DEPS)
rm -f venus
$(GO) build -o ./venus $(GOFLAGS) .
debug: $(BUILD_DEPS)
rm -f venus
$(GO) build -o ./venus -gcflags=all="-N -l" $(GOFLAGS) .
.PHONY: docker
TAG:=test
docker: $(BUILD_DEPS)
ifdef DOCKERFILE
cp $(DOCKERFILE) ./dockerfile
else
curl -o dockerfile https://raw.githubusercontent.com/filecoin-project/venus-docs/master/script/docker/dockerfile
endif
docker build --build-arg https_proxy=$(BUILD_DOCKER_PROXY) --build-arg BUILD_TARGET=venus -t venus .
docker tag venus:latest filvenus/venus:$(TAG)
ifdef PRIVATE_REGISTRY
docker tag venus:latest $(PRIVATE_REGISTRY)/filvenus/venus:$(TAG)
endif
docker-push: docker
docker push $(PRIVATE_REGISTRY)/filvenus/venus:$(TAG)