[apparmor] [PATCH v2 3/5] Makefile: Convert shell variables into reusable make variables

Tyler Hicks tyhicks at canonical.com
Thu Jan 7 02:44:45 UTC 2016


Turn REPO_VERSION and SNAPSHOT_DIR into target-specific make variables
that may be reused by future targets similar to the snapshot target.

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 variabel 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 <tyhicks at canonical.com>
---
 Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index b9ed3b3..b3f5130 100644
--- a/Makefile
+++ b/Makefile
@@ -44,12 +44,12 @@ tarball: clean
 	tar ${TAR_EXCLUSIONS} -cvzf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR}
 
 .PHONY: snapshot
+snapshot: REPO_VERSION:=$(shell $(value REPO_VERSION_CMD))
+snapshot: SNAPSHOT_NAME=apparmor-$(VERSION)~$(REPO_VERSION)
 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} ;
+	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
-- 
2.5.0




More information about the AppArmor mailing list