From 3bcef442b8f1db1c59ad56d5a6b0967a77e471f2 Mon Sep 17 00:00:00 2001
From: Victor Chong <victor.chong@linaro.org>
Date: Mon, 7 Aug 2017 10:57:55 +0100
Subject: [PATCH] Move `define expand-env-var` to common.mk

Signed-off-by: Victor Chong <victor.chong@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 common.mk   | 7 +++++++
 hikey.mk    | 6 ------
 hikey960.mk | 6 ------
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/common.mk b/common.mk
index 43bc06b..fe5b740 100644
--- a/common.mk
+++ b/common.mk
@@ -117,6 +117,13 @@ endif
 define KERNEL_VERSION
 $(shell cd $(LINUX_PATH) && $(MAKE) --no-print-directory kernelversion)
 endef
+
+# Read stdin, expand ${VAR} environment variables, output to stdout
+# http://superuser.com/a/302847
+define expand-env-var
+awk '{while(match($$0,"[$$]{[^}]*}")) {var=substr($$0,RSTART+2,RLENGTH -3);gsub("[$$]{"var"}",ENVIRON[var])}}1'
+endef
+
 DEBUG ?= 0
 
 ################################################################################
diff --git a/hikey.mk b/hikey.mk
index 248915e..8ea81c1 100644
--- a/hikey.mk
+++ b/hikey.mk
@@ -243,12 +243,6 @@ strace-cleaner: strace-clean
 ################################################################################
 # Root FS
 ################################################################################
-# Read stdin, expand ${VAR} environment variables, output to stdout
-# http://superuser.com/a/302847
-define expand-env-var
-awk '{while(match($$0,"[$$]{[^}]*}")) {var=substr($$0,RSTART+2,RLENGTH -3);gsub("[$$]{"var"}",ENVIRON[var])}}1'
-endef
-
 .PHONY: filelist-tee
 filelist-tee: filelist-tee-common
 	env TOP=$(ROOT) $(expand-env-var) <$(PATCHES_PATH)/rootfs/initramfs-add-files.txt >> $(GEN_ROOTFS_FILELIST)
diff --git a/hikey960.mk b/hikey960.mk
index 2181ab6..abf9324 100644
--- a/hikey960.mk
+++ b/hikey960.mk
@@ -258,12 +258,6 @@ strace-cleaner: strace-clean
 ################################################################################
 # Root FS
 ################################################################################
-# Read stdin, expand ${VAR} environment variables, output to stdout
-# http://superuser.com/a/302847
-define expand-env-var
-awk '{while(match($$0,"[$$]{[^}]*}")) {var=substr($$0,RSTART+2,RLENGTH -3);gsub("[$$]{"var"}",ENVIRON[var])}}1'
-endef
-
 .PHONY: filelist-tee
 filelist-tee: filelist-tee-common
 	env TOP=$(ROOT) $(expand-env-var) <$(PATCHES_PATH)/rootfs/initramfs-add-files.txt >> $(GEN_ROOTFS_FILELIST)
-- 
GitLab