From 1ebabb60a2c009ed04dcbf068c93299a15d277ab Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Tue, 19 Nov 2024 13:38:44 +0100
Subject: [PATCH] E3-1731: Don't install the makefile at the next level

The original e3 build installed the module.Makefile in the module
source directory, and then runs (essentially)
```
$ make -C module -f module.Makefile ARGS
```
However, there is no real need for it to copy it there instead of
simply using that makefile from the parent directory. This simplifies
a bit of the junk that gets added around during the build process.
---
 configure/E3/CONFIG_E3_MAKEFILE |  2 +-
 configure/E3/RULES_E3           | 22 ++++++++++------------
 require.Makefile                |  2 +-
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/configure/E3/CONFIG_E3_MAKEFILE b/configure/E3/CONFIG_E3_MAKEFILE
index 7eaa0fca..09cc56d1 100644
--- a/configure/E3/CONFIG_E3_MAKEFILE
+++ b/configure/E3/CONFIG_E3_MAKEFILE
@@ -2,7 +2,7 @@
 #
 
 E3_REQUIRE_MAKEFILE_INPUT_OPTIONS := -C $(E3_MODULE_SRC_PATH)
-E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += -f $(E3_MODULE_MAKEFILE)
+E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += -f ../$(E3_MODULE_MAKEFILE)
 E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += LIBVERSION="$(E3_MODULE_VERSION)"
 E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += PROJECT="$(E3_MODULE_NAME)"
 E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += EPICS_MODULES="$(E3_MODULES_PATH)"
diff --git a/configure/E3/RULES_E3 b/configure/E3/RULES_E3
index ccb4b365..0623e36c 100644
--- a/configure/E3/RULES_E3
+++ b/configure/E3/RULES_E3
@@ -3,10 +3,13 @@
 
 .DEFAULT_GOAL := help
 
-.PHONY: help default install uninstall build rebuild clean conf all prebuild
+.PHONY: help default install uninstall build rebuild clean all prebuild
 
 default: help
 
+# Include some checks before build happens
+include $(E3_REQUIRE_CONFIG)/RULES_CHECKS
+
 # # help is defined in
 # # https://gist.github.com/rcmachado/af3db315e31383502660
 help:
@@ -53,40 +56,35 @@ install: $(MODULE_METADATA_FILE)
 check_uninstall:
 
 ## Uninstall the current module
-uninstall: check_uninstall conf
+uninstall: check_uninstall
 	$(QUIET) $(E3_MODULE_MAKE_CMDS) uninstall
 
 ## Build current module
-build: conf checkout prebuild db_internal
+build: consistency_checks checkout prebuild db_internal
 	$(QUIET) $(E3_MODULE_MAKE_CMDS) build
 
 ## Run module-specific commands before building
-prebuild: conf
+prebuild: consistency_checks
 	$(QUIET) $(E3_MODULE_MAKE_CMDS) prebuild
 
 ## Displays information about the build process
-debug: conf
+debug:
 	$(QUIET) $(E3_MODULE_MAKE_CMDS) debug
 
 .PHONY: db_internal
-db_internal: conf
+db_internal: consistency_checks
 	$(QUIET) $(E3_MODULE_MAKE_CMDS) db_internal
 
 ## Clean, build, and install the current module
 rebuild: clean build install
 
 ## Deletes temporary build files
-clean: conf
+clean:
 	$(QUIET) $(E3_MODULE_MAKE_CMDS) clean
 
 ## Initializes, patches, builds, and installs
 all: init patch rebuild
 
-# Copy $(E3_MODULE_MAKEFILE) into $(E3_MODULE_SRC_PATH)
-include $(E3_REQUIRE_CONFIG)/RULES_CHECKS
-conf: consistency_checks
-	$(QUIET) install -p -m 644 $(TOP)/$(E3_MODULE_MAKEFILE)  $(E3_MODULE_SRC_PATH)/
-
 .PHONY: init git-submodule-sync $(E3_MODULE_SRC_PATH) checkout
 
 ifeq (,$(strip $(EPICS_MODULE_TAG)))
diff --git a/require.Makefile b/require.Makefile
index 6a942cf1..e9d80f99 100644
--- a/require.Makefile
+++ b/require.Makefile
@@ -27,7 +27,7 @@ where_am_I := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
 # It is easy to maintain RULES_E3 if we use the "repository" makefile
 # instead of the installed makefile.
 #
-include $(where_am_I)/tools/driver.makefile
+include $(where_am_I)/require-ess/tools/driver.makefile
 
 BUILDCLASSES += Linux
 
-- 
GitLab