2019-12-11 13:55:03 +00:00
|
|
|
SHELL=/usr/bin/env bash
|
|
|
|
|
2019-07-08 15:02:03 +00:00
|
|
|
all: build
|
2019-07-17 11:42:49 +00:00
|
|
|
.PHONY: all
|
2019-07-08 15:02:03 +00:00
|
|
|
|
2020-04-30 21:20:26 +00:00
|
|
|
unexport GOFLAGS
|
|
|
|
|
2019-10-22 13:07:15 +00:00
|
|
|
GOVERSION:=$(shell go version | cut -d' ' -f 3 | cut -d. -f 2)
|
|
|
|
ifeq ($(shell expr $(GOVERSION) \< 13), 1)
|
|
|
|
$(warning Your Golang version is go 1.$(GOVERSION))
|
|
|
|
$(error Update Golang to version $(shell grep '^go' go.mod))
|
|
|
|
endif
|
2019-07-08 15:02:03 +00:00
|
|
|
|
2019-07-17 11:42:49 +00:00
|
|
|
# git modules that need to be loaded
|
|
|
|
MODULES:=
|
|
|
|
|
2019-07-19 11:56:18 +00:00
|
|
|
CLEAN:=
|
2019-12-02 14:26:39 +00:00
|
|
|
BINS:=
|
2020-04-30 21:20:26 +00:00
|
|
|
|
2020-04-30 21:24:51 +00:00
|
|
|
ldflags=-X=github.com/filecoin-project/lotus/build.CurrentCommit='+git$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))'
|
2020-04-30 21:20:26 +00:00
|
|
|
ifneq ($(strip $(LDFLAGS)),)
|
2020-04-30 21:24:51 +00:00
|
|
|
ldflags+=-extldflags=$(LDFLAGS)
|
2020-04-30 21:20:26 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
GOFLAGS+=-ldflags="$(ldflags)"
|
|
|
|
|
2019-07-19 11:56:18 +00:00
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
## FFI
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
FFI_PATH:=extern/filecoin-ffi/
|
2020-03-24 18:19:41 +00:00
|
|
|
FFI_DEPS:=.install-filcrypto
|
2019-11-27 01:46:17 +00:00
|
|
|
FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))
|
2019-07-19 11:56:18 +00:00
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
$(FFI_DEPS): build/.filecoin-install ;
|
2019-07-19 11:56:18 +00:00
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
build/.filecoin-install: $(FFI_PATH)
|
|
|
|
$(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%)
|
2019-07-17 11:42:49 +00:00
|
|
|
@touch $@
|
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
MODULES+=$(FFI_PATH)
|
|
|
|
BUILD_DEPS+=build/.filecoin-install
|
|
|
|
CLEAN+=build/.filecoin-install
|
2019-07-26 22:25:53 +00:00
|
|
|
|
2019-09-04 09:49:22 +00:00
|
|
|
$(MODULES): build/.update-modules ;
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-09-04 09:49:22 +00:00
|
|
|
# dummy file that marks the last time modules were updated
|
|
|
|
build/.update-modules:
|
|
|
|
git submodule update --init --recursive
|
|
|
|
touch $@
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-09-04 09:49:22 +00:00
|
|
|
# end git modules
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-11-30 08:21:01 +00:00
|
|
|
## MAIN BINARIES
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-07-19 11:56:18 +00:00
|
|
|
CLEAN+=build/.update-modules
|
|
|
|
|
2019-07-17 11:42:49 +00:00
|
|
|
deps: $(BUILD_DEPS)
|
|
|
|
.PHONY: deps
|
2019-07-08 11:00:52 +00:00
|
|
|
|
2019-12-11 22:00:39 +00:00
|
|
|
debug: GOFLAGS+=-tags=debug
|
2019-12-04 16:53:32 +00:00
|
|
|
debug: lotus lotus-storage-miner lotus-seal-worker lotus-seed
|
2019-11-23 19:13:07 +00:00
|
|
|
|
2020-04-17 15:58:20 +00:00
|
|
|
2k: GOFLAGS+=-tags=2k
|
|
|
|
2k: lotus lotus-storage-miner lotus-seal-worker lotus-seed
|
|
|
|
|
2019-10-04 20:10:49 +00:00
|
|
|
lotus: $(BUILD_DEPS)
|
|
|
|
rm -f lotus
|
2019-11-23 19:13:07 +00:00
|
|
|
go build $(GOFLAGS) -o lotus ./cmd/lotus
|
2019-10-02 23:36:33 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec lotus -i ./build
|
2019-10-04 20:10:49 +00:00
|
|
|
|
|
|
|
.PHONY: lotus
|
2019-11-30 08:21:01 +00:00
|
|
|
BINS+=lotus
|
2019-10-04 20:10:49 +00:00
|
|
|
|
2019-10-09 21:00:02 +00:00
|
|
|
lotus-storage-miner: $(BUILD_DEPS)
|
2019-10-04 20:10:49 +00:00
|
|
|
rm -f lotus-storage-miner
|
2019-11-24 16:35:50 +00:00
|
|
|
go build $(GOFLAGS) -o lotus-storage-miner ./cmd/lotus-storage-miner
|
2019-10-02 23:36:33 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec lotus-storage-miner -i ./build
|
2019-11-21 18:38:43 +00:00
|
|
|
.PHONY: lotus-storage-miner
|
2019-11-30 08:21:01 +00:00
|
|
|
BINS+=lotus-storage-miner
|
2019-10-04 20:10:49 +00:00
|
|
|
|
2019-11-22 16:25:56 +00:00
|
|
|
lotus-seal-worker: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-seal-worker
|
2019-12-04 16:53:32 +00:00
|
|
|
go build $(GOFLAGS) -o lotus-seal-worker ./cmd/lotus-seal-worker
|
2019-11-22 16:25:56 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec lotus-seal-worker -i ./build
|
|
|
|
.PHONY: lotus-seal-worker
|
2019-11-30 08:41:52 +00:00
|
|
|
BINS+=lotus-seal-worker
|
2019-10-04 20:10:49 +00:00
|
|
|
|
2019-12-10 10:15:50 +00:00
|
|
|
lotus-shed: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-shed
|
|
|
|
go build $(GOFLAGS) -o lotus-shed ./cmd/lotus-shed
|
2020-01-14 00:50:48 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec lotus-shed -i ./build
|
2020-02-25 07:48:41 +00:00
|
|
|
.PHONY: lotus-shed
|
|
|
|
BINS+=lotus-shed
|
2019-12-10 10:15:50 +00:00
|
|
|
|
2019-12-07 11:42:47 +00:00
|
|
|
build: lotus lotus-storage-miner lotus-seal-worker
|
2019-12-11 14:48:54 +00:00
|
|
|
@[[ $$(type -P "lotus") ]] && echo "Caution: you have \
|
2019-12-11 14:53:57 +00:00
|
|
|
an existing lotus binary in your PATH. This may cause problems if you don't run 'sudo make install'" || true
|
2019-12-11 13:55:03 +00:00
|
|
|
|
2019-07-17 11:42:49 +00:00
|
|
|
.PHONY: build
|
2019-07-08 11:00:52 +00:00
|
|
|
|
2019-10-15 02:35:22 +00:00
|
|
|
install:
|
|
|
|
install -C ./lotus /usr/local/bin/lotus
|
2019-10-17 01:24:45 +00:00
|
|
|
install -C ./lotus-storage-miner /usr/local/bin/lotus-storage-miner
|
2019-12-07 11:42:47 +00:00
|
|
|
install -C ./lotus-seal-worker /usr/local/bin/lotus-seal-worker
|
2019-10-03 18:07:49 +00:00
|
|
|
|
2020-05-27 21:12:45 +00:00
|
|
|
install-services:
|
|
|
|
install -C -m 0644 ./scripts/lotus-daemon.service /etc/systemd/system/lotus-daemon.service
|
|
|
|
install -C -m 0644 ./scripts/lotus-miner.service /etc/systemd/system/lotus-miner.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
@echo
|
|
|
|
@echo "lotus and lotus-miner services installed. Don't forget to 'systemctl enable lotus|lotus-miner' for it to be enabled on startup."
|
|
|
|
|
|
|
|
clean-services:
|
|
|
|
rm -f /etc/systemd/system/lotus-daemon.service
|
|
|
|
rm -f /etc/systemd/system/lotus-miner.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
2019-11-30 08:21:01 +00:00
|
|
|
# TOOLS
|
|
|
|
|
|
|
|
lotus-seed: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-seed
|
2019-12-04 16:53:32 +00:00
|
|
|
go build $(GOFLAGS) -o lotus-seed ./cmd/lotus-seed
|
2019-11-30 08:21:01 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec lotus-seed -i ./build
|
|
|
|
|
|
|
|
.PHONY: lotus-seed
|
|
|
|
BINS+=lotus-seed
|
|
|
|
|
2019-08-29 22:59:12 +00:00
|
|
|
benchmarks:
|
2019-08-29 23:18:26 +00:00
|
|
|
go run github.com/whyrusleeping/bencher ./... > bench.json
|
2019-08-29 23:25:23 +00:00
|
|
|
@echo Submitting results
|
|
|
|
@curl -X POST 'http://benchmark.kittyhawk.wtf/benchmark' -d '@bench.json' -u "${benchmark_http_cred}"
|
2019-08-29 23:18:26 +00:00
|
|
|
.PHONY: benchmarks
|
2019-08-29 22:59:12 +00:00
|
|
|
|
2020-05-27 12:09:04 +00:00
|
|
|
pond: 2k
|
2019-07-24 21:45:01 +00:00
|
|
|
go build -o pond ./lotuspond
|
2019-12-02 20:47:27 +00:00
|
|
|
(cd lotuspond/front && npm i && CI=false npm run build)
|
2019-07-24 21:45:01 +00:00
|
|
|
.PHONY: pond
|
2019-11-30 08:21:01 +00:00
|
|
|
BINS+=pond
|
2019-07-24 21:45:01 +00:00
|
|
|
|
2019-10-11 06:11:57 +00:00
|
|
|
townhall:
|
|
|
|
rm -f townhall
|
|
|
|
go build -o townhall ./cmd/lotus-townhall
|
|
|
|
(cd ./cmd/lotus-townhall/townhall && npm i && npm run build)
|
2019-10-29 13:06:02 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec townhall -i ./cmd/lotus-townhall -i ./build
|
2019-10-11 06:11:57 +00:00
|
|
|
.PHONY: townhall
|
2019-11-30 08:21:01 +00:00
|
|
|
BINS+=townhall
|
2019-10-11 06:11:57 +00:00
|
|
|
|
2019-10-13 07:33:25 +00:00
|
|
|
fountain:
|
|
|
|
rm -f fountain
|
|
|
|
go build -o fountain ./cmd/lotus-fountain
|
2020-01-16 00:29:23 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec fountain -i ./cmd/lotus-fountain -i ./build
|
2019-10-13 07:33:25 +00:00
|
|
|
.PHONY: fountain
|
2019-11-30 08:21:01 +00:00
|
|
|
BINS+=fountain
|
2019-10-13 07:33:25 +00:00
|
|
|
|
2019-11-16 19:51:54 +00:00
|
|
|
chainwatch:
|
|
|
|
rm -f chainwatch
|
|
|
|
go build -o chainwatch ./cmd/lotus-chainwatch
|
2020-01-14 14:24:46 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec chainwatch -i ./cmd/lotus-chainwatch -i ./build
|
2019-11-16 19:51:54 +00:00
|
|
|
.PHONY: chainwatch
|
2019-11-30 08:21:01 +00:00
|
|
|
BINS+=chainwatch
|
|
|
|
|
|
|
|
bench:
|
|
|
|
rm -f bench
|
|
|
|
go build -o bench ./cmd/lotus-bench
|
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec bench -i ./build
|
|
|
|
.PHONY: bench
|
|
|
|
BINS+=bench
|
2019-11-16 19:51:54 +00:00
|
|
|
|
2019-10-12 00:13:16 +00:00
|
|
|
stats:
|
|
|
|
rm -f stats
|
|
|
|
go build -o stats ./tools/stats
|
2020-01-14 00:50:48 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec stats -i ./build
|
2019-10-12 00:13:16 +00:00
|
|
|
.PHONY: stats
|
2019-11-30 08:21:01 +00:00
|
|
|
BINS+=stats
|
|
|
|
|
2020-01-07 14:03:58 +00:00
|
|
|
health:
|
|
|
|
rm -f lotus-health
|
|
|
|
go build -o lotus-health ./cmd/lotus-health
|
2020-01-14 17:14:59 +00:00
|
|
|
go run github.com/GeertJohan/go.rice/rice append --exec lotus-health -i ./build
|
|
|
|
|
2020-01-07 14:03:58 +00:00
|
|
|
.PHONY: health
|
|
|
|
BINS+=health
|
|
|
|
|
2019-11-30 08:21:01 +00:00
|
|
|
# MISC
|
|
|
|
|
|
|
|
buildall: $(BINS)
|
2019-10-12 00:13:16 +00:00
|
|
|
|
2020-04-03 02:03:53 +00:00
|
|
|
completions:
|
|
|
|
./scripts/make-completions.sh lotus
|
|
|
|
./scripts/make-completions.sh lotus-storage-miner
|
|
|
|
.PHONY: completions
|
|
|
|
|
|
|
|
install-completions:
|
|
|
|
mkdir -p /usr/share/bash-completion/completions /usr/local/share/zsh/site-functions/
|
|
|
|
install -C ./scripts/bash-completion/lotus /usr/share/bash-completion/completions/lotus
|
|
|
|
install -C ./scripts/bash-completion/lotus-storage-miner /usr/share/bash-completion/completions/lotus-storage-miner
|
|
|
|
install -C ./scripts/zsh-completion/lotus /usr/local/share/zsh/site-functions/_lotus
|
|
|
|
install -C ./scripts/zsh-completion/lotus-storage-miner /usr/local/share/zsh/site-functions/_lotus-storage-miner
|
|
|
|
|
2019-07-19 11:56:18 +00:00
|
|
|
clean:
|
2019-11-30 08:21:01 +00:00
|
|
|
rm -rf $(CLEAN) $(BINS)
|
2019-11-27 01:46:17 +00:00
|
|
|
-$(MAKE) -C $(FFI_PATH) clean
|
2019-07-19 11:56:18 +00:00
|
|
|
.PHONY: clean
|
|
|
|
|
2019-07-17 11:42:49 +00:00
|
|
|
dist-clean:
|
|
|
|
git clean -xdff
|
|
|
|
git submodule deinit --all -f
|
|
|
|
.PHONY: dist-clean
|
2019-07-22 22:25:35 +00:00
|
|
|
|
2019-08-21 17:15:28 +00:00
|
|
|
type-gen:
|
|
|
|
go run ./gen/main.go
|
2019-07-22 22:25:35 +00:00
|
|
|
|
2020-04-24 00:04:12 +00:00
|
|
|
method-gen:
|
|
|
|
(cd ./lotuspond/front/src/chain && go run ./methodgen.go)
|
|
|
|
|
|
|
|
gen: type-gen method-gen
|
|
|
|
|
2019-07-22 22:25:35 +00:00
|
|
|
print-%:
|
|
|
|
@echo $*=$($*)
|