Skip to content
Snippets Groups Projects
Commit bdec78e4 authored by Lucas Magalhães's avatar Lucas Magalhães
Browse files

Merge branch 'fix_dbexpansion' into 'master'

E3-1112: Move module_VERSION definitions to first make call

See merge request e3/e3-require!119
parents 907e894a 556a5d39
No related branches found
No related tags found
No related merge requests found
...@@ -143,6 +143,20 @@ endef ...@@ -143,6 +143,20 @@ endef
define FETCH_REVISION_NUMBER define FETCH_REVISION_NUMBER
$(shell $(MAKEHOME)/revision_number $(1) $(2) $($(2)_VERSION)) $(shell $(MAKEHOME)/revision_number $(1) $(2) $($(2)_VERSION))
endef 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 # Functions used for recursive dependency fetching. These are modified from https://github.com/markpiffer/gmtt.git
space := $(strip) $(strip)# space := $(strip) $(strip)#
...@@ -282,6 +296,20 @@ $1-%: | $(COMMON_DIR) ...@@ -282,6 +296,20 @@ $1-%: | $(COMMON_DIR)
endef endef
$(foreach target,install build debug,$(eval $(call target_rule,$(target)))) $(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: .SECONDEXPANSION:
# This has to fit under .SECONDEXPANSION in order to catch TMPS and SUBS, which are typically defined # 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} ...@@ -306,37 +334,14 @@ ARCH_PARTS = ${T_A} $(subst -, ,${T_A}) ${OS_CLASS}
VAR_EXTENSIONS = ${EPICSVERSION} ${ARCH_PARTS} ${ARCH_PARTS:%=${EPICSVERSION}_%} VAR_EXTENSIONS = ${EPICSVERSION} ${ARCH_PARTS} ${ARCH_PARTS:%=${EPICSVERSION}_%}
export VAR_EXTENSIONS 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 # Look for dependencies on extension files the same way as above
$(foreach x,$(VAR_EXTENSIONS),\ $(foreach x,$(VAR_EXTENSIONS),\
$(foreach m,$(patsubst %_DEP_VERSION_$(x),%,$(filter %_DEP_VERSION_$(x),$(.VARIABLES))),$(eval $(call fetch_module_versions,$m,_$(x))))\ $(foreach m,$(patsubst %_DEP_VERSION_$(x),%,$(filter %_DEP_VERSION_$(x),$(.VARIABLES))),$(eval $(call fetch_module_versions,$m,_$(x))))\
) )
export REQ export REQ
export MODULES
PROCESSED_MODULES :=
# Fetches the data from .dep files to be parsed by the above # Fetches the data from .dep files to be parsed by the above
define fetch_deps define fetch_deps
$(shell cat $(or \ $(shell cat $(or \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment