From 5ba7f167eae0415403e9eab787f62ca0f6e7c86a Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Mon, 21 Mar 2022 12:39:16 +0100
Subject: [PATCH] Allow for VAR_EXTENSIONS, not just T_A when specifying
 dependencies

---
 require-ess/tools/driver.makefile | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/require-ess/tools/driver.makefile b/require-ess/tools/driver.makefile
index 08c12c1a..b27ae8fa 100644
--- a/require-ess/tools/driver.makefile
+++ b/require-ess/tools/driver.makefile
@@ -424,6 +424,11 @@ ifeq ($(filter O.%,$(notdir ${CURDIR})),)
 # Target architecture defined.
 # Still in source directory, third run.
 
+# Add sources for specific epics types or architectures.
+ARCH_PARTS = ${T_A} $(subst -, ,${T_A}) ${OS_CLASS}
+VAR_EXTENSIONS = ${EPICSVERSION} ${ARCH_PARTS} ${ARCH_PARTS:%=${EPICSVERSION}_%}
+export VAR_EXTENSIONS
+
 # First, sort out all of the dependencies. This is done recursively using tools from https://github.com/markpiffer/gmtt.git
 space := $(strip) $(strip)#
 comma := ,#
@@ -452,7 +457,9 @@ define fetch_module_versions
   endif
 endef
 $(foreach m,$(patsubst %_DEP_VERSION,%,$(filter %_DEP_VERSION,$(.VARIABLES))),$(eval $(call fetch_module_versions,$m)))
-$(foreach m,$(patsubst %_DEP_VERSION_$(T_A),%,$(filter %_DEP_VERSION_$(T_A),$(.VARIABLES))),$(eval $(call fetch_module_versions,$m,_$(T_A))))
+$(foreach x,$(VAR_EXTENSIONS),\
+  $(foreach m,$(patsubst %_DEP_VERSION_$(x),%,$(filter %_DEP_VERSION_$(x),$(.VARIABLES))),$(eval $(call fetch_module_versions,$m,_$(x))))\
+)
 
 # Fetches the data from .dep files to be parsed by the above
 define fetch_deps
@@ -512,11 +519,6 @@ install build debug:: O.${EPICSVERSION}_${T_A}
 
 endif
 
-# Add sources for specific epics types or architectures.
-ARCH_PARTS = ${T_A} $(subst -, ,${T_A}) ${OS_CLASS}
-VAR_EXTENSIONS = ${EPICSVERSION} ${ARCH_PARTS} ${ARCH_PARTS:%=${EPICSVERSION}_%}
-export VAR_EXTENSIONS
-
 REQ += ${REQUIRED} $(foreach x, ${VAR_EXTENSIONS}, ${REQUIRED_$x})
 export REQ
 
-- 
GitLab