Skip to content

Commit

Permalink
Updated makefile with static build support
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Aug 8, 2023
1 parent d733409 commit 52b2a86
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@ VERSION := $(shell git describe --tags | sed 's/^v//' | rev | cut -d - -f 2- | r
COMMIT := $(shell git log -1 --format='%H')
TENDERMINT_VERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's/.* //')

BUILD_TAGS := $(strip netgo,ledger)
LD_FLAGS := -s -w \
-X github.com/cosmos/cosmos-sdk/version.Name=sentinel \
comma := ,
whitespace := $() $()

build_tags := $(strip netgo ledger)
ld_flags := -s -w \
-X github.com/cosmos/cosmos-sdk/version.Name=sentinel \
-X github.com/cosmos/cosmos-sdk/version.AppName=sentinelhub \
-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=${BUILD_TAGS} \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TENDERMINT_VERSION)

ifeq ($(STATIC),true)
build_tags += muslc
ld_flags += -linkmode=external -extldflags '-Wl,-z,muldefs -static'
endif

BUILD_TAGS = $(subst $(whitespace),$(comma),$(build_tags))
LD_FLAGS = ${ld_flags} -X github.com/cosmos/cosmos-sdk/version.BuildTags=${BUILD_TAGS}

.PHONY: benchmark
benchmark:
@go test -mod=readonly -v -bench ./...
Expand Down

0 comments on commit 52b2a86

Please sign in to comment.