From 4040c3425fc68c2b370db6d6527510b8cf9e9c69 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Fri, 13 May 2022 18:48:39 +0800 Subject: [PATCH] fix build flags for debugging --- Makefile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 4a1ee042..f344e753 100755 --- a/Makefile +++ b/Makefile @@ -88,23 +88,22 @@ ifeq (boltdb,$(findstring boltdb,$(COSMOS_BUILD_OPTIONS))) ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=boltdb endif +BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)' + +# Check for debug option +ifeq (debug,$(findstring debug,$(COSMOS_BUILD_OPTIONS))) + BUILD_FLAGS += -gcflags 'all=-N -l' + COSMOS_BUILD_OPTIONS += nostrip +endif + +# check for nostrip option ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS))) + BUILD_FLAGS += -trimpath ldflags += -w -s endif ldflags += $(LDFLAGS) ldflags := $(strip $(ldflags)) -BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)' -# check for nostrip option -ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS))) - BUILD_FLAGS += -trimpath -endif - -# Check for debug option -ifeq (debug,$(findstring debug,$(COSMOS_BUILD_OPTIONS))) - BUILD_FLAGS += -gcflags "all=-N -l" -endif - all: tools build lint test # # The below include contains the tools and runsim targets. # include contrib/devtools/Makefile