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
u n export GOFLAGS
2020-11-19 02:11:35 +00:00
GOVERSION := $( shell go version | cut -d' ' -f 3 | sed 's/^go//' | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}' )
i f e q ( $( shell expr $ ( GOVERSION ) \< 1015005) , 1 )
$( warning Your Golang version is go $ ( shell expr $ ( GOVERSION ) / 1000000) .$ ( shell expr $ ( GOVERSION ) % 1000000 / 1000) .$ ( shell expr $ ( GOVERSION ) % 1000) )
2020-11-17 20:20:33 +00:00
$( error Update Golang to version to at least 1.15.5)
2019-10-22 13:07:15 +00:00
e n d i f
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-06-01 18:43: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
i f n e q ( $( strip $ ( LDFLAGS ) ) , )
2020-04-30 21:24:51 +00:00
ldflags += -extldflags= $( LDFLAGS)
2020-04-30 21:20:26 +00:00
e n d i f
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
2020-07-09 03:04:45 +00:00
debug : lotus lotus -miner lotus -worker lotus -seed
2019-11-23 19:13:07 +00:00
2020-04-17 15:58:20 +00:00
2k : GOFLAGS +=-tags =2k
2020-07-09 03:04:45 +00:00
2k : lotus lotus -miner lotus -worker lotus -seed
2020-04-17 15:58:20 +00:00
2021-01-05 05:32:15 +00:00
calibnet : GOFLAGS +=-tags =calibnet
calibnet : lotus lotus -miner lotus -worker lotus -seed
2021-02-03 03:06:43 +00:00
nerpanet : GOFLAGS +=-tags =nerpanet
nerpanet : lotus lotus -miner lotus -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
2020-07-08 10:38:59 +00:00
lotus-miner : $( BUILD_DEPS )
rm -f lotus-miner
go build $( GOFLAGS) -o lotus-miner ./cmd/lotus-storage-miner
go run github.com/GeertJohan/go.rice/rice append --exec lotus-miner -i ./build
.PHONY : lotus -miner
BINS += lotus-miner
2019-10-04 20:10:49 +00:00
2020-07-09 03:04:45 +00:00
lotus-worker : $( BUILD_DEPS )
rm -f lotus-worker
go build $( GOFLAGS) -o lotus-worker ./cmd/lotus-seal-worker
go run github.com/GeertJohan/go.rice/rice append --exec lotus-worker -i ./build
.PHONY : lotus -worker
BINS += lotus-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
2020-09-15 09:45:03 +00:00
lotus-gateway : $( BUILD_DEPS )
rm -f lotus-gateway
go build $( GOFLAGS) -o lotus-gateway ./cmd/lotus-gateway
.PHONY : lotus -gateway
BINS += lotus-gateway
2020-07-09 03:04:45 +00:00
build : lotus lotus -miner lotus -worker
2019-12-11 14:48:54 +00:00
@[ [ $$ ( type -P "lotus" ) ] ] && echo " Caution: you have \
2019-12-11 14:53:57 +00:00
a n e x i s t i n g l o t u s b i n a r y i n y o u r P A T H . T h i s m a y c a u s e p r o b l e m s i f y o u d o n 't run ' s u d o m a k e i n s t a l l ' " | | t r u e
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
2020-08-05 15:26:40 +00:00
install : install -daemon install -miner install -worker
install-daemon :
2019-10-15 02:35:22 +00:00
install -C ./lotus /usr/local/bin/lotus
2019-10-03 18:07:49 +00:00
2020-08-07 03:09:26 +00:00
install-miner :
install -C ./lotus-miner /usr/local/bin/lotus-miner
2020-05-27 21:12:45 +00:00
2020-08-07 03:09:26 +00:00
install-worker :
install -C ./lotus-worker /usr/local/bin/lotus-worker
2020-05-27 21:12:45 +00:00
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-07-08 10:38:59 +00:00
lotus-pond : 2k
go build -o lotus-pond ./lotuspond
.PHONY : lotus -pond
BINS += lotus-pond
2019-07-24 21:45:01 +00:00
2020-10-20 11:21:42 +00:00
lotus-pond-front :
( cd lotuspond/front && npm i && CI = false npm run build)
.PHONY : lotus -pond -front
lotus-pond-app : lotus -pond -front lotus -pond
.PHONY : lotus -pond -app
2020-07-08 10:38:59 +00:00
lotus-townhall :
rm -f lotus-townhall
go build -o lotus-townhall ./cmd/lotus-townhall
.PHONY : lotus -townhall
BINS += lotus-townhall
2020-10-20 11:21:42 +00:00
lotus-townhall-front :
( cd ./cmd/lotus-townhall/townhall && npm i && npm run build)
.PHONY : lotus -townhall -front
lotus-townhall-app : lotus -touch lotus -townhall -front
go run github.com/GeertJohan/go.rice/rice append --exec lotus-townhall -i ./cmd/lotus-townhall -i ./build
.PHONY : lotus -townhall -app
2020-07-08 10:38:59 +00:00
lotus-fountain :
rm -f lotus-fountain
go build -o lotus-fountain ./cmd/lotus-fountain
go run github.com/GeertJohan/go.rice/rice append --exec lotus-fountain -i ./cmd/lotus-fountain -i ./build
.PHONY : lotus -fountain
BINS += lotus-fountain
lotus-chainwatch :
rm -f lotus-chainwatch
2020-08-17 15:31:59 +00:00
go build $( GOFLAGS) -o lotus-chainwatch ./cmd/lotus-chainwatch
2020-07-08 10:38:59 +00:00
.PHONY : lotus -chainwatch
BINS += lotus-chainwatch
2019-11-30 08:21:01 +00:00
2020-07-08 10:38:59 +00:00
lotus-bench :
rm -f lotus-bench
go build -o lotus-bench ./cmd/lotus-bench
go run github.com/GeertJohan/go.rice/rice append --exec lotus-bench -i ./build
.PHONY : lotus -bench
BINS += lotus-bench
lotus-stats :
rm -f lotus-stats
2020-11-03 18:13:19 +00:00
go build $( GOFLAGS) -o lotus-stats ./cmd/lotus-stats
2020-07-08 10:38:59 +00:00
go run github.com/GeertJohan/go.rice/rice append --exec lotus-stats -i ./build
.PHONY : lotus -stats
BINS += lotus-stats
2020-08-07 07:12:29 +00:00
lotus-pcr :
rm -f lotus-pcr
go build $( GOFLAGS) -o lotus-pcr ./cmd/lotus-pcr
go run github.com/GeertJohan/go.rice/rice append --exec lotus-pcr -i ./build
.PHONY : lotus -pcr
BINS += lotus-pcr
2020-07-08 10:38:59 +00:00
lotus-health :
2020-01-07 14:03:58 +00:00
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-07-08 10:38:59 +00:00
.PHONY : lotus -health
BINS += lotus-health
2020-01-14 17:14:59 +00:00
2020-10-08 23:37:17 +00:00
lotus-wallet :
rm -f lotus-wallet
2020-10-09 00:21:37 +00:00
go build -o lotus-wallet ./cmd/lotus-wallet
2020-10-08 23:37:17 +00:00
.PHONY : lotus -wallet
BINS += lotus-wallet
2020-12-04 10:39:35 +00:00
lotus-keygen :
rm -f lotus-keygen
go build -o lotus-keygen ./cmd/lotus-keygen
.PHONY : lotus -keygen
BINS += lotus-keygen
2020-07-10 12:18:09 +00:00
testground :
go build -tags testground -o /dev/null ./cmd/lotus
.PHONY : testground
BINS += testground
2020-06-30 13:46:28 +00:00
2020-08-07 03:09:26 +00:00
install-chainwatch : lotus -chainwatch
install -C ./lotus-chainwatch /usr/local/bin/lotus-chainwatch
2020-08-05 15:26:40 +00:00
# SYSTEMD
install-daemon-service : install -daemon
mkdir -p /etc/systemd/system
mkdir -p /var/log/lotus
install -C -m 0644 ./scripts/lotus-daemon.service /etc/systemd/system/lotus-daemon.service
systemctl daemon-reload
@echo
@echo "lotus-daemon service installed. Don't forget to run 'sudo systemctl start lotus-daemon' to start it and 'sudo systemctl enable lotus-daemon' for it to be enabled on startup."
install-miner-service : install -miner install -daemon -service
mkdir -p /etc/systemd/system
mkdir -p /var/log/lotus
install -C -m 0644 ./scripts/lotus-miner.service /etc/systemd/system/lotus-miner.service
systemctl daemon-reload
@echo
@echo "lotus-miner service installed. Don't forget to run 'sudo systemctl start lotus-miner' to start it and 'sudo systemctl enable lotus-miner' for it to be enabled on startup."
install-chainwatch-service : install -chainwatch install -daemon -service
mkdir -p /etc/systemd/system
mkdir -p /var/log/lotus
install -C -m 0644 ./scripts/lotus-chainwatch.service /etc/systemd/system/lotus-chainwatch.service
systemctl daemon-reload
@echo
@echo "chainwatch service installed. Don't forget to run 'sudo systemctl start lotus-chainwatch' to start it and 'sudo systemctl enable lotus-chainwatch' for it to be enabled on startup."
2020-08-07 03:09:26 +00:00
2020-08-05 15:26:40 +00:00
install-main-services : install -miner -service
install-all-services : install -main -services install -chainwatch -service
install-services : install -main -services
2020-08-07 03:09:26 +00:00
clean-daemon-service : clean -miner -service clean -chainwatch -service
2020-08-05 15:26:40 +00:00
-systemctl stop lotus-daemon
-systemctl disable lotus-daemon
rm -f /etc/systemd/system/lotus-daemon.service
systemctl daemon-reload
2020-08-07 03:09:26 +00:00
clean-miner-service :
2020-08-05 15:26:40 +00:00
-systemctl stop lotus-miner
-systemctl disable lotus-miner
rm -f /etc/systemd/system/lotus-miner.service
systemctl daemon-reload
2020-08-07 03:09:26 +00:00
2020-08-05 15:26:40 +00:00
clean-chainwatch-service :
2020-08-07 03:09:26 +00:00
-systemctl stop lotus-chainwatch
-systemctl disable lotus-chainwatch
2020-08-05 15:26:40 +00:00
rm -f /etc/systemd/system/lotus-chainwatch.service
2020-08-07 03:09:26 +00:00
systemctl daemon-reload
2020-08-05 15:26:40 +00:00
clean-main-services : clean -daemon -service
2020-08-07 03:09:26 +00:00
clean-all-services : clean -main -services
2020-08-05 15:26:40 +00:00
clean-services : clean -all -services
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
2020-07-08 10:38:59 +00:00
./scripts/make-completions.sh lotus-miner
2020-04-03 02:03:53 +00:00
.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
2020-07-08 10:38:59 +00:00
install -C ./scripts/bash-completion/lotus-miner /usr/share/bash-completion/completions/lotus-miner
2020-04-03 02:03:53 +00:00
install -C ./scripts/zsh-completion/lotus /usr/local/share/zsh/site-functions/_lotus
2020-07-08 10:38:59 +00:00
install -C ./scripts/zsh-completion/lotus-miner /usr/local/share/zsh/site-functions/_lotus-miner
2020-04-03 02:03:53 +00:00
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
2020-08-16 09:42:13 +00:00
go generate ./...
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
2020-08-24 10:20:23 +00:00
docsgen :
2020-11-12 09:29:42 +00:00
go run ./api/docgen "api/api_full.go" "FullNode" > documentation/en/api-methods.md
go run ./api/docgen "api/api_storage.go" "StorageMiner" > documentation/en/api-methods-miner.md
go run ./api/docgen "api/api_worker.go" "WorkerAPI" > documentation/en/api-methods-worker.md
2020-08-24 10:20:23 +00:00
2019-07-22 22:25:35 +00:00
print-% :
@echo $* = $( $* )