From 4c1b7fe0b46654131cafd3546eb14df82ba7e60d Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Wed, 27 Jan 2016 15:46:40 -0600 Subject: [PATCH] Makefile: Convert shell variables into reusable make variables Turn REPO_VERSION and SNAPSHOT_DIR into make variables that may be reused by future targets that specify the snapshot target as a prerequisite. This prevents us from having to repeatedly call out to potentially slow commands on bound bzr branches, such as the bzr version-info command stored in the REPO_VERSION_CMD make variable. The new REPO_VERSION make variable is turned into a "simply expanded" variable as to not require a callout to bzr each time it is expanded. The SNAPSHOT_DIR shell variable is renamed to SNAPSHOT_NAME as a make variable. The new name may be slightly more descriptive in the future as the variable will be reused in other ways besides a simple directory name. Signed-off-by: Tyler Hicks Acked-by: Steve Beattie --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b9ed3b3cb..24cc2d204 100644 --- a/Makefile +++ b/Makefile @@ -45,11 +45,11 @@ tarball: clean .PHONY: snapshot snapshot: clean - REPO_VERSION=`$(value REPO_VERSION_CMD)` ; \ - SNAPSHOT_DIR=apparmor-${VERSION}~$${REPO_VERSION} ;\ - make export_dir __EXPORT_DIR=$${SNAPSHOT_DIR} __REPO_VERSION=$${REPO_VERSION} ; \ - make setup __SETUP_DIR=$${SNAPSHOT_DIR} ; \ - tar ${TAR_EXCLUSIONS} -cvzf $${SNAPSHOT_DIR}.tar.gz $${SNAPSHOT_DIR} ; + $(eval REPO_VERSION:=$(shell $(value REPO_VERSION_CMD))) + $(eval SNAPSHOT_NAME=apparmor-$(VERSION)~$(REPO_VERSION)) + make export_dir __EXPORT_DIR=${SNAPSHOT_NAME} __REPO_VERSION=${REPO_VERSION} ; \ + make setup __SETUP_DIR=${SNAPSHOT_NAME} ; \ + tar ${TAR_EXCLUSIONS} -cvzf ${SNAPSHOT_NAME}.tar.gz ${SNAPSHOT_NAME} ; .PHONY: export_dir