Skip to content

Commit 0486312

Browse files
authored
Makefile: avoid ?= shell executions (#1328)
Signed-off-by: Joe Lanford <[email protected]>
1 parent da4828d commit 0486312

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Makefile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ e2e: ginkgo
113113
.PHONY: release
114114
export OPM_IMAGE_REPO ?= quay.io/operator-framework/opm
115115
export IMAGE_TAG ?= $(OPM_VERSION)
116-
export MAJ_MIN_IMAGE_OR_EMPTY ?= $(call tagged-or-empty,$(shell echo $(OPM_VERSION) | grep -Eo 'v[0-9]+\.[0-9]+'))
117-
export MAJ_IMAGE_OR_EMPTY ?= $(call tagged-or-empty,$(shell echo $(OPM_VERSION) | grep -Eo 'v[0-9]+'))
116+
export MAJ_MIN_IMAGE_OR_EMPTY := $(call tagged-or-empty,$(shell echo $(OPM_VERSION) | grep -Eo 'v[0-9]+\.[0-9]+'))
117+
export MAJ_IMAGE_OR_EMPTY := $(call tagged-or-empty,$(shell echo $(OPM_VERSION) | grep -Eo 'v[0-9]+'))
118118
# LATEST_TAG is the latest semver tag in HEAD. Used to deduce whether
119119
# OPM_VERSION is the new latest tag, or a prior minor/patch tag, below.
120120
# NOTE: this can only be relied upon if full git history is present.
@@ -124,11 +124,12 @@ LATEST_TAG := $(shell git tag -l | tr - \~ | sort -V | tr \~ - | tail -n1)
124124
# is not a prerelase tag and == LATEST_TAG, otherwise the empty string.
125125
# An empty string causes goreleaser to skip building the manifest image for latest,
126126
# which we do not want when cutting a non-latest release (old minor/patch tag).
127-
export LATEST_IMAGE_OR_EMPTY ?= $(shell \
127+
export LATEST_IMAGE_OR_EMPTY := $(shell \
128128
echo $(OPM_VERSION) | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$$' \
129129
&& [ "$(shell echo -e "$(OPM_VERSION)\n$(LATEST_TAG)" | sort -rV | head -n1)" == "$(OPM_VERSION)" ] \
130130
&& echo "$(OPM_IMAGE_REPO):latest" || echo "")
131-
release: RELEASE_ARGS ?= release --rm-dist --snapshot -f release/goreleaser.$(shell go env GOOS).yaml
131+
RELEASE_GOOS := $(shell go env GOOS)
132+
release: RELEASE_ARGS ?= release --rm-dist --snapshot -f release/goreleaser.$(RELEASE_GOOS).yaml
132133
release: goreleaser
133134
$(GORELEASER) $(RELEASE_ARGS)
134135

@@ -147,22 +148,22 @@ endef
147148
# Hack / Tools #
148149
################
149150

150-
GO_INSTALL_OPTS ?= "-mod=mod"
151+
GO_INSTALL_OPTS := "-mod=mod"
151152

152153
## Location to install dependencies to
153-
LOCALBIN ?= $(shell pwd)/bin
154+
LOCALBIN := $(shell pwd)/bin
154155
$(LOCALBIN):
155156
mkdir -p $(LOCALBIN)
156157

157158
## Tool Binaries
158-
GORELEASER ?= $(LOCALBIN)/goreleaser
159-
GINKGO ?= $(LOCALBIN)/ginkgo
160-
PROTOC_VERSION ?= $(LOCALBIN)/protoc-gen-go-grpc
159+
GORELEASER := $(LOCALBIN)/goreleaser
160+
GINKGO := $(LOCALBIN)/ginkgo
161+
PROTOC_VERSION := $(LOCALBIN)/protoc-gen-go-grpc
161162

162163
## Tool Versions
163-
GORELEASER_VERSION ?= v1.8.3
164-
GINKGO_VERSION ?= v2.1.3
165-
PROTOC_VERSION ?= v1.3.0
164+
GORELEASER_VERSION := v1.8.3
165+
GINKGO_VERSION := v2.1.3
166+
PROTOC_VERSION := v1.3.0
166167

167168
.PHONY: goreleaser
168169
goreleaser: $(GORELEASER) ## Download goreleaser locally if necessary.

0 commit comments

Comments
 (0)