From 4c52c6a0b8495c485e148d00ceb00cdfdfd0fdd0 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 23 Mar 2017 09:38:28 +0100 Subject: [PATCH] fix problems with versions like *.*.* where not all elements are numbers fix problem with ui file names containing fancy characters like $(xxx) --- App/tools/driver.makefile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/App/tools/driver.makefile b/App/tools/driver.makefile index 1b05dda..582e5dc 100644 --- a/App/tools/driver.makefile +++ b/App/tools/driver.makefile @@ -78,6 +78,9 @@ DOCUEXT += template db dbt subs subst substitutions script #override config here -include ${MAKEHOME}/config +# use fancy glob to find latest versions +SHELL = /bin/bash -O extglob + # Some shell commands LN = ln -s EXISTS = test -e @@ -255,13 +258,13 @@ installui: install$(1) install$(1): uninstall$(1) # @echo $(1)=$${$(1)} @$$(if $${$(1)_FILES},echo "Installing $(1) user interfaces";$$(MKDIR) $${INSTALL_$(1)}) - $$(if $${$(1)_FILES},install -C -m444 $${$(1)_FILES} -t $${INSTALL_$(1)}) - @$$(if $${$(1)_FILES},echo $$(notdir $${$(1)_FILES}) > $${INSTALL_$(1)}/.$${PRJ}-$$(LIBVERSION).txt) + @$$(if $${$(1)_FILES},install -v -t $${INSTALL_$(1)} -C -m444 $${$(1)_FILES:%='%'}) + @$$(if $${$(1)_FILES},echo "$$(patsubst %,'%',$$(notdir $${$(1)_FILES}))" > $${INSTALL_$(1)}/.$${PRJ}-$$(LIBVERSION).txt) uninstallui: uninstall$(1) uninstall$(1): @echo "Removing old $(1) user interfaces" - $$(RM) $$(addprefix $${INSTALL_$(1)}/,$$(sort $$(notdir $${$(1)_FILES}) $$(shell cat $${INSTALL_$(1)}/.$${PRJ}-*.txt 2>/dev/null)) .$${PRJ}-*.txt) + $$(RM) $$(addprefix $${INSTALL_$(1)}/,$$(sort $$(patsubst %,'%',$$(notdir $${$(1)_FILES})) $$(shell cat $${INSTALL_$(1)}/.$${PRJ}-*.txt 2>/dev/null)) .$${PRJ}-*.txt) endef #$(eval $(call INSTALL_UI_RULE,VARIABLE,installdir,sourcedefaultlocation)) @@ -520,7 +523,7 @@ EPICS_INCLUDES = # The user can overwrite (or add) by defining _INC= (not recommended!) # Only really existing directories are added to the search path define ADD_FOREIGN_INCLUDES -$(eval $(1)_VERSION := $(patsubst ${EPICS_MODULES}/$(1)/%/R${EPICSVERSION}/include,%,$(lastword $(shell ls -dv ${EPICS_MODULES}/$(1)/*.*.*/R${EPICSVERSION}/include 2>/dev/null)))) +$(eval $(1)_VERSION := $(patsubst ${EPICS_MODULES}/$(1)/%/R${EPICSVERSION}/include,%,$(firstword $(shell ls -dvr ${EPICS_MODULES}/$(1)/+([0-9]).+([0-9]).+([0-9])/R${EPICSVERSION}/include 2>/dev/null)))) INSTALL_INCLUDES += $$(patsubst %,-I${EPICS_MODULES}/$(1)/%/R${EPICSVERSION}/include,$$($(1)_VERSION)) endef # The tricky part is to sort versions numerically. Make can't but ls -v can. Only accept numerical versions. @@ -534,7 +537,7 @@ endif # manually required modules define ADD_MANUAL_DEPENDENCIES -$(eval $(1)_VERSION := $(or $(patsubst ${EPICS_MODULES}/$(1)/%/R${EPICSVERSION},%,$(lastword $(shell ls -dv ${EPICS_MODULES}/$(1)/*.*.*/R${EPICSVERSION} 2>/dev/null))),$(basename $(lastword $(subst -, ,$(basename $(realpath ${INSTBASE}/iocBoot/R${EPICSVERSION}/${T_A}/$(1).dep))))))) +$(eval $(1)_VERSION := $(or $(patsubst ${EPICS_MODULES}/$(1)/%/R${EPICSVERSION},%,$(firstword $(shell ls -dvr ${EPICS_MODULES}/$(1)/+([0-9]).+([0-9]).+([0-9])/R${EPICSVERSION} 2>/dev/null))),$(basename $(lastword $(subst -, ,$(basename $(realpath ${INSTBASE}/iocBoot/R${EPICSVERSION}/${T_A}/$(1).dep))))))) endef $(eval $(foreach m,${REQ},$(call ADD_MANUAL_DEPENDENCIES,$m))) @@ -716,7 +719,7 @@ DBDFILES += $(patsubst %.gt,%.dbd,$(notdir $(filter %.gt,${SRCS}))) #DBDFILES += $(if $(shell cat ${SUBFUNCFILE}),${SUBFUNCFILE}) # snc location in 3.14: from latest version module seq or fall back to globally installed -SNC=$(lastword $(dir ${EPICS_BASE})seq/bin/$(EPICS_HOST_ARCH)/snc $(shell ls -dv ${EPICS_MODULES}/seq/$(or $(seq_VERSION),*.*.*)/R${EPICSVERSION}/bin/${EPICS_HOST_ARCH}/snc 2>/dev/null)) +SNC=$(lastword $(dir ${EPICS_BASE})seq/bin/$(EPICS_HOST_ARCH)/snc $(shell ls -dv ${EPICS_MODULES}/seq/$(or $(seq_VERSION),+([0-9]).+([0-9]).+([0-9]))/R${EPICSVERSION}/bin/${EPICS_HOST_ARCH}/snc 2>/dev/null)) endif # 3.14