Skip to content

Commit

Permalink
Merge pull request #463 from binance-chain/cleveldb
Browse files Browse the repository at this point in the history
[R4R] change makefile to support cleveldb backend
  • Loading branch information
ackratos authored Mar 1, 2019
2 parents 42e8ee5 + 365a0ce commit 0f8bb83
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
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

0 comments on commit 0f8bb83

Please sign in to comment.