Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: Fix errors when specifying RACE #11631

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -41,7 +41,7 @@ COVERPKG ?= $(COVERPKG_EVAL)
GOTEST_BASE := -test.v -timeout 360s
GOTEST_UNIT_BASE := $(GOTEST_BASE) -check.vv
GOTEST_PRIV_OPTS := $(GOTEST_UNIT_BASE) -tags=privileged_tests
GOTEST_COVER_OPTS := -coverprofile=coverage.out -covermode=count -coverpkg $(COVERPKG)
GOTEST_COVER_OPTS += -coverprofile=coverage.out -coverpkg $(COVERPKG)
BENCH_EVAL := "."
BENCH ?= $(BENCH_EVAL)
BENCHFLAGS_EVAL := -bench=$(BENCH) -run=^$ -benchtime=10s
Expand Down
15 changes: 11 additions & 4 deletions Makefile.defs
Expand Up @@ -44,10 +44,14 @@ GO ?= go
# go build/test/clean flags
# these are declared here so they are treated explicitly
# as non-immediate variables
GO_BUILD_FLAGS =
GO_TEST_FLAGS =
GO_CLEAN_FLAGS =
GO_BUILD_LDFLAGS =
GO_BUILD_FLAGS =
GO_TEST_FLAGS =
GO_CLEAN_FLAGS =
GO_BUILD_LDFLAGS =

# This is declared here as it is needed to change the covermode depending on if
# RACE is specified.
GOTEST_COVER_OPTS =

VERSION = $(shell cat $(dir $(lastword $(MAKEFILE_LIST)))/VERSION)
VERSION_MAJOR = $(shell cat $(dir $(lastword $(MAKEFILE_LIST)))/VERSION | cut -d. -f1)
Expand Down Expand Up @@ -109,6 +113,9 @@ endif
ifneq ($(RACE),)
GO_BUILD_FLAGS += -race
GO_TEST_FLAGS += -race
GOTEST_COVER_OPTS += -covermode=atomic
else
GOTEST_COVER_OPTS += -covermode=count
endif

ifneq ($(LOCKDEBUG),)
Expand Down
4 changes: 4 additions & 0 deletions tools/maptool/Makefile
Expand Up @@ -11,7 +11,11 @@ all: $(TARGET)

$(TARGET):
@$(ECHO_GO)
ifneq ($(RACE),"")
$(QUIET)$(GO_BUILD_WITH_CGO) -o $@
else
$(QUIET)$(GO_BUILD) -o $@
endif

clean:
@$(ECHO_CLEAN)
Expand Down