Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R4R] change makefile to support cleveldb backend #463

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ TENDER_RELEASE := $(shell grep "github.com/binance-chain/bnc-tendermint" Gopkg.t

BUILD_TAGS = netgo
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/binance-chain/node/version.GitCommit=${COMMIT_HASH} -X github.com/binance-chain/node/version.CosmosRelease=${COSMOS_RELEASE} -X github.com/binance-chain/node/version.TendermintRelease=${TENDER_RELEASE}"
# Without -lstdc++ on CentOS we will encounter link error, solution comes from: https://stackoverflow.com/a/29285011/1147187
BUILD_CGOFLAGS = CGO_ENABLED=1 CGO_LDFLAGS="-lstdc++"
BUILD_CFLAGS = ${BUILD_FLAGS} -tags "gcc"
BUILD_TESTNET_FLAGS = ${BUILD_FLAGS} -ldflags "-X github.com/binance-chain/node/app.Bech32PrefixAccAddr=tbnb"

all: get_vendor_deps format build
Expand Down Expand Up @@ -35,17 +38,45 @@ else
go build $(BUILD_FLAGS) -o build/lightd ./cmd/lightd
endif

build_c:
ifeq ($(OS),Windows_NT)
go build $(BUILD_FLAGS) -o build/bnbcli.exe ./cmd/bnbcli
go build $(BUILD_TESTNET_FLAGS) -o build/tbnbcli.exe ./cmd/bnbcli
$(BUILD_CGOFLAGS) go build $(BUILD_CFLAGS) -o build/bnbchaind.exe ./cmd/bnbchaind
$(BUILD_CGOFLAGS) go build $(BUILD_CFLAGS) -o build/bnbsentry.exe ./cmd/bnbsentry
go build $(BUILD_FLAGS) -o build/pressuremaker.exe ./cmd/pressuremaker
$(BUILD_CGOFLAGS) go build $(BUILD_CFLAGS) -o build/lightd.exe ./cmd/lightd
else
go build $(BUILD_FLAGS) -o build/bnbcli ./cmd/bnbcli
go build $(BUILD_TESTNET_FLAGS) -o build/tbnbcli ./cmd/bnbcli
$(BUILD_CGOFLAGS) go build $(BUILD_CFLAGS) -o build/bnbchaind ./cmd/bnbchaind
$(BUILD_CGOFLAGS) go build $(BUILD_CFLAGS) -o build/bnbsentry ./cmd/bnbsentry
go build $(BUILD_FLAGS) -o build/pressuremaker ./cmd/pressuremaker
$(BUILD_CGOFLAGS) go build $(BUILD_CFLAGS) -o build/lightd ./cmd/lightd
endif

build-linux:
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build

build-linux_c:
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build_c

build-alpine:
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(MAKE) build

build-alpine_c:
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(MAKE) build_c

install:
go install $(BUILD_FLAGS) ./cmd/bnbchaind
go install $(BUILD_FLAGS) ./cmd/bnbcli
go install $(BUILD_FLAGS) ./cmd/bnbsentry

install_c:
$(BUILD_CGOFLAGS) go install $(BUILD_CFLAGS) ./cmd/bnbchaind
go install $(BUILD_FLAGS) ./cmd/bnbcli
go install $(BUILD_FLAGS) ./cmd/bnbsentry

########################################
### Dependencies

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ $ make get_vendor_deps
$ make install
```

> If you want run bnbchaind with cleveldb as backend, please ensure leveldb is installed: https://github.com/google/leveldb#building,
> and change `make install` to `make install_c`
> For mac, `brew install leveldb` would help. For linux, you can build from source


**Windows**

If you are working on windows, `GOPATH` and `PATH` should already be set when you install golang.
Expand Down