Skip to content
Snippets Groups Projects
Commit 27247a1b authored by Simon Rose's avatar Simon Rose
Browse files

Warning if invalid dependent X_DEP_VERSION is used

parent fb082b35
No related branches found
No related tags found
1 merge request!83E3-752: Fetch dependencies recursively
Pipeline #109744 failed
...@@ -438,36 +438,38 @@ select = $(strip $(call -select,$(strip $2),$1,$3)) ...@@ -438,36 +438,38 @@ select = $(strip $(call -select,$(strip $2),$1,$3))
str-eq = $(if $(subst x$1,,x$2),,t) str-eq = $(if $(subst x$1,,x$2),,t)
_MODULES := _MODULES :=
REQUIRED := REQ :=
INSTALLED_MODULES := $(sort $(notdir $(shell ls -d $(E3_SITEMODS_PATH)/* $(EPICS_MODULES)/*)))
# Converts all of the X_DEP_VERSIONs to x_VERSION and records them # Converts all of the X_DEP_VERSIONs to x_VERSION and records them
define fetch_module_versions define fetch_module_versions
_lm := $$(shell echo $1 | tr '[:upper:]' '[:lower:]') _lm := $$(shell echo $1 | tr '[:upper:]' '[:lower:]')
$$(_lm)_VERSION := $($1_DEP_VERSION) ifneq ($$(strip $$(filter $(INSTALLED_MODULES),$$(_lm))),)
_MODULES += $$(_lm) $$(_lm)_VERSION := $($1_DEP_VERSION)
_MODULES += $$(_lm)
else
$$(warning Invalid dependency "$1_DEP_VERSION"; pruning)
endif
endef endef
$(foreach m,$(patsubst %_DEP_VERSION,%,$(filter %_DEP_VERSION,$(.VARIABLES))),$(eval $(call fetch_module_versions,$m))) $(foreach m,$(patsubst %_DEP_VERSION,%,$(filter %_DEP_VERSION,$(.VARIABLES))),$(eval $(call fetch_module_versions,$m)))
# Only keep actual modules, however
_MODULES := $(filter $(shell ls $(E3_SITEMODS_PATH) $(EPICS_MODULES)),$(_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 $(E3_SITEMODS_PATH)/$1/$($1_VERSION)/lib/$(T_A)/$1.dep | sed '1d') $(shell cat $(E3_SITEMODS_PATH)/$1/$($1_VERSION)/lib/$(T_A)/$1.dep | sed '1d')
endef endef
# Used to recurse through versions: updates REQUIRED and fetches all of the dependencies from the given module # Used to recurse through versions: updates REQ and fetches all of the dependencies from the given module
define update_dep_versions define update_dep_versions
m := $$(firstword $$(_MODULES)) m := $$(firstword $$(_MODULES))
REQUIRED += $$m REQ += $$m
$$m_TBL := $$(call fetch_deps,$$m) $$m_TBL := $$(call fetch_deps,$$m)
$$m_DEPS := $$(call select,1,$$($$m_TBL),1) $$m_DEPS := $$(call select,1,$$($$m_TBL),1)
_MODULES := $$(filter-out $$(REQUIRED),$$(_MODULES) $$($$m_DEPS)) _MODULES := $$(filter-out $$(REQ),$$(_MODULES) $$($$m_DEPS))
$$(foreach mm,$$($$m_DEPS),$$(eval $$(mm)_VERSION := $$(call select,2,$$($$m_TBL),$$$$(call str-eq,$$$$1,$$(mm))))) $$(foreach mm,$$($$m_DEPS),$$(eval $$(mm)_VERSION := $$(call select,2,$$($$m_TBL),$$$$(call str-eq,$$$$1,$$(mm)))))
endef endef
$(call while,$$(_MODULES),$(update_dep_versions)) $(call while,$$(_MODULES),$(update_dep_versions))
$(foreach m,$(REQUIRED),$(eval export $m_VERSION)) $(foreach m,$(REQ),$(eval export $m_VERSION))
debug:: debug::
@echo "===================== Pass 3: T_A = $(T_A) =====================" @echo "===================== Pass 3: T_A = $(T_A) ====================="
...@@ -514,7 +516,7 @@ ARCH_PARTS = ${T_A} $(subst -, ,${T_A}) ${OS_CLASS} ...@@ -514,7 +516,7 @@ 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
REQ = ${REQUIRED} $(foreach x, ${VAR_EXTENSIONS}, ${REQUIRED_$x}) REQ += ${REQUIRED} $(foreach x, ${VAR_EXTENSIONS}, ${REQUIRED_$x})
export REQ export REQ
SRCS += $(foreach x, ${VAR_EXTENSIONS}, ${SOURCES_$x}) SRCS += $(foreach x, ${VAR_EXTENSIONS}, ${SOURCES_$x})
......
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