diff --git a/require-ess/tools/driver.makefile b/require-ess/tools/driver.makefile
index 52869ac455cb3554036cdf234b86eb37688d500e..d9c499d6c226e04fe874094dd6cf890125fcead3 100644
--- a/require-ess/tools/driver.makefile
+++ b/require-ess/tools/driver.makefile
@@ -146,6 +146,23 @@ define FETCH_BUILD_NUMBER
 $(shell $(MAKEHOME)/build_number.sh $(1) $(2) $($(2)_VERSION))
 endef
 
+# Functions used for recursive dependency fetching. These are modified from https://github.com/markpiffer/gmtt.git
+space := $(strip) $(strip)#
+comma := ,#
+list2param = $(subst $(space),$(comma),$(strip $1))
+exec = $(eval -exec=$1)$(eval -exec:=$$(call -exec,$(call list2param,$2)))$(-exec)
+while = $(if $(call exec,$1),$(eval $2)$(call while,$1,$2,$3),$(eval $3))
+
+# This simply assures that we fetch all of the rest of the table when we run $(wordlist n,$(max_int_size),$(table_data))
+max_int_size := 2147483647
+
+# Used to select from table-like data; syntax is SELECT what FROM where WHEN condition. This has been tailored to parse .dep files.
+select = $(strip $(call -select,$(strip $2),$1,$3))
+-select = $(if $1,$(if $(call exec,$3,$(call list2param,$(wordlist 1,2,$1))), $(word $2,$1))$(call -select,$(wordlist 3,$(max_int_size),$1),$2,$3))
+
+str-eq = $(if $(subst x$1,,x$2),,t)
+# End of functions from https://github.com/markpiffer/gmtt.git
+
 ifndef EPICSVERSION
 ## RUN 1
 # In source directory
@@ -429,22 +446,6 @@ 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 := ,#
-list2param = $(subst $(space),$(comma),$(strip $1))
-exec = $(eval -exec=$1)$(eval -exec:=$$(call -exec,$(call list2param,$2)))$(-exec)
-while = $(if $(call exec,$1),$(eval $2)$(call while,$1,$2,$3),$(eval $3))
-
-# This simply assures that we fetch all of the rest of the table when we run $(wordlist n,$(max_int_size),$(table_data))
-max_int_size := 2147483647
-
-# Used to select from table-like data; syntax is SELECT what FROM where WHEN condition. This has been tailored to parse .dep files.
-select = $(strip $(call -select,$(strip $2),$1,$3))
--select = $(if $1,$(if $(call exec,$3,$(call list2param,$(wordlist 1,2,$1))), $(word $2,$1))$(call -select,$(wordlist 3,$(max_int_size),$1),$2,$3))
-
-str-eq = $(if $(subst x$1,,x$2),,t)
-
 MODULES :=
 PROCESSED_MODULES :=
 REQ :=