From 25dd0fb691ee36833562403009e3a160c372cc58 Mon Sep 17 00:00:00 2001
From: Jeong Han Lee <jeonghan.lee@gmail.com>
Date: Fri, 13 Apr 2018 09:52:30 +0200
Subject: [PATCH] re-arrange all to match others modules, and add patch,
 introduce site paths

---
 configure/CONFIG                      |  36 +-
 configure/DEFINES_FT                  |  23 --
 configure/{ => E3}/CONFIG_E3_MAKEFILE |   1 -
 configure/E3/CONFIG_E3_PATH           |  16 +
 configure/{ => E3}/CONFIG_EPICS       |   0
 configure/E3/CONFIG_EXPORT            |  14 +
 configure/{ => E3}/CONFIG_REQUIRE     |   0
 configure/E3/CONFIG_SUDO              |  22 ++
 configure/E3/DEFINES_FT               |  43 +++
 configure/E3/RULES_DB                 |   9 +
 configure/{ => E3}/RULES_DEV          |   0
 configure/{ => E3}/RULES_E3           |  19 +-
 configure/{ => E3}/RULES_EPICS        |   0
 configure/{ => E3}/RULES_REQUIRE      |  10 +-
 configure/{ => E3}/RULES_VARS         |   0
 configure/RULES                       |  16 +-
 configure/RULES_DB                    |  22 --
 mk_test/require.mk                    |  24 --
 mk_test/require_0.mk                  |  61 ----
 mk_test/require_1.mk                  | 172 ----------
 mk_test/require_2.mk                  |  58 ----
 mk_test/require_2_1.mk                | 117 -------
 mk_test/require_2_2.mk                |  93 -----
 mk_test/require_2_3.mk                | 475 --------------------------
 patch/Site/HISTORY.md                 |   7 +
 patch/Site/README.md                  |  22 ++
 require.Makefile                      |   1 -
 tools/ess-env.conf                    |   2 +-
 tools/setE3Env.bash                   |   2 +-
 29 files changed, 161 insertions(+), 1104 deletions(-)
 delete mode 100644 configure/DEFINES_FT
 rename configure/{ => E3}/CONFIG_E3_MAKEFILE (99%)
 create mode 100644 configure/E3/CONFIG_E3_PATH
 rename configure/{ => E3}/CONFIG_EPICS (100%)
 create mode 100644 configure/E3/CONFIG_EXPORT
 rename configure/{ => E3}/CONFIG_REQUIRE (100%)
 create mode 100644 configure/E3/CONFIG_SUDO
 create mode 100644 configure/E3/DEFINES_FT
 create mode 100644 configure/E3/RULES_DB
 rename configure/{ => E3}/RULES_DEV (100%)
 rename configure/{ => E3}/RULES_E3 (94%)
 rename configure/{ => E3}/RULES_EPICS (100%)
 rename configure/{ => E3}/RULES_REQUIRE (79%)
 rename configure/{ => E3}/RULES_VARS (100%)
 delete mode 100644 configure/RULES_DB
 delete mode 100644 mk_test/require.mk
 delete mode 100644 mk_test/require_0.mk
 delete mode 100644 mk_test/require_1.mk
 delete mode 100644 mk_test/require_2.mk
 delete mode 100644 mk_test/require_2_1.mk
 delete mode 100644 mk_test/require_2_2.mk
 delete mode 100644 mk_test/require_2_3.mk
 create mode 100644 patch/Site/HISTORY.md
 create mode 100644 patch/Site/README.md

diff --git a/configure/CONFIG b/configure/CONFIG
index 4cb4ce46..d6928694 100644
--- a/configure/CONFIG
+++ b/configure/CONFIG
@@ -1,4 +1,3 @@
-
 VARS_EXCLUDES := $(.VARIABLES)
 
 ifneq (,$(findstring dev,$(MAKECMDGOALS)))
@@ -7,13 +6,9 @@ else
 include $(TOP)/configure/RELEASE
 endif
 
-
 # CONFIG=$(EPICS_BASE)/configure
 # include $(CONFIG)/CONFIG
 
-
-include $(TOP)/configure/CONFIG_EPICS
-
 # CONFIG_MODULE should be included before CONFIG_REQUIRE
 #
 ifneq (,$(findstring dev,$(MAKECMDGOALS)))
@@ -22,31 +17,12 @@ else
 include $(TOP)/configure/CONFIG_MODULE
 endif
 
-include $(TOP)/configure/CONFIG_REQUIRE
-
-include $(TOP)/configure/CONFIG_E3_MAKEFILE
-
-
-
-# IF EPICS_BASE is not WRITABLE, SUDO and SUDOBASH should be used 
-# SUDO_INFO 1 : SUDO is needed (NOT writable)
-# SUDO_INFO 0 : SUDO is not needed
-SUDO_INFO := $(shell test -w $(EPICS_BASE) 1>&2 2> /dev/null; echo $$?)
-
-ifeq "$(SUDO_INFO)" "1"
-SUDO := sudo
-SUDOBASH = $(SUDO)
-SUDOBASH += -E
-SUDOBASH += bash -c
-endif    
 
 
-# Valid for only Development Mode, because we clone/remove them
-# See RULES_DEV
-# E3_MODULE_SRC_PATH_INFO 1 : the directory is not there
-# E3_MODULE_SRC_PATH_INFO 0 : the directory is there
-E3_MODULE_SRC_PATH_INFO := $(shell test -d $(E3_MODULE_SRC_PATH) 1>&2 2> /dev/null; echo $$?)
+include $(TOP)/configure/E3/CONFIG_REQUIRE
+include $(TOP)/configure/E3/CONFIG_E3_PATH
+include $(TOP)/configure/E3/CONFIG_E3_MAKEFILE
+include $(TOP)/configure/E3/CONFIG_EPICS
+include $(TOP)/configure/E3/CONFIG_SUDO
+include $(TOP)/configure/E3/CONFIG_EXPORT
 
-ifeq "$(E3_MODULE_SRC_PATH_INFO)" "1"
-INIT_E3_MODULE_SRC = 1
-endif    
\ No newline at end of file
diff --git a/configure/DEFINES_FT b/configure/DEFINES_FT
deleted file mode 100644
index 47e10655..00000000
--- a/configure/DEFINES_FT
+++ /dev/null
@@ -1,23 +0,0 @@
-# Keep always the module up-to-date
-define git_update =
-git submodule deinit -f $@/
-sed -i '/submodule/,24465d'  $(TOP)/.git/config
-rm -rf $(TOP)/.git/modules/$@
-git submodule init $@/
-git submodule update --init --recursive $@/.
-git submodule update --remote --merge $@/
-endef
-
-ifndef VERBOSE
-  QUIET := @
-endif
-
-ifdef DEBUG_SHELL
-  SHELL = /bin/sh -x
-endif
-
-
-### Exclude the following variables to display 
-VARS_EXCLUDES+=git_update
-VARS_EXCLUDES+=QUIET
-VARS_EXCLUDES+=SHELL
diff --git a/configure/CONFIG_E3_MAKEFILE b/configure/E3/CONFIG_E3_MAKEFILE
similarity index 99%
rename from configure/CONFIG_E3_MAKEFILE
rename to configure/E3/CONFIG_E3_MAKEFILE
index c5e95448..872be376 100644
--- a/configure/CONFIG_E3_MAKEFILE
+++ b/configure/E3/CONFIG_E3_MAKEFILE
@@ -1,4 +1,3 @@
-
 # Pass necessary driver.makefile variables through makefile options
 #
 
