-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
115 lines (88 loc) · 2.9 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
export CGO_CFLAGS_ALLOW=-D__BLST_PORTABLE__
export CGO_CFLAGS=-D__BLST_PORTABLE__
all: build
.PHONY: all
## variables
# git modules that need to be loaded
MODULES:=
ldflags=-X=github.com/ipfs-force-community/droplet/v2/version.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 $@
## build
test:
go test -race ./...
lint: $(BUILD_DEPS)
golangci-lint run
deps: $(BUILD_DEPS)
dist-clean:
git clean -xdff
git submodule deinit --all -f
build: droplet droplet-client
droplet: $(BUILD_DEPS)
rm -f droplet
go build -o ./droplet $(GOFLAGS) ./cmd/droplet
.PHONY: droplet
droplet-client: $(BUILD_DEPS)
rm -f droplet-client
go build -o ./droplet-client $(GOFLAGS) ./cmd/droplet-client
.PHONY: droplet-client
index: $(BUILD_DEPS)
rm -f index-tool
go build -o ./index-tool $(GOFLAGS) ./tools/index
.PHONY: index
debug: $(BUILD_DEPS)
rm -f droplet-client
rm -f droplet
go build -o ./droplet-client $(GOFLAGS) -gcflags="all=-N -l" ./cmd/droplet-client
go build -o ./droplet $(GOFLAGS) -gcflags="all=-N -l" ./cmd/droplet
.PHONY: debug
# docker
.PHONY: docker
TAG:=test
docker: $(BUILD_DEPS)
ifdef DOCKERFILE
cp $(DOCKERFILE) .
else
curl -O 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=droplet -t droplet .
docker build --build-arg HTTPS_PROXY=$(BUILD_DOCKER_PROXY) --build-arg BUILD_TARGET=droplet-client -t droplet-client .
docker tag droplet filvenus/droplet:$(TAG)
docker tag droplet-client filvenus/droplet-client:$(TAG)
ifdef PRIVATE_REGISTRY
docker tag droplet $(PRIVATE_REGISTRY)/filvenus/droplet:$(TAG)
docker tag droplet-client $(PRIVATE_REGISTRY)/filvenus/droplet-client:$(TAG)
endif
docker-push: docker
ifdef PRIVATE_REGISTRY
docker push $(PRIVATE_REGISTRY)/filvenus/droplet:$(TAG)
docker push $(PRIVATE_REGISTRY)/filvenus/droplet-client:$(TAG)
else
docker tag droplet filvenus/droplet:latest
docker tag droplet-client filvenus/droplet-client:latest
docker push filvenus/droplet:latest
docker push filvenus/droplet-client:latest
docker push filvenus/droplet:$(TAG)
docker push filvenus/droplet-client:$(TAG)
endif