diff --git a/require-ess/tools/driver.makefile b/require-ess/tools/driver.makefile index 7d95aca8eccf643eb78e310a6540d22326397d4e..ceab7598018ccc2954b4b48047e0bf1555144bca 100644 --- a/require-ess/tools/driver.makefile +++ b/require-ess/tools/driver.makefile @@ -143,6 +143,20 @@ endef define FETCH_REVISION_NUMBER $(shell $(MAKEHOME)/revision_number $(1) $(2) $($(2)_VERSION)) endef +# Create the module_VERSION variables giving the module and check if the module +# is actually installed. Add the module to the MODULES and REQ variables. That +# will be used later. +define fetch_module_versions + lm := $$(shell echo $1 | tr '[:upper:]' '[:lower:]') + ifneq ($$(strip $$(filter $(INSTALLED_MODULES),$$(lm))),) + $$(lm)_VERSION := $($1_DEP_VERSION$2) + $$(lm)_VERSION := $$(lastword $$(call FETCH_REVISION_NUMBER,$(E3_SITEMODS_PATH),$$(lm)) $$(call FETCH_REVISION_NUMBER,$(EPICS_MODULES),$$(lm))) + MODULES += $$(lm) + REQ += $$(lm) + else + $$(warning Invalid dependency "$1_DEP_VERSION$2"; pruning) + endif +endef # Functions used for recursive dependency fetching. These are modified from https://github.com/markpiffer/gmtt.git space := $(strip) $(strip)# @@ -282,6 +296,20 @@ $1-%: | $(COMMON_DIR) endef $(foreach target,install build debug,$(eval $(call target_rule,$(target)))) +MODULES := +REQ := +INSTALLED_MODULES := $(sort $(notdir $(wildcard $(E3_SITEMODS_PATH)/* $(EPICS_MODULES)/*))) +export INSTALLED_MODULES + +# Converts all of the X_DEP_VERSIONs to x_VERSION and records them +# Calls fetch_module_version for each module that appears in a +# module_DEP_VERSION variable. This is defined on the wrapper CONFIG_MODULE +$(foreach m,$(patsubst %_DEP_VERSION,%,$(filter %_DEP_VERSION,$(.VARIABLES))),$(eval $(call fetch_module_versions,$m))) +export REQ +export MODULES + +$(foreach m,$(MODULES),$(eval export $m_VERSION)) + .SECONDEXPANSION: # This has to fit under .SECONDEXPANSION in order to catch TMPS and SUBS, which are typically defined @@ -306,37 +334,14 @@ ARCH_PARTS = ${T_A} $(subst -, ,${T_A}) ${OS_CLASS} VAR_EXTENSIONS = ${EPICSVERSION} ${ARCH_PARTS} ${ARCH_PARTS:%=${EPICSVERSION}_%} export VAR_EXTENSIONS -MODULES := -PROCESSED_MODULES := -REQ := -INSTALLED_MODULES := $(sort $(notdir $(wildcard $(E3_SITEMODS_PATH)/* $(EPICS_MODULES)/*))) - -# Converts all of the X_DEP_VERSIONs to x_VERSION and records them - -# Create the module_VERSION variables giving the module and check if the module -# is actually installed. Add the module to the MODULES and REQ variables. That -# will be used later. -define fetch_module_versions - lm := $$(shell echo $1 | tr '[:upper:]' '[:lower:]') - ifneq ($$(strip $$(filter $(INSTALLED_MODULES),$$(lm))),) - $$(lm)_VERSION := $($1_DEP_VERSION$2) - $$(lm)_VERSION := $$(lastword $$(call FETCH_REVISION_NUMBER,$(E3_SITEMODS_PATH),$$(lm)) $$(call FETCH_REVISION_NUMBER,$(EPICS_MODULES),$$(lm))) - MODULES += $$(lm) - REQ += $$(lm) - else - $$(warning Invalid dependency "$1_DEP_VERSION$2"; pruning) - endif -endef -# Calls fetch_module_version for each module that appears in a -# module_DEP_VERSION variable. This is defined on the wrapper CONFIG_MODULE -$(foreach m,$(patsubst %_DEP_VERSION,%,$(filter %_DEP_VERSION,$(.VARIABLES))),$(eval $(call fetch_module_versions,$m))) # Look for dependencies on extension files the same way as above $(foreach x,$(VAR_EXTENSIONS),\ $(foreach m,$(patsubst %_DEP_VERSION_$(x),%,$(filter %_DEP_VERSION_$(x),$(.VARIABLES))),$(eval $(call fetch_module_versions,$m,_$(x))))\ ) export REQ +export MODULES - +PROCESSED_MODULES := # Fetches the data from .dep files to be parsed by the above define fetch_deps $(shell cat $(or \