-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
64 lines (52 loc) · 1.7 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOBIN=$(shell pwd)/build
# Binary names
PROJECT_NAME=swan-provider
BINARY_NAME=$(PROJECT_NAME)
PKG := "$(PROJECT_NAME)"
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
.PHONY: all ffi build clean test help
all: build
test: ## Run unittests
@go test -short ${PKG_LIST}
@echo "Done testing."
ffi:
./extern/filecoin-ffi/install-filcrypto
.PHONY: ffi
build: ## Build the binary file
@go mod download
@go mod tidy
@go build -o $(GOBIN)/$(BINARY_NAME) main.go
@echo "Done building."
@echo "Go to build folder and run \"$(GOBIN)/$(BINARY_NAME)\" to launch swan provider."
install-provider:
sudo install -C $(GOBIN)/$(BINARY_NAME) /usr/local/bin/$(BINARY_NAME)
clean: ## Remove previous build
@go clean
@rm -rf $(shell pwd)/build
@rm -rf /usr/local/bin/boost
@rm -rf /usr/local/bin/boostd
@rm -rf /usr/local/bin/boostx
@rm -rf /usr/local/bin/boostd-data
@rm -rf /usr/local/bin/booster-http
@rm -rf /usr/local/bin/booster-bitswap
@rm -rf /usr/local/bin/migrate-lid
@rm -rf /usr/local/bin/$(BINARY_NAME)
@echo "Done cleaning."
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(GOBIN)/$(BINARY_NAME) -v main.go
build_win: test
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(GOBIN)/$(BINARY_NAME) -v main.go
build_boost:
git clone https://github.com/filecoin-project/boost.git
cd boost && git checkout v2.1.0
cd boost && make build && sudo mv boostd /usr/local/bin/
rm -rf boost
.PHONY: build_boost