diff --git a/configure/E3/CONFIG_E3_PATH b/configure/E3/CONFIG_E3_PATH
new file mode 100644
index 00000000..ba39b976
--- /dev/null
+++ b/configure/E3/CONFIG_E3_PATH
@@ -0,0 +1,16 @@
+E3_SITEMODS_PATH:=$(E3_REQUIRE_LOCATION)/siteMods
+E3_SITELIBS_PATH:=$(E3_REQUIRE_LOCATION)/siteLibs
+E3_SITEAPPS_PATH:=$(E3_REQUIRE_LOCATION)/siteApps
+
+
+
+INSTALLED_EPICS_BASE_ARCHS_PATHS=$(sort $(dir $(wildcard $(EPICS_BASE)/bin/*/)))
+TEMP_INSTALLED_EPICS_BASE_ARCHS=$(INSTALLED_EPICS_BASE_ARCHS_PATHS:$(EPICS_BASE)/bin/%=%)
+INSTALLED_EPICS_BASE_ARCHS=$(TEMP_INSTALLED_EPICS_BASE_ARCHS:/=)
+
+
+
+### Exclude the following variables to display 
+VARS_EXCLUDES+=TEMP_INSTALLED_EPICS_BASE_ARCHS
+VARS_EXCLUDES+=INSTALLED_EPICS_BASE_ARCHS_PATHS
+
diff --git a/configure/CONFIG_EPICS b/configure/E3/CONFIG_EPICS
similarity index 100%
rename from configure/CONFIG_EPICS
rename to configure/E3/CONFIG_EPICS
diff --git a/configure/E3/CONFIG_EXPORT b/configure/E3/CONFIG_EXPORT
new file mode 100644
index 00000000..e538bc17
--- /dev/null
+++ b/configure/E3/CONFIG_EXPORT
@@ -0,0 +1,14 @@
+# Variables should be transferred to module_name.makefile
+
+EPICS_HOST_ARCH:=$(shell $(EPICS_BASE)/startup/EpicsHostArch.pl)
+
+export EPICS_BASE
+export EPICS_HOST_ARCH
+export E3_REQUIRE_TOOLS
+export E3_MODULE_VERSION
+#export E3_SITEMODS_PATH
+#export E3_SITEAPPS_PATH
+#export E3_SITELIBS_PATH
+#export E3_SEQUENCER_NAME
+#export E3_SEQUENCER_VERSION
+
diff --git a/configure/CONFIG_REQUIRE b/configure/E3/CONFIG_REQUIRE
similarity index 100%
rename from configure/CONFIG_REQUIRE
rename to configure/E3/CONFIG_REQUIRE
diff --git a/configure/E3/CONFIG_SUDO b/configure/E3/CONFIG_SUDO
new file mode 100644
index 00000000..be9a1a3d
--- /dev/null
+++ b/configure/E3/CONFIG_SUDO
@@ -0,0 +1,22 @@
+# IF EPICS_BASE is not WRITABLE, SUDO and SUDOBASH should be used 
+# SUDO_INFO 1 : SUDO is needed (NOT writable)
+# SUDO_INFO 0 : SUDO is not needed
+SUDO_INFO := $(shell test -w $(EPICS_BASE) 1>&2 2> /dev/null; echo $$?)
+
+ifeq "$(SUDO_INFO)" "1"
+SUDO := sudo
+SUDOBASH = $(SUDO)
+SUDOBASH += -E
+SUDOBASH += bash -c
+endif    
+
+
+# Valid for only Development Mode, because we clone/remove them
+# See RULES_DEV
+# E3_MODULE_SRC_PATH_INFO 1 : the directory is not there
+# E3_MODULE_SRC_PATH_INFO 0 : the directory is there
+E3_MODULE_SRC_PATH_INFO := $(shell test -d $(E3_MODULE_SRC_PATH) 1>&2 2> /dev/null; echo $$?)
+
+ifeq "$(E3_MODULE_SRC_PATH_INFO)" "1"
+INIT_E3_MODULE_SRC = 1
+endif    
\ No newline at end of file
diff --git a/configure/E3/DEFINES_FT b/configure/E3/DEFINES_FT
new file mode 100644
index 00000000..0e4c2169
--- /dev/null
+++ b/configure/E3/DEFINES_FT
@@ -0,0 +1,43 @@
+# Keep always the module up-to-date
+define git_update =
+git submodule deinit -f $@/
+sed -i '/submodule/,24465d'  $(TOP)/.git/config
+rm -rf $(TOP)/.git/modules/$@
+git submodule init $@/
+git submodule update --init --recursive $@/.
+git submodule update --remote --merge $@/
+endef
+
+define patch_site
+for i in $(wildcard $(TOP)/patch/Site/*p0.patch); do\
+	printf "\nPatching %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \
+	patch -d $(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 < $$i;\
+done
+endef
+
+
+define patch_revert_site
+for i in $(wildcard $(TOP)/patch/Site/*p0.patch); do\
+	printf "\nPatching %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \
+	patch -R -d $(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 < $$i;\
+done
+
+endef
+
+
+
+ifndef VERBOSE
+  QUIET := @
+endif
+
+ifdef DEBUG_SHELL
+  SHELL = /bin/sh -x
+endif
+
+
+### Exclude the following variables to display 
+VARS_EXCLUDES+=git_update
+VARS_EXCLUDES+=patch_site
+VARS_EXCLUDES+=patch_revert_site
+VARS_EXCLUDES+=QUIET
+VARS_EXCLUDES+=SHELL
diff --git a/configure/E3/RULES_DB b/configure/E3/RULES_DB
new file mode 100644
index 00000000..c8249407
--- /dev/null
+++ b/configure/E3/RULES_DB
@@ -0,0 +1,9 @@
+# -*- mode: Makefile;-*-
+## This RULE should be used in case of inflating DB files
+## 
+
+.PHONY: db
+
+
+db: conf
+	$(QUIET) $(E3_MODULE_MAKE_CMDS) db
diff --git a/configure/RULES_DEV b/configure/E3/RULES_DEV
similarity index 100%
rename from configure/RULES_DEV
rename to configure/E3/RULES_DEV
diff --git a/configure/RULES_E3 b/configure/E3/RULES_E3
similarity index 94%
rename from configure/RULES_E3
rename to configure/E3/RULES_E3
index 20a90a84..e3dff1b0 100644
--- a/configure/RULES_E3
+++ b/configure/E3/RULES_E3
@@ -1,12 +1,8 @@
-
 .DEFAULT_GOAL := help
 
 .PHONY: help default install uninstall build rebuild clean conf
 
 
-default: help
-
-
 # # help is defined in 
 # # https://gist.github.com/rcmachado/af3db315e31383502660
 help:
@@ -27,16 +23,21 @@ help:
 
 
 
+default: help
+
+
 ## Install : $(E3_MODULE_NAME)
 install: uninstall requireconf
 	$(QUIET) $(SUDOBASH) '$(E3_MODULE_MAKE_CMDS) install'
 
+
+
+
 ## Uninstall : $(E3_MODULE_NAME)
 uninstall: conf
 	$(QUIET) $(SUDOBASH) '$(E3_MODULE_MAKE_CMDS) uninstall'
 
 
-
 ## Build the EPICS Module : $(E3_MODULE_NAME)
 # Build always the Module with the EPICS_MODULES_TAG
 build: conf checkout 
@@ -75,11 +76,3 @@ checkout:
 
 
 
-
-
-
-# .PHONY: help2
-
-# ## Show driver.makefile help
-# help2:
-#       $(QUIET) $(E3_MODULE_MAKE_CMD) help
diff --git a/configure/RULES_EPICS b/configure/E3/RULES_EPICS
similarity index 100%
rename from configure/RULES_EPICS
rename to configure/E3/RULES_EPICS
diff --git a/configure/RULES_REQUIRE b/configure/E3/RULES_REQUIRE
similarity index 79%
rename from configure/RULES_REQUIRE
rename to configure/E3/RULES_REQUIRE
index 24790570..91e6633c 100644
--- a/configure/RULES_REQUIRE
+++ b/configure/E3/RULES_REQUIRE
@@ -4,9 +4,9 @@
 IOCSH_HASH_VERSION:=$(shell git rev-parse --short HEAD)
 # If git rev-parse returns null, use the EPICS_MODULE_TAG
 IOCSH_HASH_VERSION?=$(EPICS_MODULE_TAG)
-.PHONY: requireconf
+.PHONY: requireconf e3-site-path
 
-requireconf:
+requireconf: e3-site-path
 
 	$(QUIET) $(SUDO) install -d -m 755 $(E3_REQUIRE_TOOLS)
 	$(QUIET) $(SUDO) install -d -m 755 $(E3_REQUIRE_BIN)
@@ -19,5 +19,9 @@ requireconf:
 	$(QUIET) $(SUDO) install    -m 644 $(TOP)/tools/setE3Env.bash    $(E3_REQUIRE_BIN)/
 
 
+# Create SITE PATH
 
-
+e3-site-path:
+	$(QUIET) $(SUDO) install -d -m 755 $(E3_SITELIBS_PATH)
+	$(QUIET) $(SUDO) install -d -m 755 $(E3_SITEMODS_PATH)
+	$(QUIET) $(SUDO) install -d -m 755 $(E3_SITEAPPS_PATH)
diff --git a/configure/RULES_VARS b/configure/E3/RULES_VARS
similarity index 100%
rename from configure/RULES_VARS
rename to configure/E3/RULES_VARS
diff --git a/configure/RULES b/configure/RULES
index 276cffed..62f8af03 100644
--- a/configure/RULES
+++ b/configure/RULES
@@ -1,18 +1,16 @@
 # -*- mode: Makefile;-*-
-
-# CONFIG
 # include $(EPICS_BASE)/configure/RULES
 
-include $(TOP)/configure/DEFINES_FT
+include $(TOP)/configure/E3/DEFINES_FT
+include $(TOP)/configure/E3/RULES_E3
+include $(TOP)/configure/E3/RULES_EPICS
 
-include $(TOP)/configure/RULES_REQUIRE
+include $(TOP)/configure/E3/RULES_REQUIRE
 
-include $(TOP)/configure/RULES_E3
-include $(TOP)/configure/RULES_EPICS
-include $(TOP)/configure/RULES_DB
-include $(TOP)/configure/RULES_VARS
+include $(TOP)/configure/E3/RULES_DB
+include $(TOP)/configure/E3/RULES_VARS
 
 
 ifneq (,$(findstring dev,$(MAKECMDGOALS)))
-include $(TOP)/configure/RULES_DEV
+include $(TOP)/configure/E3/RULES_DEV
 endif
diff --git a/configure/RULES_DB b/configure/RULES_DB
deleted file mode 100644
index 09261454..00000000
--- a/configure/RULES_DB
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- mode: Makefile;-*-
-## This RULE should be used in case of inflating DB files
-## 
-
-.PHONY: db
-
-### We have to think how to find $(EPICS_BASE) and
-### $(EPICS_HOST_ARCH) during driver.makefile
-### Friday, November  3 16:44:55 CET 2017, jhlee
-### Currently feasible solutoin without touching driver.makefile
-### is the following:
-###
-### 0) source setE3Env.bash 3.15.4
-### 1) make db
-### 2) make install
-### 3) source setE3Env.bash 3.15.5
-### 4) make db
-### 5) make install 
-###   ..... 
-
-db: conf
-	$(QUIET) $(E3_MODULE_MAKE_CMDS) db
diff --git a/mk_test/require.mk b/mk_test/require.mk
deleted file mode 100644
index 3bd0c120..00000000
--- a/mk_test/require.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# It is impossible to maintain this kind of makefile with no knowledge
-# on the entire history of the makefile development and on PSI envrionment.
-# So, I decide to split them into several pieces which I can look at how
-# they work and I would like to remove duplicate and unncessary lines for
-# ESS.
-#
-# In addition, I would like to remove GLOBAL variables which we can
-# define outside this makefile.
-
-# 
-include require_0.mk
-
-
-ifndef EPICSVERSION
-
-
-include require_1.mk
-
-else # EPICSVERSION
-
-include require_2.mk
-
-endif # EPICSVERSION defined
diff --git a/mk_test/require_0.mk b/mk_test/require_0.mk
deleted file mode 100644
index 732f6574..00000000
--- a/mk_test/require_0.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-
-# Get the location of this file.
-MAKEHOME:=$(dir $(lastword ${MAKEFILE_LIST}))
-# Get the name of the Makefile that included this file.
-USERMAKEFILE:=$(lastword $(filter-out $(lastword ${MAKEFILE_LIST}), ${MAKEFILE_LIST}))
-
-# Some configuration:
-DEFAULT_EPICS_VERSIONS = 3.13.9 3.13.10 3.14.8 3.14.12
-BUILDCLASSES = vxWorks
-EPICS_MODULES ?= /ioc/modules
-MODULE_LOCATION = ${EPICS_MODULES}/$(or ${PRJ},$(error PRJ not defined))/$(or ${LIBVERSION},$(error LIBVERSION not defined))
-EPICS_LOCATION = /usr/local/epics
-
-DOCUEXT = txt html htm doc pdf ps tex dvi gif jpg png
-DOCUEXT += TXT HTML HTM DOC PDF PS TEX DVI GIF JPG PNG
-DOCUEXT += template db dbt subs subst substitutions script
-
-# Override config here:
--include ${MAKEHOME}/config
-
-
-# Some shell commands:
-LN = ln -s
-EXISTS = test -e
-NM = nm
-RMDIR = rm -rf
-RM = rm -f
-CP = cp
-
-# Some generated file names:
-VERSIONFILE = ${PRJ}_version_${LIBVERSION}.c
-REGISTRYFILE = ${PRJ}_registerRecordDeviceDriver.cpp
-EXPORTFILE = ${PRJ}_exportAddress.c
-SUBFUNCFILE = ${PRJ}_subRecordFunctions.dbd
-DEPFILE = ${PRJ}.dep
-
-# Clear potential environment variables.
-TEMPLATES=
-SOURCES=
-DBDS=
-HEADERS=
-
-# Default target is "build" for all versions.
-# Don't install anything (different from default EPICS make rules).
-default: build
-
-IGNOREFILES = .cvsignore .gitignore
-%: ${IGNOREFILES}
-${IGNOREFILES}:
-	@echo -e "O.*\n.cvsignore\n.gitignore" > $@
-
-# Function that removes duplicates without re-ordering (unlike sort):
-define uniq
-  $(eval seen :=) \
-  $(foreach _,$1,$(if $(filter $_,${seen}),,$(eval seen += $_))) \
-  ${seen}
-endef
-
-
-
-
diff --git a/mk_test/require_1.mk b/mk_test/require_1.mk
deleted file mode 100644
index bf1e7e90..00000000
--- a/mk_test/require_1.mk
+++ /dev/null
@@ -1,172 +0,0 @@
-## RUN 1
-# In source directory
-
-# Find out which EPICS versions to build.
-INSTALLED_EPICS_VERSIONS := $(patsubst ${EPICS_LOCATION}/base-%,%,$(wildcard ${EPICS_LOCATION}/base-*[0-9]))
-EPICS_VERSIONS = $(filter-out ${EXCLUDE_VERSIONS:=%},${DEFAULT_EPICS_VERSIONS})
-MISSING_EPICS_VERSIONS = $(filter-out ${BUILD_EPICS_VERSIONS},${EPICS_VERSIONS})
-BUILD_EPICS_VERSIONS = $(filter ${INSTALLED_EPICS_VERSIONS},${EPICS_VERSIONS})
-$(foreach v,$(sort $(basename ${BUILD_EPICS_VERSIONS})),$(eval EPICS_VERSIONS_$v=$(filter $v.%,${BUILD_EPICS_VERSIONS})))
-
-# Check only version of files needed to build the module. But which are they?
-VERSIONCHECKFILES = $(filter-out /% -none-, $(wildcard *makefile* *Makefile* *.db *.template *.subs *.dbd *.cmd) ${SOURCES} ${DBDS} ${TEMPLATES} ${SCRIPTS} $(foreach v,3.13 3.14 3.15, ${SOURCES_$v} ${DBDS_$v}))
-VERSIONCHECKCMD = ${MAKEHOME}/getVersion.tcl ${VERSIONDEBUGFLAG} ${VERSIONCHECKFILES}
-LIBVERSION = $(or $(filter-out test,$(shell ${VERSIONCHECKCMD} 2>/dev/null)),${USER},test)
-VERSIONDEBUGFLAG = $(if ${VERSIONDEBUG}, -d)
-
-# Default module name is name of current directory.
-# But in case of "src" or "snl", use parent directory instead.
-# Avoid using environment variables for MODULE or PROJECT
-MODULE=
-PROJECT=
-PRJDIR:=$(subst -,_,$(subst .,_,$(notdir $(patsubst %Lib,%,$(patsubst %/snl,%,$(patsubst %/src,%,${PWD}))))))
-PRJ = $(strip $(or ${MODULE},${PROJECT},${PRJDIR}))
-export PRJ
-
-OS_CLASS_LIST = $(BUILDCLASSES)
-export OS_CLASS_LIST
-
-export ARCH_FILTER
-export EXCLUDE_ARCHS
-export MAKE_FIRST
-
-# Some shell commands:
-RMDIR = rm -rf
-LN = ln -s
-EXISTS = test -e
-NM = nm
-RM = rm -f
-MKDIR = mkdir -p -m 775
-
-clean::
-	$(RMDIR) O.*
-
-clean.%::
-	$(RMDIR) $(wildcard O.*${@:clean.%=%}*)
-
-uninstall:
-	$(RMDIR) ${MODULE_LOCATION}
-
-uninstall.%:
-	$(RMDIR) $(wildcard ${MODULE_LOCATION}/R*${@:uninstall.%=%}*)
-
-help:
-	@echo "usage:"
-	@for target in '' build '<EPICS version>' \
-	install 'install.<EPICS version>' \
-	uninstall 'uninstall.<EPICS version>' \
-        installui uninstallui \
-	clean help version; \
-	do echo "  make $$target"; \
-	done
-	@echo "Makefile variables:(defaults) [comment]"
-	@echo "  EPICS_VERSIONS   (${DEFAULT_EPICS_VERSIONS})"
-	@echo "  MODULE           (${PRJ}) [from current directory name]"
-	@echo "  PROJECT          [older name for MODULE]"
-	@echo "  SOURCES          (*.c *.cc *.cpp *.st *.stt *.gt)"
-	@echo "  DBDS             (*.dbd)"
-	@echo "  HEADERS          () [only those to install]"
-	@echo "  TEMPLATES        (*.template *.db *.subs) [db files]"
-	@echo "  SCRIPTS          (*.cmd) [startup and other scripts]"
-	@echo "  BINS             () [programs to install]"
-	@echo "  QT               (qt/*) [QT user interfaces to install]"
-	@echo "  EXCLUDE_VERSIONS () [versions not to build, e.g. 3.14]"
-	@echo "  EXCLUDE_ARCHS    () [target architectures not to build]"
-	@echo "  ARCH_FILTER      () [target architectures to build, e.g. SL6%]"
-	@echo "  BUILDCLASSES     (vxWorks) [other choices: Linux]"
-	@echo "  <module>_VERSION () [build against specific version of other module]"
-
-# "make version" shows the module version and why it is what it is.       
-version: ${IGNOREFILES}
-	@${VERSIONCHECKCMD}
-
-debug::
-	@echo "INSTALLED_EPICS_VERSIONS = ${INSTALLED_EPICS_VERSIONS}"
-	@echo "BUILD_EPICS_VERSIONS = ${BUILD_EPICS_VERSIONS}"
-	@echo "MISSING_EPICS_VERSIONS = ${MISSING_EPICS_VERSIONS}"
-	@echo "EPICS_VERSIONS_3.13 = ${EPICS_VERSIONS_3.13}"
-	@echo "EPICS_VERSIONS_3.14 = ${EPICS_VERSIONS_3.14}"
-	@echo "EPICS_VERSIONS_3.15 = ${EPICS_VERSIONS_3.15}"
-	@echo "BUILDCLASSES = ${BUILDCLASSES}"
-	@echo "LIBVERSION = ${LIBVERSION}"
-	@echo "VERSIONCHECKFILES = ${VERSIONCHECKFILES}"
-	@echo "ARCH_FILTER = ${ARCH_FILTER}"
-	@echo "PRJ = ${PRJ}"
-
-# Loop over all EPICS versions for second run.
-MAKEVERSION = ${MAKE} -f ${USERMAKEFILE} LIBVERSION=${LIBVERSION}
-
-build install debug:: ${IGNOREFILES}
-	for VERSION in ${BUILD_EPICS_VERSIONS}; do ${MAKEVERSION} EPICSVERSION=$$VERSION $@; done
-
-# Handle cases where user requests a group of EPICS versions:
-# make <action>.3.13 or make <action>.3.14 instead of make <action> or
-# make 3.13 or make 3.14 instead of make.
-
-
-
-#>>
-define VERSIONRULES
-$(1): ${IGNOREFILES}
-	for VERSION in $${EPICS_VERSIONS_$(1)}; do $${MAKEVERSION} EPICSVERSION=$$$$VERSION build; done
-
-%.$(1): ${IGNOREFILES}
-	for VERSION in $${EPICS_VERSIONS_$(1)}; do $${MAKEVERSION} EPICSVERSION=$$$$VERSION $${@:%.$(1)=%}; done
-endef
-#<<
-
-
-
-
-$(foreach v,$(sort $(basename ${INSTALLED_EPICS_VERSIONS})),$(eval $(call VERSIONRULES,$v)))
-
-# Handle cases where user requests one specific version:
-# make <action>.<version> instead of make <action> or
-# make <version> instead of make
-# EPICS version must be installed but need not be in EPICS_VERSIONS
-${INSTALLED_EPICS_VERSIONS}:
-	${MAKEVERSION} EPICSVERSION=$@ build
-
-${INSTALLED_EPICS_VERSIONS:%=build.%}:
-	${MAKEVERSION} EPICSVERSION=${@:build.%=%} build
-
-${INSTALLED_EPICS_VERSIONS:%=install.%}:
-	${MAKEVERSION} EPICSVERSION=${@:install.%=%} install
-
-${INSTALLED_EPICS_VERSIONS:%=debug.%}:
-	${MAKEVERSION} EPICSVERSION=${@:debug.%=%} debug
-
-
-# Install user interfaces to global location.
-# Keep a list of installed files in a hidden file for uninstall.
-
-
-
-
-#>>
-define INSTALL_UI_RULE
-INSTALL_$(1)=$(2)
-$(1)_FILES=$$(wildcard $$(or $${$(1)},$(3)))
-installui: install$(1)
-install$(1): uninstall$(1)
-	@$$(if $${$(1)_FILES},echo "Installing $(1) user interfaces";$$(MKDIR) $${INSTALL_$(1)})
-	@$$(if $${$(1)_FILES},$(CP) -v -t $${INSTALL_$(1)} $${$(1)_FILES:%='%'})
-	@$$(if $${$(1)_FILES},echo "$$(patsubst %,'%',$$(notdir $${$(1)_FILES}))" > $${INSTALL_$(1)}/.$${PRJ}-$$(LIBVERSION)-$(1).txt)
-
-uninstallui: uninstall$(1)
-uninstall$(1):
-	@echo "Removing old $(1) user interfaces"
-	@$$(RM) -v $$(addprefix $${INSTALL_$(1)}/,$$(sort $$(patsubst %,'%',$$(notdir $${$(1)_FILES})) $$(shell cat $${INSTALL_$(1)}/.$${PRJ}-*.txt 2>/dev/null)) .$${PRJ}-*-$(1).txt)
-endef
-#<<
-
-
-
-
-# You can add more UI rules following this pattern:
-#$(eval $(call INSTALL_UI_RULE,VARIABLE,installdir,sourcedefaultlocation))
-$(eval $(call INSTALL_UI_RULE,QT,${CONFIGBASE}/qt,qt/*))
-
-
-
-
diff --git a/mk_test/require_2.mk b/mk_test/require_2.mk
deleted file mode 100644
index 7411f908..00000000
--- a/mk_test/require_2.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-# EPICSVERSION defined 
-# Second or third run (see T_A branch below)
-
-EPICS_BASE=${EPICS_LOCATION}/base-${EPICSVERSION}
-
-
-
-${CONFIG}/CONFIG:
-	@echo "ERROR: EPICS release ${EPICSVERSION} not installed on this host."
-
-# Some TOP and EPICS_BASE tweeking necessary to work around release check in 3.14.10+.
-EB=${EPICS_BASE}
-
-TOP:=${EPICS_BASE}
-
--include ${CONFIG}/CONFIG
-
-EPICS_BASE:=${EB}
-SHRLIB_VERSION=
-COMMON_DIR = O.${EPICSVERSION}_Common
-# do not link *everything* with readline (and curses)
-COMMANDLINE_LIBRARY =
-# Relax (3.13) cross compilers (default is STRICT) to allow sloppier syntax.
-CMPLR=STD
-GCC_STD = $(GCC)
-CXXCMPLR=ANSI
-G++_ANSI = $(G++) -ansi
-OBJ=.o
-
-
-
-
-
-
-##########>> 
-ifndef T_A
-
-
-include require_2_1.mk
-
-
-##########>>
-else # T_A
-
-
-ifeq ($(filter O.%,$(notdir ${CURDIR})),)
-
-include require_2_2.mk
-
-else 
-
-include require_2_3.mk
-
-endif
-
-
-##########>>
-endif # T_A defined
diff --git a/mk_test/require_2_1.mk b/mk_test/require_2_1.mk
deleted file mode 100644
index 0d6cfe35..00000000
--- a/mk_test/require_2_1.mk
+++ /dev/null
@@ -1,117 +0,0 @@
-## RUN 2
-# Target achitecture not yet defined
-# but EPICSVERSION is already known.
-# Still in source directory.
-
-# Look for sources etc.
-# Select target architectures to build.
-# Export everything for third run:
-
-AUTOSRCS := $(filter-out ~%,$(wildcard *.c *.cc *.cpp *.st *.stt *.gt))
-SRCS = $(if ${SOURCES},$(filter-out -none-,${SOURCES}),${AUTOSRCS})
-#SRCS += ${SOURCES_${EPICS_BASETYPE}} # added later by VAR_EXTENSIONS
-#SRCS += ${SOURCES_${EPICSVERSION}}
-export SRCS
-
-DBD_SRCS = $(if ${DBDS},$(filter-out -none-,${DBDS}),$(wildcard menu*.dbd *Record.dbd) $(strip $(filter-out %Include.dbd dbCommon.dbd %Record.dbd,$(wildcard *.dbd)) ${BPTS}))
-DBD_SRCS += ${DBDS_${EPICS_BASETYPE}}
-DBD_SRCS += ${DBDS_${EPICSVERSION}}
-export DBD_SRCS
-
-#record dbd files given in DBDS
-RECORDS1 = $(patsubst %Record.dbd, %, $(filter-out dev%, $(filter %Record.dbd, $(notdir ${DBD_SRCS}))))
-#record dbd files included by files given in DBDS
-RECORDS2 = $(filter-out dev%, $(shell ${MAKEHOME}/expandDBD.tcl -r $(addprefix -I, $(sort $(dir ${DBD_SRCS}))) $(realpath ${DBDS})))
-RECORDS = $(sort ${RECORDS1} ${RECORDS2})
-export RECORDS
-
-MENUS = $(patsubst %.dbd,%.h,$(wildcard menu*.dbd))
-export MENUS
-
-BPTS = $(patsubst %.data,%.dbd,$(wildcard bpt*.data))
-export BPTS
-
-HDRS = ${HEADERS} $(addprefix ${COMMON_DIR}/,$(addsuffix Record.h,${RECORDS}))
-HDRS += ${HEADERS_${EPICS_BASETYPE}}
-HDRS += ${HEADERS_${EPICSVERSION}}
-export HDRS
-
-TEMPLS = $(if ${TEMPLATES},$(filter-out -none-,${TEMPLATES}),$(wildcard *.template *.db *.subs))
-TEMPLS += ${TEMPLATES_${EPICS_BASETYPE}}
-TEMPLS += ${TEMPLATES_${EPICSVERSION}}
-export TEMPLS
-
-SCR = $(if ${SCRIPTS},$(filter-out -none-,${SCRIPTS}),$(wildcard *.cmd))
-SCR += ${SCRIPTS_${EPICS_BASETYPE}}
-SCR += ${SCRIPTS_${EPICSVERSION}}
-export SCR
-
-DOCUDIR = .
-#DOCU = $(foreach DIR,${DOCUDIR},$(wildcard ${DIR}/*README*) $(foreach EXT,${DOCUEXT}, $(wildcard ${DIR}/*.${EXT})))
-export DOCU
-
-# Loop over all target architectures for third run.
-# Go to O.${T_A} subdirectory because RULES.Vx only work there:
-
-
-#>>>
-# Filter architectures to build using EXCLUDE_ARCHS and ARCH_FILTER.
-ifneq (${EPICS_BASETYPE},3.13)
-CROSS_COMPILER_TARGET_ARCHS := ${EPICS_HOST_ARCH} ${CROSS_COMPILER_TARGET_ARCHS}
-endif # !3.13
-#<<<
-
-
-CROSS_COMPILER_TARGET_ARCHS := $(filter-out $(addprefix %,${EXCLUDE_ARCHS}),$(filter-out $(addsuffix %,${EXCLUDE_ARCHS}),$(if ${ARCH_FILTER},$(filter ${ARCH_FILTER},${CROSS_COMPILER_TARGET_ARCHS}),${CROSS_COMPILER_TARGET_ARCHS})))
-
-
-
-#>>>
-define MAKELINKDIRS
-LINKDIRS+=O.${EPICSVERSION}_$1
-O.${EPICSVERSION}_$1:
-	$(LN) O.${EPICSVERSION}_$2 O.${EPICSVERSION}_$1
-endef
-#<<<
-
-
-
-$(foreach a,${CROSS_COMPILER_TARGET_ARCHS},$(foreach l,$(LINK_$a),$(eval $(call MAKELINKDIRS,$l,$a))))
-
-SRCS_Linux = ${SOURCES_Linux}
-SRCS_Linux += ${SOURCES_${EPICS_BASETYPE}_Linux}
-SRCS_Linux += ${SOURCES_Linux_${EPICS_BASETYPE}}
-export SRCS_Linux
-SRCS_vxWorks = ${SOURCES_vxWorks}
-SRCS_vxWorks += ${SOURCES_${EPICS_BASETYPE}_vxWorks}
-SRCS_vxWorks += ${SOURCES_vxWorks_${EPICS_BASETYPE}}
-export SRCS_vxWorks
-
-install build debug:: $(MAKE_FIRST)
-	@echo "MAKING EPICS VERSION R${EPICSVERSION}"
-
-uninstall::
-	$(RMDIR) ${INSTALL_REV}
-
-debug::
-	@echo "EPICS_BASE = ${EPICS_BASE}"
-	@echo "EPICSVERSION = ${EPICSVERSION}" 
-	@echo "EPICS_BASETYPE = ${EPICS_BASETYPE}" 
-	@echo "CROSS_COMPILER_TARGET_ARCHS = ${CROSS_COMPILER_TARGET_ARCHS}"
-	@echo "EXCLUDE_ARCHS = ${EXCLUDE_ARCHS}"
-	@echo "LIBVERSION = ${LIBVERSION}"
-
-install build::
-# Delete old build if INSTBASE has changed and module depends on other modules.
-	@for ARCH in ${CROSS_COMPILER_TARGET_ARCHS}; do \
-	    echo '$(realpath ${EPICS_MODULES})' | cmp -s O.${EPICSVERSION}_$$ARCH/INSTBASE || \
-	    ( grep -qs "^[^#]" O.${EPICSVERSION}_$$ARCH/*.dep && \
-	     (echo "rebuilding $$ARCH"; $(RMDIR) O.${EPICSVERSION}_$$ARCH) ) || true; \
-	done
-
-# Loop over all architectures.
-install build debug::
-	@for ARCH in ${CROSS_COMPILER_TARGET_ARCHS}; do \
-	    umask 002; ${MAKE} -f ${USERMAKEFILE} T_A=$$ARCH $@; \
-	done
-
diff --git a/mk_test/require_2_2.mk b/mk_test/require_2_2.mk
deleted file mode 100644
index 3536a06b..00000000
--- a/mk_test/require_2_2.mk
+++ /dev/null
@@ -1,93 +0,0 @@
-## RUN 3
-# Target architecture defined.
-# Still in source directory, third run.
-
-
-
-#------>#
-
-ifeq ($(filter ${OS_CLASS},${OS_CLASS_LIST}),)
-
-install% build%: build
-install build:
-	@echo Skipping ${T_A} because $(if ${OS_CLASS},OS_CLASS=\"${OS_CLASS}\" is not in BUILDCLASSES=\"${BUILDCLASSES}\",it is not available for R$(EPICSVERSION).)
-%:
-	@true
-
-
-
-#<----->#
-else ifeq ($(shell which $(firstword ${CC})),)
-
-install% build%: build
-install build:
-	@echo Warning: Skipping ${T_A} because cross compiler $(firstword ${CC}) is not installed.
-%:
-	@true
-
-#<----->#
-else
-
-
-
-
-O.%:
-	$(MKDIR) $@
-
-
-
-
-##----->##
-ifeq ($(shell echo "${LIBVERSION}" | grep -v -E "^[0-9]+\.[0-9]+\.[0-9]+\$$"),)
-install:: build
-	@test ! -d ${MODULE_LOCATION}/R${EPICSVERSION}/lib/${T_A} || \
-        (echo -e "Error: ${MODULE_LOCATION}/R${EPICSVERSION}/lib/${T_A} already exists.\nNote: If you really want to overwrite then uninstall first."; false)
-
-##<---->##
-else
-install:: build
-	@test ! -d ${MODULE_LOCATION}/R${EPICSVERSION}/lib/${T_A} || \
-        (echo -e "Warning: Re-installing ${MODULE_LOCATION}/R${EPICSVERSION}/lib/${T_A}"; \
-        $(RMDIR) ${MODULE_LOCATION}/R${EPICSVERSION}/lib/${T_A})
-
-##<-----##
-endif
-
-
-
-install build debug:: O.${EPICSVERSION}_Common O.${EPICSVERSION}_${T_A}
-	@${MAKE} -C O.${EPICSVERSION}_${T_A} -f ../${USERMAKEFILE} $@
-
-#<------#
-endif
-
-
-
-
-
-
-
-
-
-
-# Add sources for specific epics types (3.13 or 3.14) or architectures.
-ARCH_PARTS     = ${T_A} $(subst -, ,${T_A}) ${OS_CLASS}
-
-VAR_EXTENSIONS = ${EPICS_BASETYPE} ${EPICSVERSION} ${ARCH_PARTS} ${ARCH_PARTS:%=${EPICS_BASETYPE}_%} ${ARCH_PARTS:%=${EPICSVERSION}_%}
-
-REQ            = ${REQUIRED} $(foreach x, ${VAR_EXTENSIONS}, ${REQUIRED_$x})
-
-SRCS          += $(foreach x, ${VAR_EXTENSIONS}, ${SOURCES_$x})
-
-USR_LIBOBJS   += ${LIBOBJS} $(foreach x,${VAR_EXTENSIONS},${LIBOBJS_$x})
-
-BINS          += $(foreach x, ${VAR_EXTENSIONS}, ${BINS_$x})
-
-
-export VAR_EXTENSIONS
-export REQ
-export USR_LIBOBJS
-export BINS
-export CFG
-
-
diff --git a/mk_test/require_2_3.mk b/mk_test/require_2_3.mk
deleted file mode 100644
index ef058878..00000000
--- a/mk_test/require_2_3.mk
+++ /dev/null
@@ -1,475 +0,0 @@
-## RUN 4
-# In O.* directory.
-
-
-
-#>>>>
-define ADD_FOREIGN_INCLUDES
-$(eval $(1)_VERSION := $(patsubst ${EPICS_MODULES}/$(1)/%/R${EPICSVERSION}/include,%,$(firstword $(shell ls -dvr ${EPICS_MODULES}/$(1)/+([0-9]).+([0-9]).+([0-9])/R${EPICSVERSION}/include 2>/dev/null))))
-INSTALL_INCLUDES += $$(patsubst %,-I${EPICS_MODULES}/$(1)/%/R${EPICSVERSION}/include,$$($(1)_VERSION))
-endef
-#>>>>
-
-
-#>>>>
-# Manually required modules.
-define ADD_MANUAL_DEPENDENCIES
-$(eval $(1)_VERSION := $(or $(patsubst ${EPICS_MODULES}/$(1)/%/R${EPICSVERSION},%,$(firstword $(shell ls -dvr ${EPICS_MODULES}/$(1)/+([0-9]).+([0-9]).+([0-9])/R${EPICSVERSION} 2>/dev/null))),$(basename $(lastword $(subst -, ,$(basename $(realpath ${INSTBASE}/iocBoot/R${EPICSVERSION}/${T_A}/$(1).dep)))))))
-endef
-#>>>>
-
-
-
-
-# Add macros like USR_CFLAGS_vxWorks.
-EXTENDED_VARS=INCLUDES CFLAGS CXXFLAGS CPPFLAGS CODE_CXXFLAGS LDFLAGS
-$(foreach v,${EXTENDED_VARS},$(foreach x,${VAR_EXTENSIONS},$(eval $v+=$${$v_$x}) $(eval USR_$v+=$${USR_$v_$x})))
-
-
-
-
-CFLAGS += ${EXTRA_CFLAGS}
-
-COMMON_DIR_3.14 = ../O.${EPICSVERSION}_Common
-COMMON_DIR_3.13 = .
-COMMON_DIR = ${COMMON_DIR_${EPICS_BASETYPE}}
-
-# Remove include directory for this module from search path.
-# 3.13 and 3.14 use different variables
-INSTALL_INCLUDES =
-EPICS_INCLUDES =
-
-# Add include directory of foreign modules to include file search path.
-# Default is to use latest version of any module.
-# The user can overwrite the version by defining <module>_VERSION=<version>.
-# For each foreign module look for include/ for the EPICS base version in use.
-# The user can overwrite (or add) by defining <module>_INC=<relative/path> (not recommended!).
-# Only really existing directories are added to the search path.
-
-# The tricky part is to sort versions numerically. Make can't but ls -v can.
-# Only accept numerical versions (needs extended glob).
-
-
-
-$(eval $(foreach m,$(filter-out $(PRJ),$(notdir $(wildcard ${EPICS_MODULES}/*))),$(call ADD_FOREIGN_INCLUDES,$m)))
-
-$(eval $(foreach m,${REQ},$(call ADD_MANUAL_DEPENDENCIES,$m)))
-
-
-INSTALLRULE = install:
-
-BUILDRULE   = build:
-
-BASERULES   = ${EPICS_BASE}/configure/RULES
-
-
-
-INSTALL_REV     = ${MODULE_LOCATION}/R${EPICSVERSION}
-INSTALL_BIN     = ${INSTALL_REV}/bin/$(T_A)
-INSTALL_LIB     = ${INSTALL_REV}/lib/$(T_A)
-INSTALL_INCLUDE = ${INSTALL_REV}/include
-INSTALL_DBD     = ${INSTALL_REV}/dbd
-INSTALL_DB      = ${INSTALL_REV}/db
-INSTALL_CFG     = ${INSTALL_REV}/cfg
-INSTALL_DOC     = ${MODULE_LOCATION}/doc
-INSTALL_SCR     = ${INSTALL_REV}
-
-
-LIBRARY_OBJS = $(strip ${LIBOBJS} $(foreach l,${USR_LIBOBJS},$(addprefix ../,$(filter-out /%,$l))$(filter /%,$l)))
-
-MODULELIB    = $(if ${LIBRARY_OBJS},${LIB_PREFIX}${PRJ}${SHRLIB_SUFFIX},)
-
-
-# PROD_vxWorks=${MODULELIB}
-LIBOBJS         += $(addsuffix $(OBJ),$(notdir $(basename $(filter-out %.$(OBJ) %(LIB_SUFFIX),$(sort ${SRCS})))))
-LIBOBJS         += $(filter /%.$(OBJ) /%(LIB_SUFFIX),${SRCS})
-LIBOBJS         += ${LIBRARIES:%=${INSTALL_LIB}/%Lib}
-LIBS             = -L ${EPICS_BASE_LIB} ${BASELIBS:%=-l%}
-LINK.cpp        += ${LIBS}
-PRODUCT_OBJS     = ${LIBRARY_OBJS}
-
-
-# Linux
-LOADABLE_LIBRARY = $(if ${LIBRARY_OBJS},${PRJ},)
-
-# Handle registry stuff automagically if we have a dbd file.
-# See ${REGISTRYFILE} and ${EXPORTFILE} rules below.
-LIBOBJS         += $(if $(MODULEDBD), $(addsuffix $(OBJ),$(basename ${REGISTRYFILE} ${EXPORTFILE})))
-
-
-
-
-
-
-
-
-# For backward compatibility:
-# Provide a global symbol for every version with the same
-# major and equal or smaller minor version number.
-# Other code using this will look for one of those symbols.
-# Add an undefined symbol for the version of every used driver.
-# This is done with the #define in the used headers (see below).
-
-
-MAJOR_MINOR_PATCH=$(subst ., ,${LIBVERSION})
-MAJOR=$(word 1,${MAJOR_MINOR_PATCH})
-MINOR=$(word 2,${MAJOR_MINOR_PATCH})
-PATCH=$(word 3,${MAJOR_MINOR_PATCH})
-
-
-
-ifneq (${MINOR},)
-
-
-ALLMINORS     := $(shell for ((i=0;i<=${MINOR};i++));do echo $$i;done)
-PREREQUISITES = $(shell ${MAKEHOME}/getPrerequisites.tcl ${INSTALL_INCLUDE} | grep -vw ${PRJ})
-
-PROVIDES      = ${ALLMINORS:%=-Wl,--defsym,${PRJ}Lib_${MAJOR}.%=0}
-
-
-endif # MINOR
-
-
-
-
-
-LDFLAGS += ${PROVIDES} ${USR_LDFLAGS_${T_A}}
-
-# Create and include dependency files.
-# 3.14.8 uses HDEPENDS to select depends mode
-# 3.14.12 uses 'HDEPENDSCFLAGS -MMD' (does not catch #include <...>)
-# 3.15 uses 'HDEPENDS_COMPFLAGS = -MM -MF $@' (does not catch #include <...>)
-
-
-HDEPENDS = 
-HDEPENDS_METHOD = COMP
-HDEPENDS_COMPFLAGS = -c
-MKMF = DO_NOT_USE_MKMF
-CPPFLAGS += -MD
-
-
-
--include *.d
-
-# Need to find source dbd files relative to one dir up but generated dbd files in this dir.
-DBDFILES += ${DBD_SRCS:%=../%}
-DBD_PATH = $(sort $(dir ${DBDFILES}))
-
-DBDEXPANDPATH = $(addprefix -I , ${DBD_PATH} ${EPICS_BASE}/dbd)
-USR_DBDFLAGS += $(DBDEXPANDPATH)
-
-# Search all directories where sources or headers come from, plus existing os dependend subdirectories.
-SRC_INCLUDES = $(addprefix -I, $(wildcard $(foreach d,$(call uniq, $(filter-out /%,$(dir ${SRCS:%=../%} ${HDRS:%=../%}))), $d $(addprefix $d/, os/${OS_CLASS} $(POSIX_$(POSIX)) os/default))))
-
-# Different macro name for 3.14.8.
-GENERIC_SRC_INCLUDES = $(SRC_INCLUDES)
-
-
-
-
-# Create dbd file for snl code.
-DBDFILES += $(patsubst %.st,%_snl.dbd,$(notdir $(filter %.st,${SRCS})))
-DBDFILES += $(patsubst %.stt,%_snl.dbd,$(notdir $(filter %.stt,${SRCS})))
-
-# Create dbd file for GPIB code.
-DBDFILES += $(patsubst %.gt,%.dbd,$(notdir $(filter %.gt,${SRCS})))
-
-# Create dbd file with references to all subRecord functions.
-# Problem: functions may be commented out. Better preprocess, but then generate headers first.
-#define maksubfuncfile
-#/static/ {static=1} \
-#/\([\t ]*(struct)?[\t ]*(genSub|sub|aSub)Record[\t ]*\*[\t ]*\w+[\t ]*\)/ { \
-#    match ($$0,/(\w+)[\t ]*\([\t ]*(struct)?[\t ]*\w+Record[\t ]*\*[\t ]*\w+[\t ]*\)/, a); \
-#    n=a[1];if(!static && !f[n]){f[n]=1;print "function (" n ")"}} \
-#/[;{}]/ {static=0}
-#endef 
-#
-#$(shell awk '$(maksubfuncfile)' $(addprefix ../,$(filter %.c %.cc %.C %.cpp, $(SRCS))) > ${SUBFUNCFILE})
-#DBDFILES += $(if $(shell cat ${SUBFUNCFILE}),${SUBFUNCFILE})
-
-# snc location in 3.14: From latest version of module seq or fall back to globally installed snc.
-SNC=$(lastword $(dir ${EPICS_BASE})seq/bin/$(EPICS_HOST_ARCH)/snc $(shell ls -dv ${EPICS_MODULES}/seq/$(or $(seq_VERSION),+([0-9]).+([0-9]).+([0-9]))/R${EPICSVERSION}/bin/${EPICS_HOST_ARCH}/snc 2>/dev/null))
-
-
-
-
-
-
-
-ifneq ($(strip ${DBDFILES}),)
-MODULEDBD=${PRJ}.dbd
-endif
-
-
-
-# If we build a library, provide a version variable.
-ifneq ($(MODULELIB),)
-LIBOBJS += $(addsuffix $(OBJ),$(basename ${VERSIONFILE}))
-endif # MODULELIB
-
-
-
-
-
-debug::
-	@echo "BUILDCLASSES = ${BUILDCLASSES}"
-	@echo "OS_CLASS = ${OS_CLASS}"
-	@echo "T_A = ${T_A}"
-	@echo "MODULEDBD = ${MODULEDBD}"
-	@echo "RECORDS = ${RECORDS}"
-	@echo "MENUS = ${MENUS}"
-	@echo "BPTS = ${BPTS}"
-	@echo "HDRS = ${HDRS}"
-	@echo "SOURCES = ${SOURCES}" 
-	@echo "SOURCES_${EPICS_BASETYPE} = ${SOURCES_${EPICS_BASETYPE}}" 
-	@echo "SOURCES_${OS_CLASS} = ${SOURCES_${OS_CLASS}}" 
-	@echo "SRCS = ${SRCS}" 
-	@echo "LIBOBJS = ${LIBOBJS}"
-	@echo "DBDS = ${DBDS}"
-	@echo "DBDS_${EPICS_BASETYPE} = ${DBDS_${EPICS_BASETYPE}}"
-	@echo "DBDS_${OS_CLASS} = ${DBDS_${OS_CLASS}}"
-	@echo "DBD_SRCS = ${DBD_SRCS}"
-	@echo "DBDFILES = ${DBDFILES}"
-	@echo "TEMPLS = ${TEMPLS}"
-	@echo "LIBVERSION = ${LIBVERSION}"
-	@echo "MODULE_LOCATION = ${MODULE_LOCATION}"
-
-
-
-
-
-${BUILDRULE} MODULEINFOS
-${BUILDRULE} ${MODULEDBD}
-${BUILDRULE} $(addprefix ${COMMON_DIR}/,$(addsuffix Record.h,${RECORDS}))
-${BUILDRULE} ${DEPFILE}
-
-
-
-
-# Include default EPICS Makefiles (version dependent).
-# Avoid library installation when doing 'make build'.
-INSTALL_LOADABLE_SHRLIBS=
-# Avoid installing *.munch to bin directory.
-INSTALL_MUNCHS=
-include ${BASERULES}
-
-
-
-
-
-# Fix incompatible release rules.
-RELEASE_DBDFLAGS = -I ${EPICS_BASE}/dbd
-RELEASE_INCLUDES = -I${EPICS_BASE}/include
-
-
-# For EPICS 3.15:
-RELEASE_INCLUDES += -I${EPICS_BASE}/include/compiler/${CMPLR_CLASS}
-RELEASE_INCLUDES += -I${EPICS_BASE}/include/os/${OS_CLASS}
-# Dor EPICS 3.13:
-# EPICS_INCLUDES += -I$(EPICS_BASE_INCLUDE) -I$(EPICS_BASE_INCLUDE)/os/$(OS_CLASS)
-
-
-
-# Find all sources and set vpath accordingly.
-$(foreach file, ${SRCS} ${TEMPLS} ${SCR}, $(eval vpath $(notdir ${file}) ../$(dir ${file})))
-
-# Do not treat %.dbd the same way because it creates a circular dependency
-# if a source dbd has the same name as the project dbd. Have to clear %.dbd and not use ../ path.
-# But the %Record.h and menu%.h rules need to find their dbd files (example: asyn).
-
-
-vpath %.dbd
-vpath %Record.dbd ${DBD_PATH}
-vpath menu%.dbd ${DBD_PATH}
-
-# Find header files to install.
-vpath %.h $(addprefix ../,$(sort $(dir $(filter-out /%,${HDRS}) ${SRCS}))) $(sort $(dir $(filter /%,${HDRS})))
-
-PRODUCTS = ${MODULELIB} ${MODULEDBD} ${DEPFILE}
-
-
-
-MODULEINFOS:
-	@echo ${PRJ} > MODULENAME
-	@echo $(realpath ${EPICS_MODULES}) > INSTBASE
-	@echo ${PRODUCTS} > PRODUCTS
-	@echo ${LIBVERSION} > LIBVERSION
-
-# Build one module dbd file by expanding all source dbd files.
-# We can't use dbExpand (from the default EPICS make rules)
-# because it has too strict checks to be used for a loadable module.
-${MODULEDBD}: ${DBDFILES}
-	@echo "Expanding $@"
-	${MAKEHOME}expandDBD.tcl -$(basename ${EPICSVERSION}) ${DBDEXPANDPATH} $^ > $@
-
-
-
-
-# Install everything.
-INSTALL_LIBS = ${MODULELIB:%=${INSTALL_LIB}/%}
-INSTALL_DEPS = ${DEPFILE:%=${INSTALL_LIB}/%}
-INSTALL_DBDS = ${MODULEDBD:%=${INSTALL_DBD}/%}
-INSTALL_HDRS = $(addprefix ${INSTALL_INCLUDE}/,$(notdir ${HDRS}))
-INSTALL_DBS  = $(addprefix ${INSTALL_DB}/,$(notdir ${TEMPLS}))
-INSTALL_SCRS = $(addprefix ${INSTALL_SCR}/,$(notdir ${SCR}))
-INSTALL_BINS = $(addprefix ${INSTALL_BIN}/,$(notdir ${BINS}))
-INSTALL_CFGS = $(CFG:%=${INSTALL_CFG}/%)
-
-
-
-
-
-debug::
-	@echo "INSTALL_LIB = $(INSTALL_LIB)"
-	@echo "INSTALL_LIBS = $(INSTALL_LIBS)"
-	@echo "INSTALL_DEPS = $(INSTALL_DEPS)"
-	@echo "INSTALL_DBD = $(INSTALL_DBD)"
-	@echo "INSTALL_DBDS = $(INSTALL_DBDS)"
-	@echo "INSTALL_INCLUDE = $(INSTALL_INCLUDE)"
-	@echo "INSTALL_HDRS = $(INSTALL_HDRS)"
-	@echo "INSTALL_DB = $(INSTALL_DB)"
-	@echo "INSTALL_DBS = $(INSTALL_DBS)"
-	@echo "INSTALL_SCR = $(INSTALL_SCR)"
-	@echo "INSTALL_SCRS = $(INSTALL_SCRS)"
-	@echo "INSTALL_CFG = $(INSTALL_CFG)"
-	@echo "INSTALL_CFGS = $(INSTALL_CFGS)"
-	@echo "INSTALL_BIN = $(INSTALL_BIN)"
-	@echo "INSTALL_BINS = $(INSTALL_BINS)"
-
-INSTALLS += ${INSTALL_CFGS} ${INSTALL_SCRS} ${INSTALL_HDRS} ${INSTALL_DBDS} ${INSTALL_DBS} ${INSTALL_LIBS} ${INSTALL_BINS} ${INSTALL_DEPS}
-
-
-
-
-
-${INSTALLRULE} ${INSTALLS}
-
-
-
-
-
-${INSTALL_DBDS}: $(notdir ${INSTALL_DBDS})
-	@echo "Installing module dbd file $@"
-	$(INSTALL) -d -m444 $< $(@D)
-
-
-
-${INSTALL_LIBS}: $(notdir ${INSTALL_LIBS})
-	@echo "Installing module library $@"
-	$(INSTALL) -d -m555 $< $(@D)
-
-
-
-${INSTALL_DEPS}: $(notdir ${INSTALL_DEPS})
-	@echo "Installing module dependency file $@"
-	$(INSTALL) -d -m444 $< $(@D)
-
-# Fix templates for older EPICS versions:
-# Remove 'alias' for EPICS <= 3.14.10
-# and 'info' and macro defaults for EPICS 3.13.
-# Make use of differences in defined variables.
-
-
-# 3.14.10+
-${INSTALL_DBS}: $(notdir ${INSTALL_DBS})
-	@echo "Installing module template files $^ to $(@D)"
-	$(INSTALL) -d -m444 $^ $(@D)
-
-
-${INSTALL_SCRS}: $(notdir ${SCR})
-	@echo "Installing scripts $^ to $(@D)"
-	$(INSTALL) -d -m555 $^ $(@D)
-
-${INSTALL_CFGS}: ${CFGS}
-	@echo "Installing configuration files $^ to $(@D)"
-	$(INSTALL) -d -m444 $^ $(@D)
-
-${INSTALL_BINS}: $(addprefix ../,$(filter-out /%,${BINS})) $(filter /%,${BINS})
-	@echo "Installing binaries $^ to $(@D)"
-	$(INSTALL) -d -m555 $^ $(@D)
-
-# Create SNL code from st/stt file.
-# (RULES.Vx only allows ../%.st, 3.14 has no .st rules at all.)
-# Important to have %.o: %.st and %.o: %.stt rule before %.o: %.c rule!
-# Preprocess in any case because docu and implemented EPICS rules mismatch here.
-
-CPPSNCFLAGS1  = $(filter -D%, ${OP_SYS_CFLAGS})
-CPPSNCFLAGS1 += $(filter-out ${OP_SYS_INCLUDE_CPPFLAGS} ,${CPPFLAGS}) ${CPPSNCFLAGS}
-CPPSNCFLAGS1 += -I $(dir $(SNC))../../include
-SNCFLAGS += -r
-
-%$(OBJ) %_snl.dbd: %.st
-	@echo "Preprocessing $(<F)"
-	$(RM) $(*F).i
-	$(CPP) ${CPPSNCFLAGS1} $< > $(*F).i
-	@echo "Converting $(*F).i"
-	$(RM) $@
-	$(SNC) $(TARGET_SNCFLAGS) $(SNCFLAGS) $(*F).i
-	@echo "Compiling $(*F).c"
-	$(RM) $@
-	$(COMPILE.c) ${SNC_CFLAGS} $(*F).c
-
-
-%$(OBJ) %_snl.dbd: %.stt
-	@echo "Preprocessing $(<F)"
-	$(RM) $(*F).i
-	$(CPP) ${CPPSNCFLAGS1} $< > $(*F).i
-	@echo "Converting $(*F).i"
-	$(RM) $@
-	$(SNC) $(TARGET_SNCFLAGS) $(SNCFLAGS) $(*F).i
-	@echo "Compiling $(*F).c"
-	$(RM) $@
-	$(COMPILE.c) ${SNC_CFLAGS} $(*F).c
-
-
-# Create GPIB code from *.gt file.
-%.c %.dbd %.list: %.gt
-	@echo "Converting $*.gt"
-	${LN} $< $(*F).gt
-	gdc $(*F).gt
-
-
-
-${VERSIONFILE}:
-	echo "char _${PRJ}LibRelease[] = \"${LIBVERSION}\";" >> $@
-
-# EPICS R3.14.*:
-# Create file to fill registry from dbd file.
-${REGISTRYFILE}: ${MODULEDBD}
-	$(RM) $@ temp.cpp
-	$(PERL) $(EPICS_BASE_HOST_BIN)/registerRecordDeviceDriver.pl $< $(basename $@) | grep -v iocshRegisterCommon > temp.cpp
-	$(MV) temp.cpp $@
-
-# 3.14.12 complains if this rule is not overwritten
-./%Include.dbd:
-
-
-
-CORELIB = ${CORELIB_${OS_CLASS}}
-
-LSUFFIX_YES=$(SHRLIB_SUFFIX)
-LSUFFIX_NO=$(LIB_SUFFIX)
-LSUFFIX=$(LSUFFIX_$(SHARED_LIBRARIES))
-
-
-${EXPORTFILE}: $(filter-out $(basename ${EXPORTFILE})$(OBJ),${LIBOBJS})
-	$(RM) $@
-	$(NM) $^ ${BASELIBS:%=${EPICS_BASE}/lib/${T_A}/${LIB_PREFIX}%$(LSUFFIX)} ${CORELIB} | awk '$(makexportfile)' > $@
-
-# Create dependency file for recursive requires.
-${DEPFILE}: ${LIBOBJS} $(USERMAKEFILE)
-	@echo "Collecting dependencies"
-	$(RM) $@
-	@echo "# Generated file. Do not edit." > $@
-	# Check dependencies on other module headers.
-	cat *.d 2>/dev/null | sed 's/ /\n/g' | sed -n 's%${EPICS_MODULES}/*\([^/]*\)/\([0-9]*\.[0-9]*\)\.[0-9]*/.*%\1 \2%p;s%$(EPICS_MODULES)/*\([^/]*\)/\([^/]*\)/.*%\1 \2%p'| sort -u >> $@
-ifneq ($(strip ${REQ}),)
-	# Manully added dependencies: ${REQ}
-	@$(foreach m,${REQ},echo "$m $(or ${$m_VERSION},$(and $(wildcard ${EPICS_MODULES}/$m),$(error REQUIRED module $m has no numbered version. Set $m_VERSION)),$(warning REQUIRED module $m not found for ${T_A}.))" >> $@;)
-endif
-
-
-
-# Remove MakefileInclude after we are done because it interfers with our way to build.
-$(BUILDRULE)
-	$(RM) MakefileInclude
diff --git a/patch/Site/HISTORY.md b/patch/Site/HISTORY.md
new file mode 100644
index 00000000..cbaad2ea
--- /dev/null
+++ b/patch/Site/HISTORY.md
@@ -0,0 +1,7 @@
+# what_ever_filename.p0.patch
+
+Generic Description.....
+
+* created by Jeong Han Lee, han.lee@esss.se
+* related URL or reference https://github.com/icshwi
+* Tuesday, February 13 13:24:57 CET 2018
diff --git a/patch/Site/README.md b/patch/Site/README.md
new file mode 100644
index 00000000..60cb9573
--- /dev/null
+++ b/patch/Site/README.md
@@ -0,0 +1,22 @@
+# Site Specific EPICS Module Patch Files
+
+## Changes
+The changes were tested in local environemnt, and commits to the forked repository and do pull request to the epics community module repository.
+
+* Check the original HASH, and your own master
+* feb8856 : The original HASH
+* master : Changed
+
+
+## How to create a p0 patch file between commits
+
+
+* Show what the difference between commits
+
+
+* Create p0 patch
+
+```
+$git diff feb8856 master --no-prefix > ../patch/Site/what_ever_filename.p0.patch
+```
+
diff --git a/require.Makefile b/require.Makefile
index 2607e668..162d58c4 100644
--- a/require.Makefile
+++ b/require.Makefile
@@ -9,7 +9,6 @@ where_am_I := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
 # instead of the installed makefile.
 include $(where_am_I)/App/tools/driver.makefile
 
-#include $(E3_REQUIRE_TOOLS)/driver.makefile
 
 BUILDCLASSES += Linux
 
diff --git a/tools/ess-env.conf b/tools/ess-env.conf
index 15956513..0823d8d3 100644
--- a/tools/ess-env.conf
+++ b/tools/ess-env.conf
@@ -1 +1 @@
-IOCSH_HASH_VERSION=61d0b88
+IOCSH_HASH_VERSION=9772cb8
diff --git a/tools/setE3Env.bash b/tools/setE3Env.bash
index d6d4ce5f..45a7547c 100755
--- a/tools/setE3Env.bash
+++ b/tools/setE3Env.bash
@@ -92,7 +92,7 @@ E3_REQUIRE_LIB=${E3_REQUIRE_LOCATION}/lib
 E3_REQUIRE_INC=${E3_REQUIRE_LOCATION}/include
 E3_REQUIRE_DB=${E3_REQUIRE_LOCATION}/db
 E3_REQUIRE_DBD=${E3_REQUIRE_LOCATION}/dbd
-E3_REQUIRE_TOOLS=${E3_REQUIRE_LOCATION}/tools
+
 
 E3_SITEMODS_PATH=${E3_REQUIRE_LOCATION}/siteMods
 E3_SITELIBS_PATH=${E3_REQUIRE_LOCATION}/siteLibs
-- 
GitLab