forked from application-research/estuary
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
152 lines (113 loc) · 4.03 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
148
149
150
151
152
SHELL=/usr/bin/env bash
GO_BUILD_IMAGE?=golang:1.15
COMMIT := $(shell git rev-parse --short=8 HEAD)
# GITVERSION is the nearest tag plus number of commits and short form of most recent commit since the tag, if any
GITVERSION=$(shell git describe --always --tag --dirty)
unexport GOFLAGS
CLEAN:=
BINS:=
GOFLAGS:=
.PHONY: all
all: build
## FFI
FFI_PATH:=extern/filecoin-ffi/
FFI_DEPS:=.install-filcrypto
FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))
$(FFI_DEPS): build/.filecoin-install ;
build/.filecoin-install: $(FFI_PATH)
$(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%)
@touch $@
MODULES+=$(FFI_PATH)
BUILD_DEPS+=build/.filecoin-install
CLEAN+=build/.filecoin-install
ffi-version-check:
@[[ "$$(awk '/const Version/{print $$5}' extern/filecoin-ffi/version.go)" -eq 3 ]] || (echo "FFI version mismatch, update submodules"; exit 1)
BUILD_DEPS+=ffi-version-check
.PHONY: ffi-version-check
$(MODULES): build/.update-modules ;
# dummy file that marks the last time modules were updated
build/.update-modules:
git submodule update --init --recursive
ifneq ($(FFI_COMMIT_HASH),"")
git submodule update --init --recursive && cd extern/filecoin-ffi/ && git checkout -q $(FFI_COMMIT_HASH)
endif
touch $@
CLEAN+=build/.update-modules
# Once estuary has it's own version cmd add this back in
#ldflags=-X=github.com/application-research/estuary/version.GitVersion=$(GITVERSION)
#ifneq ($(strip $(LDFLAGS)),)
# ldflags+=-extldflags=$(LDFLAGS)
#endif
#GOFLAGS+=-ldflags="$(ldflags)"
# suppress a warning generated by lmdb
# export CGO_CFLAGS+=-Wno-stringop-overflow
.PHONY: build
build: deps estuary shuttle barge benchest bsget
.PHONY: deps
deps: $(BUILD_DEPS)
.PHONY: estuary
estuary:
go build $(GOFLAGS)
BINS+=estuary
.PHONY: shuttle
shuttle:
go build $(GOFLAGS) -o estuary-shuttle ./cmd/estuary-shuttle
BINS+=estuary-shuttle
.PHONY: barge
barge:
go build $(GOFLAGS) -o barge ./cmd/barge
BINS+=barge
.PHONY: benchest
benchest:
go build $(GOFLAGS) -o benchest ./cmd/benchest
BINS+=benchest
.PHONY: bsget
bsget:
go build $(GOFLAGS) -o bsget ./cmd/bsget
BINS+=bsget
.PHONY: install
install: estuary
@install -C estuary /usr/local/bin/estuary
.PHONY: install-shuttle
install-shuttle: shuttle
@install -C estuary-shuttle /usr/local/bin/estuary-shuttle
.PHONY: install-estuary-service
install-estuary-service:
cp scripts/estuary-service/estuary-setup.service /etc/systemd/system/estuary-setup.service
cp scripts/estuary-service/estuary.service /etc/systemd/system/estuary.service
mkdir -p /etc/estuary
cp scripts/estuary-service/config.env /etc/estuary/config.env
mkdir -p /var/log/estuary
cp scripts/estuary-service/log.env /etc/estuary/log.env
#TODO: if service changes to estuary user/group, need to chown the /etc/estuary dir and contents
systemctl daemon-reload
#Edit config values in /etc/estuary/config.env before running any estuary service files
#Run 'sudo systemctl start estuary-setup.service' to complete setup
#Run 'sudo systemctl enable --now estuary.service' once ready to enable and start estuary service
.PHONY: install-estuary-shuttle-service
install-estuary-shuttle-service:
cp scripts/est-shuttle-service/estuary-shuttle.service /etc/systemd/system/estuary-shuttle.service
mkdir -p /etc/estuary-shuttle
cp scripts/est-shuttle-service/config.env /etc/estuary-shuttle/config.env
mkdir -p /var/log/estuary-shuttle
cp scripts/est-shuttle-service/log.env /etc/estuary-shuttle/log.env
#TODO: if service changes to estuary user/group, need to chown the /etc/estuary dir and contents
systemctl daemon-reload
#Edit config values in /etc/estuary/config.env before running any estuary service files
#Run 'sudo systemctl start estuary-setup.service' to complete setup
#Run 'sudo systemctl enable --now estuary.service' once ready to enable and start estuary service
.PHONY: clean
clean:
rm -rf $(CLEAN) $(BINS)
.PHONY: dist-clean
dist-clean:
git clean -xdff
git submodule deinit --all -f
calibnet: GOFLAGS+=-tags=calibnet
calibnet: build
.PHONY: test
test:
go test $(GOFLAGS) -v ./...
.PHONY: generate-swagger
generate-swagger:
scripts/swagger/swag.sh