Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
RULES_REQUIRE 2.60 KiB
# -*- mode: Makefile;-*-

# The following VARIABLES are defined in RULES_REQUIRE instead of CONFIG_REQUIRE,
# because they are used in ONLY RULES_REQUIRE. It is easy to understand them. 
#
# CentOS7.4 and Debian 8, it works
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)

FILE_FILTER:= %~ %\#
E3_ESSENVCFG_FILE := $(TOP)/tools/ess-env.conf
E3_CONFIG_FILE    := $(TOP)/tools/e3.cfg
E3_TEST_SCRIPT    := $(TOP)/tools/test_installed_modules.sh
#
E3_SHELL_FILES    := $(wildcard $(E3_MODULE_SRC_PATH)/tools/iocsh*.bash)
E3_IOC_CFG_FILES  := $(E3_MODULE_SRC_PATH)/tools/iocsh_functions
E3_IOC_CFG_FILES  += $(E3_ESSENVCFG_FILE)
#E3_IOC_CFG_FILES  += $(E3_CONFIG_FILE)
E3_IOC_CFG_FILES  += $(E3_MODULE_SRC_PATH)/tools/setE3Env.bash
E3_IOC_CFG_FILES  += $(E3_MODULE_SRC_PATH)/tools/promptE3Env.bash
E3_REQUIRE_CONF_FILES := $(filter-out $(FILE_FILTER), $(wildcard $(TOP)/configure/modules/*))


.PHONY: e3-site-conf  e3-site-path requireconf

requireconf: e3-site-path e3-site-conf e3-require-path
	$(QUIET) install    -m 755 $(wildcard $(E3_MODULE_SRC_PATH)/tools/*.tcl)  $(E3_REQUIRE_TOOLS)/
	$(QUIET) install    -m 644 $(E3_MODULE_SRC_PATH)/tools/driver.makefile    $(E3_REQUIRE_TOOLS)/
	$(QUIET) install    -m 755 $(E3_MODULE_SRC_PATH)/tools/*.sh    $(E3_REQUIRE_TOOLS)/
	$(QUIET) install    -m 755 $(E3_SHELL_FILES)             $(E3_REQUIRE_BIN)/
	$(QUIET) install    -m 644 $(E3_IOC_CFG_FILES)           $(E3_REQUIRE_BIN)/
	$(QUIET) install    -m 644 $(E3_REQUIRE_CONF_FILES)      $(E3_REQUIRE_CONFIG)/


e3-require-path:
	$(QUIET) install -d -m 755 $(E3_REQUIRE_TOOLS)
	$(QUIET) install -d -m 755 $(E3_REQUIRE_BIN)
	$(QUIET) install -d -m 755 $(E3_REQUIRE_CONFIG)	


e3-site-path:
	$(QUIET) install -d -m 755 $(E3_SITELIBS_PATH)
	$(QUIET) install -d -m 755 $(E3_SITEMODS_PATH)
	$(QUIET) install -d -m 755 $(E3_SITEAPPS_PATH)


e3-site-conf:
# Makefile VERSION > 4.x is needed, DEFINES_REQUIRE can be found in a19eb01
#	$(QUIET) $(file > $(G_E3_CFG_FILE), $(E3_CFG_VARS))
	$(QUIET)echo "declare -g DEFAULT_EPICS_BASE=$(E3_MODULES_PATH)"          > $(E3_CONFIG_FILE)
	$(QUIET)echo "declare -g DEFAULT_REQUIRE_NAME=$(E3_REQUIRE_NAME)"       >> $(E3_CONFIG_FILE)
	$(QUIET)echo "declare -g DEFAULT_REQUIRE_VERSION=$(E3_REQUIRE_VERSION)" >> $(E3_CONFIG_FILE)
	$(QUIET)sed -i 's/^IOCSH_HASH_VERSION=.*/IOCSH_HASH_VERSION=$(IOCSH_HASH_VERSION)/g' $(E3_ESSENVCFG_FILE)



VARS_EXCLUDES+=FILE_FILTER
VARS_EXCLUDES+=E3_SHELL_FILES
VARS_EXCLUDES+=E3_IOC_CFG_FILES
VARS_EXCLUDES+=E3_REQUIRE_CONF_FILES
VARS_EXCLUDES+=E3_ESSENVCFG_FILE
VARS_EXCLUDES+=E3_CONFIG_FILE