diff --git a/configure/CONFIG b/configure/CONFIG index 6c3ba7cd401f2440922090eb9da5dda0a037f141..5487f77846cc36317c6fd4c76ae2643bc787ae92 100644 --- a/configure/CONFIG +++ b/configure/CONFIG @@ -19,15 +19,16 @@ endif E3_MODULES_PATH:=$(EPICS_BASE) +REQUIRE_CONFIG:=$(TOP)/configure/E3 include $(EPICS_BASE)/configure/CONFIG_BASE_VERSION -include $(TOP)/configure/E3/CONFIG_REQUIRE -include $(TOP)/configure/E3/CONFIG_SHELL -include $(TOP)/configure/E3/CONFIG_E3_PATH -include $(TOP)/configure/E3/CONFIG_E3_MAKEFILE -include $(TOP)/configure/E3/CONFIG_TEST -include $(TOP)/configure/E3/CONFIG_EPICS -include $(TOP)/configure/E3/CONFIG_EXPORT +include $(REQUIRE_CONFIG)/CONFIG_REQUIRE +include $(REQUIRE_CONFIG)/CONFIG_SHELL +include $(REQUIRE_CONFIG)/CONFIG_E3_PATH +include $(REQUIRE_CONFIG)/CONFIG_E3_MAKEFILE +include $(REQUIRE_CONFIG)/CONFIG_TEST +include $(REQUIRE_CONFIG)/CONFIG_EPICS +include $(REQUIRE_CONFIG)/CONFIG_EXPORT VARS_EXCLUDES+=BASE_3_14 diff --git a/configure/E3/RULES_CHECKS b/configure/E3/RULES_CHECKS new file mode 100644 index 0000000000000000000000000000000000000000..875a02a72a62c53ba14bb05de241dbe521e8ba39 --- /dev/null +++ b/configure/E3/RULES_CHECKS @@ -0,0 +1,26 @@ +.PHONY: consistency_checks +consistency_checks: module_name_check loc-check + +ifneq (require,$(E3_MODULE_NAME)) +consistency_checks: sitemods_check +endif + +# Check that the module name satisfies a few conditions before we go on. +module_name_check: +ifneq ($(shell echo $(E3_MODULE_NAME) | grep -q '^[a-z_][a-z0-9_]*$$' ; echo $$?),0) + $(error E3_MODULE_NAME '$(E3_MODULE_NAME)' is not valid. It should consist only of lowercase letters, numbers, and underscores.) +endif + +# Check that a module is including RULES_SITEMODS instead of RULES_SITEAPPS or manually including RULES_E3 +.PHONY: sitemods_check +sitemods_check: +ifeq ($(filter RULES_SITEMODS,$(notdir $(MAKEFILE_LIST))),) + $(error RULES_E3 should only be loaded from RULES_SITEMODS) +endif + +# Check that e3 wrappers are using EPICS_MODULE_TAG to manage local source mode +.PHONU: loc-check +loc-check: +ifneq (,$(findstring -loc,$(E3_MODULE_SRC_PATH))) + $(error DEPRECATED: Local source mode "-loc" has being deprecated. Please comment out the EPICS_MODULE_TAG to use local source mode.) +endif diff --git a/configure/E3/RULES_E3 b/configure/E3/RULES_E3 index 8a2dfdb214b4084cf211e3cd503390368e415394..941ea4fa794419fd5ad3cb957f8a63abc4ef68b1 100644 --- a/configure/E3/RULES_E3 +++ b/configure/E3/RULES_E3 @@ -3,7 +3,7 @@ .DEFAULT_GOAL := help -.PHONY: help default install uninstall build rebuild clean conf all +.PHONY: help default install uninstall build rebuild clean conf all prebuild default: help @@ -28,33 +28,43 @@ help: -## Install require to $(EPICS_BASE)/require/$(E3_MODULE_VERSION) -install: requireconf install_module +## Install module to $(E3_MODULES_INSTALL_LOCATION) +install: install_module -install_module: build db +.PHONY: db +db: err_no_db_rule + +.PHONY: err_no_db_rule +err_no_db_rule: + $(error The 'db' target has been discontinued. If you have custom database expansion rule to use, please contact the e3 team) + +.PHONY: install_module +install_module: build db_internal $(QUIET) $(E3_MODULE_MAKE_CMDS) install -## Uninstall the current module -uninstall: conf -ifeq (,$(strip $(wildcard $(E3_SITEMODS_PATH)/*))) - $(QUIET) $(E3_MODULE_MAKE_CMDS) uninstall -else - $(error Cannot run 'make uninstall': please manually uninstall everything in $(E3_SITEMODS_PATH)) -endif +.PHONY: check_uninstall +check_uninstall: -# We should be able to force an uninstall of require if we need to; this should not be done without some care and thought, however! -## Uninstall, including deleting siteMods directory. -forceuninstall: conf +## Uninstall the current module +uninstall: check_uninstall conf $(QUIET) $(E3_MODULE_MAKE_CMDS) uninstall -## Build current module. -build: conf +## Build current module +build: conf checkout prebuild $(QUIET) $(E3_MODULE_MAKE_CMDS) build +## Run module-specific commands before building +prebuild: conf + $(QUIET) $(E3_MODULE_MAKE_CMDS) prebuild + ## Displays information about the build process debug: conf $(QUIET) $(E3_MODULE_MAKE_CMDS) debug +.PHONY: db_internal +db_internal: conf + $(QUIET) $(E3_MODULE_MAKE_CMDS) db_internal + ## Clean, build, and install the current module rebuild: clean build install @@ -62,10 +72,42 @@ rebuild: clean build install clean: conf $(QUIET) $(E3_MODULE_MAKE_CMDS) clean +## Initializes, patches, builds, and installs all: init patch rebuild # Copy $(E3_MODULE_MAKEFILE) into $(E3_MODULE_SRC_PATH) -conf: - $(QUIET) install -m 644 $(TOP)/$(E3_MODULE_MAKEFILE) $(E3_MODULE_SRC_PATH)/ +include $(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))) +E3_LOCAL_SOURCE:=1 +endif +ifeq ($(E3_LOCAL_SOURCE),1) init: + $(QUIET) echo ">> You are in the local source mode." + $(QUIET) echo ">> Nothing happens." + +checkout: + +else +## Syncs and checks out the tag $(EPICS_MODULE_TAG) for the submodule +init: git-submodule-sync $(E3_MODULE_SRC_PATH) checkout + + +git-submodule-sync: + $(QUIET) git submodule sync + + +$(E3_MODULE_SRC_PATH): + $(QUIET) $(git_update) + + +checkout: + cd $(E3_MODULE_SRC_PATH) && git checkout $(EPICS_MODULE_TAG) + + +endif diff --git a/configure/RULES b/configure/RULES index aced32cafaee3b3c8dd5096ec0525be146a80e21..f89e4820782e7e7bde33b89d0a62aa26ac440c6b 100644 --- a/configure/RULES +++ b/configure/RULES @@ -1,22 +1,22 @@ # -*- mode: Makefile;-*- # include $(EPICS_BASE)/configure/RULES -include $(TOP)/configure/E3/DEFINES_FT +include $(REQUIRE_CONFIG)/DEFINES_FT # # We cannot use file operation in CentOS7.4, # because Makefile version is 3.8. -include $(TOP)/configure/E3/RULES_E3 -include $(TOP)/configure/E3/RULES_EPICS +include $(REQUIRE_CONFIG)/RULES_E3 +include $(REQUIRE_CONFIG)/RULES_EPICS include $(TOP)/configure/module/RULES_REQUIRE -include $(TOP)/configure/E3/RULES_PATCH +include $(REQUIRE_CONFIG)/RULES_PATCH include $(TOP)/configure/module/RULES_DB -include $(TOP)/configure/E3/RULES_VARS +include $(REQUIRE_CONFIG)/RULES_VARS include $(TOP)/configure/module/RULES_TEST ifneq (,$(findstring dev,$(MAKECMDGOALS))) -include $(TOP)/configure/E3/RULES_DEV +include $(REQUIRE_CONFIG)/RULES_DEV endif diff --git a/configure/module/RULES_REQUIRE b/configure/module/RULES_REQUIRE index ca535cf92a6be3777f0e056cc7f6fdbcd370be6f..9eb6379b0936cb23ad4e930b476566b9627d7c42 100644 --- a/configure/module/RULES_REQUIRE +++ b/configure/module/RULES_REQUIRE @@ -12,9 +12,15 @@ 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/*)) +check_uninstall: +ifneq (,$(strip $(wildcard $(E3_SITEMODS_PATH)/*))) + $(error Cannot run 'make uninstall': please manually uninstall everything in $(E3_SITEMODS_PATH)) +endif .PHONY: e3-site-path requireconf +install: requireconf + requireconf: e3-site-path 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)/ @@ -41,9 +47,12 @@ epics: $(QUIET)echo "CHECK_RELEASE = YES" > $(TOP)/$(E3_MODULE_SRC_PATH)/configure/CONFIG_SITE $(SUDOBASH) "$(MAKE) -C $(E3_MODULE_SRC_PATH)" -.PHONY: epics-clean -epics-clean: - $(SUDOBASH) "$(MAKE) -C $(E3_MODULE_SRC_PATH) clean" +# We should be able to force an uninstall of require if we need to; this should not be done without some care and thought, however! +## Uninstall, including deleting siteMods directory. +forceuninstall: conf + $(QUIET) $(E3_MODULE_MAKE_CMDS) uninstall + +consistency_checks: VARS_EXCLUDES+=FILE_FILTER VARS_EXCLUDES+=E3_SHELL_FILES diff --git a/configure/modules/RULES_CHECKS b/configure/modules/RULES_CHECKS index b8992b7d9160a8ecbb057c3cc1b45cd9c49331e1..875a02a72a62c53ba14bb05de241dbe521e8ba39 100644 --- a/configure/modules/RULES_CHECKS +++ b/configure/modules/RULES_CHECKS @@ -1,5 +1,9 @@ .PHONY: consistency_checks -consistency_checks: module_name_check sitemods_check loc-check +consistency_checks: module_name_check loc-check + +ifneq (require,$(E3_MODULE_NAME)) +consistency_checks: sitemods_check +endif # Check that the module name satisfies a few conditions before we go on. module_name_check: diff --git a/configure/modules/RULES_E3 b/configure/modules/RULES_E3 index d473c3dc9873d836e25d56a48823df90a792f43d..941ea4fa794419fd5ad3cb957f8a63abc4ef68b1 100644 --- a/configure/modules/RULES_E3 +++ b/configure/modules/RULES_E3 @@ -28,8 +28,8 @@ help: -## Install current module to $(EPICS_BASE)/require/$(E3_REQUIRE_VERSION)/siteMods -install: install_module install_links +## Install module to $(E3_MODULES_INSTALL_LOCATION) +install: install_module .PHONY: db db: err_no_db_rule @@ -42,8 +42,11 @@ err_no_db_rule: install_module: build db_internal $(QUIET) $(E3_MODULE_MAKE_CMDS) install +.PHONY: check_uninstall +check_uninstall: + ## Uninstall the current module -uninstall: conf +uninstall: check_uninstall conf $(QUIET) $(E3_MODULE_MAKE_CMDS) uninstall ## Build current module @@ -77,7 +80,7 @@ include $(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 +.PHONY: init git-submodule-sync $(E3_MODULE_SRC_PATH) checkout ifeq (,$(strip $(EPICS_MODULE_TAG))) E3_LOCAL_SOURCE:=1 diff --git a/require.Makefile b/require.Makefile index 01b8594e2a1ae0cd5531d8ab5fc83689bb50058c..94c29e10c7ae1a0039f7d88f739174ede6bf5055 100644 --- a/require.Makefile +++ b/require.Makefile @@ -97,11 +97,11 @@ USR_DBFLAGS += -I . -I .. USR_DBFLAGS += -I$(EPICS_BASE)/db -TEMS = $(wildcard $(APPDB)/*.template) +TMPS = $(wildcard $(APPDB)/*.template) -db: $(TEMS) +db: $(TMPS) -$(TEMS): +$(TMPS): @printf "Inflating database ... %44s >>> %40s \n" "$@" "$(basename $(@)).db" @rm -f $(basename $(@)).db.d $(basename $(@)).db @$(MSI) -D $(USR_DBFLAGS) -o $(basename $(@)).db $@ > $(basename $(@)).db.d @@ -110,4 +110,4 @@ $(TEMS): -.PHONY: db $(TEMS) +.PHONY: db $(TMPS)