Skip to content

Commit

Permalink
Introduce GOAMD64 variable with default=v2 for AMD64 arch. (#12371)
Browse files Browse the repository at this point in the history
See #11715
  • Loading branch information
lystopad authored Oct 18, 2024
1 parent c6bf9aa commit 4c47c59
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GO ?= go # if using docker, should not need to be installed/linked
GOAMD64_VERSION ?= v2 # See https://go.dev/wiki/MinimumRequirements#microarchitecture-support
GOBINREL = build/bin
GOBIN = $(CURDIR)/$(GOBINREL)
UNAME = $(shell uname) # Supported: Darwin, Linux
Expand Down Expand Up @@ -32,6 +33,10 @@ ifeq ($(shell uname -m), aarch64)
CGO_CFLAGS += -D__BLST_PORTABLE__
endif

# Configure GOAMD64 env.variable for AMD64 architecture:
ifeq ($(shell uname -m),x86_64)
CPU_ARCH= GOAMD64=${GOAMD64_VERSION}
endif

CGO_CFLAGS += -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-prototypes -Wno-unused-but-set-variable -O3

Expand All @@ -58,9 +63,9 @@ PACKAGE = github.com/erigontech/erigon
GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false
GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}"

GOBUILD = CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS)
GO_DBG_BUILD = CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build -tags $(BUILD_TAGS),debug -gcflags=all="-N -l" # see delve docs
GOTEST = CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 GOTRACEBACK=1 $(GO) test $(GO_FLAGS) ./... -p 2
GOBUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS)
GO_DBG_BUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build -tags $(BUILD_TAGS),debug -gcflags=all="-N -l" # see delve docs
GOTEST = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 GOTRACEBACK=1 $(GO) test $(GO_FLAGS) ./... -p 2

default: all

Expand Down

0 comments on commit 4c47c59

Please sign in to comment.