Skip to content

Commit

Permalink
Makefiles: avoid repeated shell evaluations
Browse files Browse the repository at this point in the history
Change the recursively evaluated variables to simply evaluated
variables.

More details at e.g. http://electric-cloud.com/blog/2009/03/makefile-performance-shell/
  • Loading branch information
justinsb committed Jun 3, 2018
1 parent dc88750 commit af8f1ff
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion boskos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CLUSTER ?= prow
NAMESPACE ?= test-pods
HUB ?= gcr.io/k8s-testimages

TAG = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

boskos:
go build k8s.io/test-infra/boskos/
Expand Down
2 changes: 1 addition & 1 deletion gubernator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
VERSION := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
PROJECT ?= k8s-gubernator

# TODO(fejta): convert these to bazel rules
Expand Down
2 changes: 1 addition & 1 deletion images/bazelbuild/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

IMG = gcr.io/k8s-testimages/bazelbuild
TAG = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

# TODO(bentheelder): retire some of these as they become unnecessary
LATEST_BAZEL_VERSION=0.10.0
Expand Down
2 changes: 1 addition & 1 deletion images/bigquery/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
VERSION := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

image:
docker build -t "gcr.io/k8s-testimages/bigquery:$(VERSION)" .
Expand Down
2 changes: 1 addition & 1 deletion images/bootstrap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

IMG = gcr.io/k8s-testimages/bootstrap
TAG = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

all: build

Expand Down
2 changes: 1 addition & 1 deletion images/gcloud/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
VERSION := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

IMG="gcr.io/k8s-testimages/gcloud-in-go"

Expand Down
2 changes: 1 addition & 1 deletion images/kube-deploy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
VERSION := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

IMG="gcr.io/k8s-testimages/kube-deploy"

Expand Down
2 changes: 1 addition & 1 deletion images/kubeadm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
VERSION := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

IMG = "gcr.io/k8s-testimages/e2e-kubeadm"

Expand Down
2 changes: 1 addition & 1 deletion images/kubekins-e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

IMG = gcr.io/k8s-testimages/kubekins-e2e
TAG = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

# kubernetes master branch config
K8S ?= master
Expand Down
2 changes: 1 addition & 1 deletion images/kubekins-test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

IMG = gcr.io/k8s-testimages/kubekins-test
TAG = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
VERSIONS := $(wildcard ./Dockerfile-*)

do_build = \
Expand Down
2 changes: 1 addition & 1 deletion images/kubemci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
VERSION := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

IMG = "gcr.io/k8s-testimages/e2e-kubemci"

Expand Down
2 changes: 1 addition & 1 deletion kettle/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

IMG = gcr.io/k8s-testimages/kettle
TAG = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

# These are the usual GKE variables.
PROJECT ?= k8s-gubernator
Expand Down
4 changes: 2 additions & 2 deletions mungegithub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ KUBECONFIG ?= $(HOME)/.kube/config
TARGET ?= kubernetes

TOKEN ?= "./token"
token64=$(shell base64 $(TOKEN))
token64:=$(shell base64 $(TOKEN))

HOOKSECRET ?= "./hook-secret"
hooksecret64=$(shell base64 $(HOOKSECRET))
hooksecret64:=$(shell base64 $(HOOKSECRET))

READONLY ?= true

Expand Down
6 changes: 3 additions & 3 deletions mungegithub/path.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TARGET=$(shell basename $(shell pwd))
APP=$(shell basename $(shell dirname $(shell dirname $(shell pwd))))
TARGET:=$(shell basename $(shell pwd))
APP:=$(shell basename $(shell dirname $(shell dirname $(shell pwd))))
READONLY ?= false

include ../../../Makefile
include ../../../Makefile
4 changes: 2 additions & 2 deletions prow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ALPINE_VERSION ?= 0.1
GIT_VERSION ?= 0.2

# YYYYmmdd-commitish
TAG = $(shell date -u +v%Y%m%d)-$(shell git describe --tags --always --dirty)
TAG := $(shell date -u +v%Y%m%d)-$(shell git describe --tags --always --dirty)
# HOOK_VERSION is the version of the hook image
HOOK_VERSION ?= $(TAG)
# SINKER_VERSION is the version of the sinker image
Expand Down Expand Up @@ -63,7 +63,7 @@ CLUSTER ?= prow
REGISTRY ?= gcr.io
PUSH ?= docker push

DOCKER_LABELS=--label io.k8s.prow.git-describe="$(shell git describe --tags --always --dirty)"
DOCKER_LABELS:=--label io.k8s.prow.git-describe="$(shell git describe --tags --always --dirty)"

update-config: get-cluster-credentials
kubectl create configmap config --from-file=config=config.yaml --dry-run -o yaml | kubectl replace configmap config -f -
Expand Down
2 changes: 1 addition & 1 deletion queue_health/common.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Please set IMG
TAG = $(shell date +v%Y%m%d)
TAG := $(shell date +v%Y%m%d)

all: push

Expand Down
2 changes: 1 addition & 1 deletion triage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

IMG = gcr.io/k8s-testimages/triage
TAG = $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

build:
docker build -t $(IMG):$(TAG) .
Expand Down

0 comments on commit af8f1ff

Please sign in to comment.