forked from cometbft/cometbft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.mk
53 lines (44 loc) · 1.3 KB
/
common.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# This contains Makefile logic that is common to several makefiles
BUILD_TAGS ?= cometbft
COMMIT_HASH := $(shell git rev-parse --short HEAD)
LD_FLAGS = -X github.com/cometbft/cometbft/version.CMTGitCommitHash=$(COMMIT_HASH)
BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
# allow users to pass additional flags via the conventional LDFLAGS variable
LD_FLAGS += $(LDFLAGS)
# handle nostrip
ifeq (nostrip,$(findstring nostrip,$(COMETBFT_BUILD_OPTIONS)))
#prepare for delve
BUILD_FLAGS+= -gcflags "all=-N -l"
else
BUILD_FLAGS += -trimpath
LD_FLAGS += -s -w
endif
# handle race
ifeq (race,$(findstring race,$(COMETBFT_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_FLAGS += -race
endif
# handle clock_skew
ifeq (clock_skew,$(findstring clock_skew,$(COMETBFT_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_TAGS += clock_skew
endif
# handle badgerdb
ifeq (badgerdb,$(findstring badgerdb,$(COMETBFT_BUILD_OPTIONS)))
BUILD_TAGS += badgerdb
endif
# handle rocksdb
ifeq (rocksdb,$(findstring rocksdb,$(COMETBFT_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_TAGS += rocksdb
endif
# handle bls12381
ifeq (bls12381,$(findstring bls12381,$(COMETBFT_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_TAGS += bls12381
endif
# handle nodebug
ifeq (nodebug,$(findstring nodebug,$(COMETBFT_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_TAGS += nodebug
endif