mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-24 15:52:22 +02:00
Makefile: add GOCC variable
This commit is contained in:
parent
5fe900d18d
commit
ad021a290d
21
Makefile
21
Makefile
@ -3,6 +3,7 @@ ESCPKG := github.com\/lightningnetwork\/lnd
|
|||||||
MOBILE_PKG := $(PKG)/mobile
|
MOBILE_PKG := $(PKG)/mobile
|
||||||
TOOLS_DIR := tools
|
TOOLS_DIR := tools
|
||||||
|
|
||||||
|
GOCC ?= go
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
BTCD_PKG := github.com/btcsuite/btcd
|
BTCD_PKG := github.com/btcsuite/btcd
|
||||||
@ -24,7 +25,7 @@ ANDROID_BUILD := $(ANDROID_BUILD_DIR)/Lndmobile.aar
|
|||||||
COMMIT := $(shell git describe --tags --dirty)
|
COMMIT := $(shell git describe --tags --dirty)
|
||||||
|
|
||||||
# Determine the minor version of the active Go installation.
|
# Determine the minor version of the active Go installation.
|
||||||
ACTIVE_GO_VERSION := $(shell go version | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
|
ACTIVE_GO_VERSION := $(shell $(GOCC) version | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
|
||||||
ACTIVE_GO_VERSION_MINOR := $(shell echo $(ACTIVE_GO_VERSION) | cut -d. -f2)
|
ACTIVE_GO_VERSION_MINOR := $(shell echo $(ACTIVE_GO_VERSION) | cut -d. -f2)
|
||||||
|
|
||||||
LOOPVARFIX :=
|
LOOPVARFIX :=
|
||||||
@ -37,9 +38,9 @@ endif
|
|||||||
# versions are checked against this version.
|
# versions are checked against this version.
|
||||||
GO_VERSION = 1.23.6
|
GO_VERSION = 1.23.6
|
||||||
|
|
||||||
GOBUILD := $(LOOPVARFIX) go build -v
|
GOBUILD := $(LOOPVARFIX) $(GOCC) build -v
|
||||||
GOINSTALL := $(LOOPVARFIX) go install -v
|
GOINSTALL := $(LOOPVARFIX) $(GOCC) install -v
|
||||||
GOTEST := $(LOOPVARFIX) go test
|
GOTEST := $(LOOPVARFIX) $(GOCC) test
|
||||||
|
|
||||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go" -not -name "*.pb.json.go")
|
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go" -not -name "*.pb.json.go")
|
||||||
|
|
||||||
@ -73,8 +74,8 @@ endif
|
|||||||
|
|
||||||
DOCKER_TOOLS = docker run \
|
DOCKER_TOOLS = docker run \
|
||||||
--rm \
|
--rm \
|
||||||
-v $(shell bash -c "go env GOCACHE || (mkdir -p /tmp/go-cache; echo /tmp/go-cache)"):/tmp/build/.cache \
|
-v $(shell bash -c "$(GOCC) env GOCACHE || (mkdir -p /tmp/go-cache; echo /tmp/go-cache)"):/tmp/build/.cache \
|
||||||
-v $(shell bash -c "go env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \
|
-v $(shell bash -c "$(GOCC) env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \
|
||||||
-v $(shell bash -c "mkdir -p /tmp/go-lint-cache; echo /tmp/go-lint-cache"):/root/.cache/golangci-lint \
|
-v $(shell bash -c "mkdir -p /tmp/go-lint-cache; echo /tmp/go-lint-cache"):/root/.cache/golangci-lint \
|
||||||
-v $$(pwd):/build lnd-tools
|
-v $$(pwd):/build lnd-tools
|
||||||
|
|
||||||
@ -93,15 +94,15 @@ all: scratch check install
|
|||||||
# ============
|
# ============
|
||||||
$(GOACC_BIN):
|
$(GOACC_BIN):
|
||||||
@$(call print, "Installing go-acc.")
|
@$(call print, "Installing go-acc.")
|
||||||
cd $(TOOLS_DIR); go install -trimpath -tags=tools $(GOACC_PKG)
|
cd $(TOOLS_DIR); $(GOCC) install -trimpath -tags=tools $(GOACC_PKG)
|
||||||
|
|
||||||
$(BTCD_BIN):
|
$(BTCD_BIN):
|
||||||
@$(call print, "Installing btcd.")
|
@$(call print, "Installing btcd.")
|
||||||
cd $(TOOLS_DIR); go install -trimpath $(BTCD_PKG)
|
cd $(TOOLS_DIR); $(GOCC) install -trimpath $(BTCD_PKG)
|
||||||
|
|
||||||
$(GOIMPORTS_BIN):
|
$(GOIMPORTS_BIN):
|
||||||
@$(call print, "Installing goimports.")
|
@$(call print, "Installing goimports.")
|
||||||
cd $(TOOLS_DIR); go install -trimpath $(GOIMPORTS_PKG)
|
cd $(TOOLS_DIR); $(GOCC) install -trimpath $(GOIMPORTS_PKG)
|
||||||
|
|
||||||
# ============
|
# ============
|
||||||
# INSTALLATION
|
# INSTALLATION
|
||||||
@ -407,7 +408,7 @@ mobile-rpc:
|
|||||||
#? vendor: Create a vendor directory with all dependencies
|
#? vendor: Create a vendor directory with all dependencies
|
||||||
vendor:
|
vendor:
|
||||||
@$(call print, "Re-creating vendor directory.")
|
@$(call print, "Re-creating vendor directory.")
|
||||||
rm -r vendor/; go mod vendor
|
rm -r vendor/; $(GOCC) mod vendor
|
||||||
|
|
||||||
#? apple: Build mobile RPC stubs and project template for iOS and macOS
|
#? apple: Build mobile RPC stubs and project template for iOS and macOS
|
||||||
apple: mobile-rpc
|
apple: mobile-rpc
|
||||||
|
@ -6,8 +6,8 @@ DOCKER_RELEASE_HELPER = docker run \
|
|||||||
--rm \
|
--rm \
|
||||||
--user $(shell id -u):$(shell id -g) \
|
--user $(shell id -u):$(shell id -g) \
|
||||||
-v $(shell pwd):/tmp/build/lnd \
|
-v $(shell pwd):/tmp/build/lnd \
|
||||||
-v $(shell bash -c "go env GOCACHE || (mkdir -p /tmp/go-cache; echo /tmp/go-cache)"):/tmp/build/.cache \
|
-v $(shell bash -c "$(GOCC) env GOCACHE || (mkdir -p /tmp/go-cache; echo /tmp/go-cache)"):/tmp/build/.cache \
|
||||||
-v $(shell bash -c "go env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \
|
-v $(shell bash -c "$(GOCC) env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \
|
||||||
-e SKIP_VERSION_CHECK \
|
-e SKIP_VERSION_CHECK \
|
||||||
lnd-release-helper
|
lnd-release-helper
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ ITEST_FLAGS =
|
|||||||
ITEST_COVERAGE =
|
ITEST_COVERAGE =
|
||||||
COLLECT_ITEST_COVERAGE =
|
COLLECT_ITEST_COVERAGE =
|
||||||
EXEC_SUFFIX =
|
EXEC_SUFFIX =
|
||||||
COVER_PKG = $$(go list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v lnrpc)
|
COVER_PKG = $$($(GOCC) list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v lnrpc)
|
||||||
NUM_ITEST_TRANCHES = 4
|
NUM_ITEST_TRANCHES = 4
|
||||||
ITEST_PARALLELISM = $(NUM_ITEST_TRANCHES)
|
ITEST_PARALLELISM = $(NUM_ITEST_TRANCHES)
|
||||||
POSTGRES_START_DELAY = 5
|
POSTGRES_START_DELAY = 5
|
||||||
@ -88,7 +88,7 @@ endif
|
|||||||
# Enable integration test coverage (requires Go >= 1.20.0).
|
# Enable integration test coverage (requires Go >= 1.20.0).
|
||||||
ifneq ($(cover),)
|
ifneq ($(cover),)
|
||||||
ITEST_COVERAGE = -cover
|
ITEST_COVERAGE = -cover
|
||||||
COLLECT_ITEST_COVERAGE = go tool covdata textfmt -i=itest/cover -o coverage.txt
|
COLLECT_ITEST_COVERAGE = $(GOCC) tool covdata textfmt -i=itest/cover -o coverage.txt
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define the log tags that will be applied only when running unit tests. If none
|
# Define the log tags that will be applied only when running unit tests. If none
|
||||||
@ -115,8 +115,8 @@ ifneq ($(nocache),)
|
|||||||
TEST_FLAGS += -test.count=1
|
TEST_FLAGS += -test.count=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GOLIST := go list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
|
GOLIST := $(GOCC) list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
|
||||||
GOLISTCOVER := $(shell go list -tags="$(DEV_TAGS)" -deps -f '{{.ImportPath}}' ./... | grep '$(PKG)' | sed -e 's/^$(ESCPKG)/./')
|
GOLISTCOVER := $(shell $(GOCC) list -tags="$(DEV_TAGS)" -deps -f '{{.ImportPath}}' ./... | grep '$(PKG)' | sed -e 's/^$(ESCPKG)/./')
|
||||||
|
|
||||||
# UNIT_TARGTED is undefined iff a specific package and/or unit test case is
|
# UNIT_TARGTED is undefined iff a specific package and/or unit test case is
|
||||||
# not being targeted.
|
# not being targeted.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user