From 44fb88d3db6f38bd2d30b383ae2c6d102fefeeb8 Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Wed, 3 Mar 2021 10:53:22 +0100
Subject: [PATCH] First draft of base/require version in cellpath

---
 configure/modules/CONFIG_CELL     |  2 +-
 configure/modules/RULES_CELL      | 15 +++++++++------
 require-ess/tools/iocsh_functions |  5 +++--
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/configure/modules/CONFIG_CELL b/configure/modules/CONFIG_CELL
index 2cdcbf1c..710312ea 100644
--- a/configure/modules/CONFIG_CELL
+++ b/configure/modules/CONFIG_CELL
@@ -12,6 +12,6 @@ E3_CELL_PATH=$(TOP)/cellMods
 ## 
 -include $(TOP)/../CONFIG_CELL.local
 -include $(TOP)/configure/CONFIG_CELL.local
-E3_MODULES_PATH=$(E3_CELL_PATH)
+E3_MODULES_PATH=$(E3_CELL_PATH)/$(notdir $(EPICS_BASE))/require-$(E3_REQUIRE_VERSION)
 
 endif
diff --git a/configure/modules/RULES_CELL b/configure/modules/RULES_CELL
index 02f2e20f..38c61f37 100644
--- a/configure/modules/RULES_CELL
+++ b/configure/modules/RULES_CELL
@@ -1,21 +1,24 @@
-.PHONY: fix_permissions cellinstall celluninstall
 
+.PHONY: cellbuild
+## Builds the module while also searching in $(E3_CELL_PATH) for dependencies
+cellbuild: build
+
+.PHONY: cellinstall
 ## Installs the module in a local directory $(E3_CELL_PATH)
-cellinstall: install_module versions fix_permissions
+cellinstall: install_module fix_permissions
 
+.PHONY: celluninstall
 ## Remove the module from the local directory $(E3_CELL_PATH)
 celluninstall: conf
 	$(QUIET) $(E3_MODULE_MAKE_CMDS) uninstall
 
+.PHONY: cellvars
 ## Print relevant environment variables for the local install
 cellvars: vars
 
 ifneq (,$(findstring cell,$(MAKECMDGOALS)))
 
-versions:
-	@echo EPICS_BASE: $(EPICS_BASE)                  > $(E3_CELL_PATH)/$(E3_MODULE_NAME)/$(E3_MODULE_VERSION)/EPICS_VERSION
-	@echo E3_REQUIRE_VERSION: $(E3_REQUIRE_VERSION) >> $(E3_CELL_PATH)/$(E3_MODULE_NAME)/$(E3_MODULE_VERSION)/EPICS_VERSION
-
+.PHONY: fix_permissions
 # cellinstall should install as read/write, but install does everything by default read-only
 fix_permissions:
 	@echo "Updating permissions on cellMods directory $(E3_CELL_PATH)/$(E3_MODULE_NAME)"
diff --git a/require-ess/tools/iocsh_functions b/require-ess/tools/iocsh_functions
index 5d1b0cc2..1c1ce73e 100644
--- a/require-ess/tools/iocsh_functions
+++ b/require-ess/tools/iocsh_functions
@@ -402,8 +402,9 @@ function loadFiles() {
             ;;
         -l)
             shift
-            printf "epicsEnvSet EPICS_DRIVER_PATH %s:${EPICS_DRIVER_PATH}\n" $1
-            EPICS_DRIVER_PATH="$1:$EPICS_DRIVER_PATH"
+            add_path="$1/$(basename "${EPICS_BASE}")/require-${E3_REQUIRE_VERSION}"
+            printf "epicsEnvSet EPICS_DRIVER_PATH %s:${EPICS_DRIVER_PATH}\n" "$add_path"
+            EPICS_DRIVER_PATH="$add_path:$EPICS_DRIVER_PATH"
             ;;
         -dg)
             shift
-- 
GitLab