mirror of
https://github.com/containers/podman.git
synced 2025-05-20 00:27:03 +08:00
Merge pull request #26015 from markjdb/main
Makefile: move some Go-related variable definitions up
This commit is contained in:
18
Makefile
18
Makefile
@ -25,6 +25,15 @@ SHELL := $(shell command -v bash;)
|
|||||||
GO ?= go
|
GO ?= go
|
||||||
GO_LDFLAGS:= $(shell if $(GO) version|grep -q gccgo ; then echo "-gccgoflags"; else echo "-ldflags"; fi)
|
GO_LDFLAGS:= $(shell if $(GO) version|grep -q gccgo ; then echo "-gccgoflags"; else echo "-ldflags"; fi)
|
||||||
GOCMD = CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO)
|
GOCMD = CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO)
|
||||||
|
# Podman does not work w/o CGO_ENABLED, except in some very specific cases.
|
||||||
|
# Windows and Mac (both podman-remote client only) require CGO_ENABLED=0.
|
||||||
|
CGO_ENABLED ?= 1
|
||||||
|
# Default to the native OS type and architecture unless otherwise specified
|
||||||
|
NATIVE_GOOS := $(shell env -u GOOS $(GO) env GOOS)
|
||||||
|
GOOS ?= $(call err_if_empty,NATIVE_GOOS)
|
||||||
|
# Default to the native architecture type
|
||||||
|
NATIVE_GOARCH := $(shell env -u GOARCH $(GO) env GOARCH)
|
||||||
|
GOARCH ?= $(NATIVE_GOARCH)
|
||||||
COVERAGE_PATH ?= .coverage
|
COVERAGE_PATH ?= .coverage
|
||||||
DESTDIR ?=
|
DESTDIR ?=
|
||||||
EPOCH_TEST_COMMIT ?= $(shell git merge-base $${DEST_BRANCH:-main} HEAD)
|
EPOCH_TEST_COMMIT ?= $(shell git merge-base $${DEST_BRANCH:-main} HEAD)
|
||||||
@ -179,15 +188,6 @@ CROSS_BUILD_TARGETS := \
|
|||||||
# Dereference variable $(1), return value if non-empty, otherwise raise an error.
|
# Dereference variable $(1), return value if non-empty, otherwise raise an error.
|
||||||
err_if_empty = $(if $(strip $($(1))),$(strip $($(1))),$(error Required variable $(1) value is undefined, whitespace, or empty))
|
err_if_empty = $(if $(strip $($(1))),$(strip $($(1))),$(error Required variable $(1) value is undefined, whitespace, or empty))
|
||||||
|
|
||||||
# Podman does not work w/o CGO_ENABLED, except in some very specific cases.
|
|
||||||
# Windows and Mac (both podman-remote client only) require CGO_ENABLED=0.
|
|
||||||
CGO_ENABLED ?= 1
|
|
||||||
# Default to the native OS type and architecture unless otherwise specified
|
|
||||||
NATIVE_GOOS := $(shell env -u GOOS $(GO) env GOOS)
|
|
||||||
GOOS ?= $(call err_if_empty,NATIVE_GOOS)
|
|
||||||
# Default to the native architecture type
|
|
||||||
NATIVE_GOARCH := $(shell env -u GOARCH $(GO) env GOARCH)
|
|
||||||
GOARCH ?= $(NATIVE_GOARCH)
|
|
||||||
ifeq ($(call err_if_empty,GOOS),windows)
|
ifeq ($(call err_if_empty,GOOS),windows)
|
||||||
BINSFX := .exe
|
BINSFX := .exe
|
||||||
SRCBINDIR := bin/windows
|
SRCBINDIR := bin/windows
|
||||||
|
Reference in New Issue
Block a user