@@ -2,10 +2,6 @@ APP_DIR := ./app
22
33GOBIN ?= $(shell go env GOPATH) /bin
44
5- KIND_APP_IP ?= $(shell make -sC _run/kube kind-k8s-ip)
6- KIND_APP_PORT ?= $(shell make -sC _run/kube app-http-port)
7- KIND_VARS ?= KUBE_INGRESS_IP="$(KIND_APP_IP ) " KUBE_INGRESS_PORT="$(KIND_APP_PORT ) "
8-
95include make/init.mk
106
117.DEFAULT_GOAL := bins
@@ -22,46 +18,56 @@ GIT_HEAD_ABBREV := $(shell git rev-parse --abbrev-ref HEAD)
2218
2319IS_PREREL := $(shell $(ROOT_DIR ) /script/is_prerelease.sh "$(RELEASE_TAG ) " && echo "true" || echo "false")
2420IS_MAINNET := $(shell $(ROOT_DIR ) /script/mainnet-from-tag.sh "$(RELEASE_TAG ) " && echo "true" || echo "false")
25- IS_STABLE ?= false
2621
27- GO_LINKMODE ?= external
2822GOMOD ?= readonly
29- BUILD_TAGS ?= osusergo,netgo,ledger
23+ BUILD_OPTIONS ?= static-link
24+ BUILD_TAGS := osusergo netgo ledger muslc gcc
25+ DB_BACKEND := goleveldb
26+ BUILD_FLAGS :=
27+
3028GORELEASER_STRIP_FLAGS ?=
3129
32- ifeq ($(IS_MAINNET ) , true)
33- ifeq ($(IS_PREREL), false)
34- IS_STABLE := true
35- endif
30+ ifeq (cleveldb,$(findstring cleveldb,$(BUILD_OPTIONS ) ) )
31+ DB_BACKEND=cleveldb
32+ else ifeq (rocksdb,$(findstring rocksdb,$(BUILD_OPTIONS)))
33+ DB_BACKEND=rocksdb
34+ else ifeq (goleveldb,$(findstring goleveldb,$(BUILD_OPTIONS)))
35+ DB_BACKEND=goleveldb
3636endif
3737
3838ifneq (,$(findstring cgotrace,$(BUILD_OPTIONS ) ) )
39- BUILD_TAGS := $(BUILD_TAGS), cgotrace
39+ BUILD_TAGS += cgotrace
4040endif
4141
42- GORELEASER_BUILD_VARS := \
43- -X github.com/cosmos/cosmos-sdk/version.Name=akash \
44- -X github.com/cosmos/cosmos-sdk/version.AppName=akash \
45- -X github.com/cosmos/cosmos-sdk/version.BuildTags=\"$(BUILD_TAGS ) \" \
46- -X github.com/cosmos/cosmos-sdk/version.Version=$(RELEASE_TAG ) \
47- -X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG )
42+ build_tags := $(strip $(BUILD_TAGS ) )
43+ build_tags_cs := $(subst $(WHITESPACE ) ,$(COMMA ) ,$(build_tags ) )
4844
49- ldflags = -linkmode= $( GO_LINKMODE ) -X github.com/cosmos/cosmos-sdk/version.Name=akash \
45+ ldflags := -X github.com/cosmos/cosmos-sdk/version.Name=akash \
5046-X github.com/cosmos/cosmos-sdk/version.AppName=akash \
51- -X github.com/cosmos/cosmos-sdk/version.BuildTags="$(BUILD_TAGS ) " \
47+ -X github.com/cosmos/cosmos-sdk/version.BuildTags="$(build_tags_cs ) " \
5248-X github.com/cosmos/cosmos-sdk/version.Version=$(shell git describe --tags | sed 's/^v//') \
53- -X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG )
49+ -X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG ) \
50+ -X github.com/cosmos/cosmos-sdk/types.DBBackend=$(DB_BACKEND )
51+
52+ GORELEASER_LDFLAGS := $(ldflags )
53+
54+ ifeq (,$(findstring static-link,$(BUILD_OPTIONS ) ) )
55+ ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
56+ endif
5457
5558# check for nostrip option
5659ifeq (,$(findstring nostrip,$(BUILD_OPTIONS ) ) )
57- ldflags += -s -w
58- GORELEASER_STRIP_FLAGS += -s -w
60+ ldflags += -s -w
61+ BUILD_FLAGS += -trimpath
5962endif
6063
6164ldflags += $(LDFLAGS )
6265ldflags := $(strip $(ldflags ) )
6366
64- BUILD_FLAGS := -mod=$(GOMOD ) -tags='$(BUILD_TAGS ) ' -ldflags '$(ldflags ) '
67+ GORELEASER_TAGS := $(BUILD_TAGS )
68+ GORELEASER_FLAGS := $(BUILD_FLAGS ) -mod=$(GOMOD ) -tags='$(build_tags ) '
69+
70+ BUILD_FLAGS += -mod=$(GOMOD ) -tags='$(build_tags_cs ) ' -ldflags '$(ldflags ) '
6571
6672.PHONY : all
6773all : build bins
0 commit comments