From aee080f621d79462d72209f02581cb857668bfb6 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 6 Jul 2017 16:33:08 +0100 Subject: [PATCH] pkg: Reduce the number of times variables containing `$(shell...)` are invoked. For DIRTY and RELEASED this means simply performing a static assignment with `:=`. For HASH it is a little more complex since it is (and we want/need it to be) a conditional assigment. However it is only used for defining TAG, so make that a static assignment. This reduces the number of times the complex DIRTY shell command in particular is evaluated. Signed-off-by: Ian Campbell --- pkg/package.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/package.mk b/pkg/package.mk index d55c8fee9..79af74f06 100644 --- a/pkg/package.mk +++ b/pkg/package.mk @@ -7,16 +7,16 @@ HASH_COMMIT?=HEAD # Setting this is only really useful with the show-tag target HASH?=$(shell git ls-tree --full-tree $(HASH_COMMIT) -- $(CURDIR) | awk '{print $$3}') ifneq ($(HASH_COMMIT),HEAD) # Others can't be dirty by definition -DIRTY=$(shell git update-index -q --refresh && git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty") +DIRTY:=$(shell git update-index -q --refresh && git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty") endif endif -TAG=$(ORG)/$(IMAGE):$(HASH)$(DIRTY) +TAG:=$(ORG)/$(IMAGE):$(HASH)$(DIRTY) BASE_DEPS=Dockerfile Makefile # Get a release tag, if present -RELEASE=$(shell git tag -l --points-at HEAD) +RELEASE:=$(shell git tag -l --points-at HEAD) ifdef NETWORK NET_OPT=