@@ -8,13 +8,80 @@ ifndef DCL_COMMIT
8
8
DCL_COMMIT := $(shell git log -1 --format='% H')
9
9
endif
10
10
11
+ NAME ?= dcl
12
+ APPNAME ?= $(NAME ) d
13
+ LEDGER_ENABLED ?= true
14
+
15
+ OUTPUT_DIR ?= build
16
+
17
+ # ## Process ld flags
18
+
11
19
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=DcLedger \
12
- -X github.com/cosmos/cosmos-sdk/version.App=dcld \
20
+ -X github.com/cosmos/cosmos-sdk/version.AppName= $( APPNAME ) \
13
21
-X github.com/cosmos/cosmos-sdk/version.Version=$(DCL_VERSION ) \
14
22
-X github.com/cosmos/cosmos-sdk/version.Commit=$(DCL_COMMIT )
15
23
16
- BUILD_FLAGS := -ldflags '$(ldflags ) '
17
- OUTPUT_DIR ?= build
24
+ # DB backend selection
25
+ ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS ) ) )
26
+ ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
27
+ endif
28
+
29
+
30
+ # ## Process build tags
31
+ build_tags = netgo
32
+ ifeq ($(LEDGER_ENABLED ) ,true)
33
+ ifeq ($(OS),Windows_NT)
34
+ GCCEXE = $(shell where gcc.exe 2> NUL)
35
+ ifeq ($(GCCEXE),)
36
+ $(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
37
+ else
38
+ build_tags += ledger
39
+ endif
40
+ else
41
+ UNAME_S = $(shell uname -s)
42
+ ifeq ($(UNAME_S),OpenBSD)
43
+ $(warning OpenBSD detected, disabling ledger support (https ://github.com/cosmos/cosmos-sdk/issues/1988))
44
+ else
45
+ GCC = $(shell command -v gcc 2> /dev/null)
46
+ ifeq ($(GCC),)
47
+ $(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
48
+ else
49
+ build_tags += ledger
50
+ endif
51
+ endif
52
+ endif
53
+ endif
54
+
55
+ ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS ) ) )
56
+ build_tags += gcc
57
+ endif
58
+
59
+ whitespace :=
60
+ whitespace += $(whitespace )
61
+ comma := ,
62
+ build_tags_comma_sep := $(subst $(whitespace ) ,$(comma ) ,$(build_tags ) )
63
+
64
+
65
+ ldflags += $(LDFLAGS )
66
+ ldflags := $(strip $(ldflags ) )
67
+
68
+ build_tags += $(BUILD_TAGS )
69
+ build_tags := $(strip $(build_tags ) )
70
+
71
+
72
+ # ## Resulting build flags
73
+ BUILD_FLAGS := -tags "$(build_tags ) " -ldflags '$(ldflags ) '
74
+
75
+ # Check for nostrip option
76
+ ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS ) ) )
77
+ BUILD_FLAGS += -trimpath
78
+ endif
79
+
80
+ # Check for debug option
81
+ ifeq (debug,$(findstring debug,$(COSMOS_BUILD_OPTIONS ) ) )
82
+ BUILD_FLAGS += -gcflags "all=-N -l"
83
+ endif
84
+
18
85
19
86
LICENSE_TYPE = "apache"
20
87
COPYRIGHT_YEAR = "2020"
0 commit comments