forked from epics_driver_modules/require
various changes to support macOS and windows build
. arch dependant headers are installed in os/${OS_CLASS} subdir
. function to filter out dirs from a list is now written in portable perl
. link to modules in REQ explicitly
This commit is contained in:
@@ -119,6 +119,18 @@ define uniq
|
|||||||
$(foreach _,$1,$(if $(filter $_,${seen}),,$(eval seen += $_))) \
|
$(foreach _,$1,$(if $(filter $_,${seen}),,$(eval seen += $_))) \
|
||||||
${seen}
|
${seen}
|
||||||
endef
|
endef
|
||||||
|
# Function that removes directories from list
|
||||||
|
define filter_out_dir
|
||||||
|
$(shell perl -e 'foreach my $$x (qw($1)) {if(-f "$$x") {print "$$x "}}')
|
||||||
|
endef
|
||||||
|
# Function that retains the certian portion of the header file path
|
||||||
|
# and then used as the subdirectory inside INSTALL_INCLUDE
|
||||||
|
# param 1 - list of header files, "src/os/Linux/jconfig.h src/pv.h src/os/default/jpeglib.h"
|
||||||
|
# param 2 - pattern "os/${OS_CLASS}/|os/default/"
|
||||||
|
# return - file path with pattern retained, "os/Linux/jconfig.h pv.h os/default/jpeglib.h"
|
||||||
|
define os_include_dir
|
||||||
|
$(shell perl -e 'use File::Basename;foreach my $$x (qw($1)) { if ($$x =~ m[($2)(.*)]) {print "$$1$$2 ";} else {print(basename("$$x")," ");}}')
|
||||||
|
endef
|
||||||
|
|
||||||
ifndef EPICSVERSION
|
ifndef EPICSVERSION
|
||||||
## RUN 1
|
## RUN 1
|
||||||
@@ -340,7 +352,6 @@ CMPLR=STD
|
|||||||
GCC_STD = $(GCC)
|
GCC_STD = $(GCC)
|
||||||
CXXCMPLR=ANSI
|
CXXCMPLR=ANSI
|
||||||
G++_ANSI = $(G++) -ansi
|
G++_ANSI = $(G++) -ansi
|
||||||
OBJ=.o
|
|
||||||
|
|
||||||
ifndef T_A
|
ifndef T_A
|
||||||
## RUN 2
|
## RUN 2
|
||||||
@@ -376,19 +387,19 @@ HDRS = ${RECORDS:%=${COMMON_DIR}/%.h} ${MENUS:%=${COMMON_DIR}/%.h}
|
|||||||
HDRSX = ${HEADERS}
|
HDRSX = ${HEADERS}
|
||||||
HDRSX += ${HEADERS_${EPICS_BASETYPE}}
|
HDRSX += ${HEADERS_${EPICS_BASETYPE}}
|
||||||
HDRSX += ${HEADERS_${EPICSVERSION}}
|
HDRSX += ${HEADERS_${EPICSVERSION}}
|
||||||
HDRS += $(filter-out $(realpath ${HDRSX:%=%/}),$(realpath ${HDRSX}))
|
HDRS += $(call filter_out_dir,$(realpath ${HDRSX}))
|
||||||
export HDRS
|
export HDRS
|
||||||
|
|
||||||
TEMPLSX = $(if ${TEMPLATES},$(filter-out -none-,${TEMPLATES}),$(wildcard *.template *.db *.subs))
|
TEMPLSX = $(if ${TEMPLATES},$(filter-out -none-,${TEMPLATES}),$(wildcard *.template *.db *.subs))
|
||||||
TEMPLSX += ${TEMPLATES_${EPICS_BASETYPE}}
|
TEMPLSX += ${TEMPLATES_${EPICS_BASETYPE}}
|
||||||
TEMPLSX += ${TEMPLATES_${EPICSVERSION}}
|
TEMPLSX += ${TEMPLATES_${EPICSVERSION}}
|
||||||
TEMPLS = $(filter-out $(realpath ${TEMPLSX:%=%/}),$(realpath ${TEMPLSX}))
|
TEMPLS = $(call filter_out_dir,$(realpath ${TEMPLSX}))
|
||||||
export TEMPLS
|
export TEMPLS
|
||||||
|
|
||||||
SCRX = $(if ${SCRIPTS},$(filter-out -none-,${SCRIPTS}),$(wildcard *.cmd *.iocsh))
|
SCRX = $(if ${SCRIPTS},$(filter-out -none-,${SCRIPTS}),$(wildcard *.cmd *.iocsh))
|
||||||
SCRX += ${SCRIPTS_${EPICS_BASETYPE}}
|
SCRX += ${SCRIPTS_${EPICS_BASETYPE}}
|
||||||
SCRX += ${SCRIPTS_${EPICSVERSION}}
|
SCRX += ${SCRIPTS_${EPICSVERSION}}
|
||||||
SCR = $(filter-out $(realpath ${SCRX:%=%/}),$(realpath ${SCRX}))
|
SCR = $(call filter_out_dir,$(realpath ${SCRX}))
|
||||||
export SCR
|
export SCR
|
||||||
|
|
||||||
DOCUDIR = .
|
DOCUDIR = .
|
||||||
@@ -511,6 +522,8 @@ define ADD_OTHER_MODULE_INCLUDES
|
|||||||
$(eval $(1)_VERSION = $(patsubst ${EPICS_MODULES}/$(1)/%/R${EPICSVERSION}/lib/$(T_A)/,%,$(firstword $(shell ls -dvr ${EPICS_MODULES}/$(1)/+([0-9]).+([0-9]).+([0-9])/R${EPICSVERSION}/lib/$(T_A)/ 2>/dev/null))))
|
$(eval $(1)_VERSION = $(patsubst ${EPICS_MODULES}/$(1)/%/R${EPICSVERSION}/lib/$(T_A)/,%,$(firstword $(shell ls -dvr ${EPICS_MODULES}/$(1)/+([0-9]).+([0-9]).+([0-9])/R${EPICSVERSION}/lib/$(T_A)/ 2>/dev/null))))
|
||||||
export $(1)_VERSION
|
export $(1)_VERSION
|
||||||
OTHER_MODULE_INCLUDES += $$(addprefix -I,$$(firstword $$(shell ls -dvr ${EPICS_MODULES}/$(1)/$$(strip $$($(1)_VERSION))*(.+([0-9]))/R${EPICSVERSION}/include 2>/dev/null)))
|
OTHER_MODULE_INCLUDES += $$(addprefix -I,$$(firstword $$(shell ls -dvr ${EPICS_MODULES}/$(1)/$$(strip $$($(1)_VERSION))*(.+([0-9]))/R${EPICSVERSION}/include 2>/dev/null)))
|
||||||
|
OTHER_MODULE_INCLUDES += $$(addprefix -I,$$(firstword $$(shell ls -dvr ${EPICS_MODULES}/$(1)/$$(strip $$($(1)_VERSION))*(.+([0-9]))/R${EPICSVERSION}/include/os/default 2>/dev/null)))
|
||||||
|
OTHER_MODULE_INCLUDES += $$(addprefix -I,$$(firstword $$(shell ls -dvr ${EPICS_MODULES}/$(1)/$$(strip $$($(1)_VERSION))*(.+([0-9]))/R${EPICSVERSION}/include/os/${OS_CLASS} 2>/dev/null)))
|
||||||
endef
|
endef
|
||||||
$(eval $(foreach m,$(filter-out $(PRJ) $(IGNORE_MODULES),$(notdir $(wildcard ${EPICS_MODULES}/*))),$(call ADD_OTHER_MODULE_INCLUDES,$m)))
|
$(eval $(foreach m,$(filter-out $(PRJ) $(IGNORE_MODULES),$(notdir $(wildcard ${EPICS_MODULES}/*))),$(call ADD_OTHER_MODULE_INCLUDES,$m)))
|
||||||
# Include path for old style modules.
|
# Include path for old style modules.
|
||||||
@@ -661,7 +674,7 @@ endif
|
|||||||
|
|
||||||
# Handle registry stuff automagically if we have a dbd file.
|
# Handle registry stuff automagically if we have a dbd file.
|
||||||
# See ${REGISTRYFILE} and ${EXPORTFILE} rules below.
|
# See ${REGISTRYFILE} and ${EXPORTFILE} rules below.
|
||||||
LIBOBJS += $(if $(MODULEDBD), $(addsuffix $(OBJ),$(basename ${REGISTRYFILE} ${EXPORTFILE})))
|
LIBOBJS += $(if $(MODULEDBD), $(addsuffix $(OBJ),$(basename ${REGISTRYFILE} $(if $(filter WIN32,${OS_CLASS}),,${EXPORTFILE}))))
|
||||||
|
|
||||||
ifdef BASE_3_16
|
ifdef BASE_3_16
|
||||||
# Suppress "'rset' is deprecated" warning for old drivers
|
# Suppress "'rset' is deprecated" warning for old drivers
|
||||||
@@ -716,9 +729,11 @@ HDEPENDS_COMPFLAGS = -c
|
|||||||
CPPFLAGS += -MD
|
CPPFLAGS += -MD
|
||||||
else
|
else
|
||||||
ifdef HDEPENDS
|
ifdef HDEPENDS
|
||||||
|
ifneq (${OS_CLASS},WIN32)
|
||||||
CPPFLAGS += -MMD
|
CPPFLAGS += -MMD
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
-include *.d
|
-include *.d
|
||||||
|
|
||||||
# Need to find source dbd files relative to one dir up but generated dbd files in this dir.
|
# Need to find source dbd files relative to one dir up but generated dbd files in this dir.
|
||||||
@@ -819,6 +834,11 @@ INSTALL_LOADABLE_SHRLIBS=
|
|||||||
INSTALL_MUNCHS=
|
INSTALL_MUNCHS=
|
||||||
include ${BASERULES}
|
include ${BASERULES}
|
||||||
|
|
||||||
|
ifeq (${OS_CLASS},WIN32) # explicitly link required dependencies
|
||||||
|
LIB_LIBS += ${EPICS_BASE_IOC_LIBS} ${REQ}
|
||||||
|
endif
|
||||||
|
SHRLIB_SEARCH_DIRS += ${EPICS_BASE}/lib/${T_A}
|
||||||
|
$(foreach m,${REQ},$(eval ${m}_DIR=${EPICS_MODULES}/${m}/${${m}_VERSION}/R${EPICSVERSION}/lib/${T_A}))
|
||||||
# restore overwritten commands
|
# restore overwritten commands
|
||||||
MKDIR = mkdir -p -m 775
|
MKDIR = mkdir -p -m 775
|
||||||
# Fix incompatible release rules.
|
# Fix incompatible release rules.
|
||||||
@@ -864,9 +884,12 @@ ${MODULEDBD}: ${DBDFILES}
|
|||||||
|
|
||||||
# Install everything.
|
# Install everything.
|
||||||
INSTALL_LIBS = $(addprefix ${INSTALL_LIB}/,${MODULELIB} $(notdir ${SHRLIBS}))
|
INSTALL_LIBS = $(addprefix ${INSTALL_LIB}/,${MODULELIB} $(notdir ${SHRLIBS}))
|
||||||
|
ifeq (${OS_CLASS},WIN32) # .lib for WIN32 is also required for linking
|
||||||
|
INSTALL_LIBS += $(addprefix ${INSTALL_LIB}/,${LIB_PREFIX}${PRJ}${LIB_SUFFIX})
|
||||||
|
endif
|
||||||
INSTALL_DEPS = ${DEPFILE:%=${INSTALL_LIB}/%}
|
INSTALL_DEPS = ${DEPFILE:%=${INSTALL_LIB}/%}
|
||||||
INSTALL_DBDS = ${MODULEDBD:%=${INSTALL_DBD}/%}
|
INSTALL_DBDS = ${MODULEDBD:%=${INSTALL_DBD}/%}
|
||||||
INSTALL_HDRS = $(addprefix ${INSTALL_INCLUDE}/,$(notdir ${HDRS}))
|
INSTALL_HDRS = $(addprefix ${INSTALL_INCLUDE}/,$(call os_include_dir,${HDRS},os/default/|os/${OS_CLASS}/))
|
||||||
INSTALL_DBS = $(addprefix ${INSTALL_DB}/,$(notdir ${TEMPLS}))
|
INSTALL_DBS = $(addprefix ${INSTALL_DB}/,$(notdir ${TEMPLS}))
|
||||||
INSTALL_SCRS = $(addprefix ${INSTALL_SCR}/,$(notdir ${SCR}))
|
INSTALL_SCRS = $(addprefix ${INSTALL_SCR}/,$(notdir ${SCR}))
|
||||||
INSTALL_BINS = $(addprefix ${INSTALL_BIN}/,$(notdir ${BINS}))
|
INSTALL_BINS = $(addprefix ${INSTALL_BIN}/,$(notdir ${BINS}))
|
||||||
@@ -1012,7 +1035,8 @@ MUNCH=$(MUNCH_$(VXWORKS_MAJOR_VERSION))
|
|||||||
$(MUNCH) < $< > $@
|
$(MUNCH) < $< > $@
|
||||||
|
|
||||||
${VERSIONFILE}:
|
${VERSIONFILE}:
|
||||||
echo "char _${PRJ}LibRelease[] = \"${LIBVERSION}\";" >> $@
|
echo "#include <epicsExport.h>" >> $@
|
||||||
|
echo "epicsShareExtern char _${PRJ}LibRelease[] = \"${LIBVERSION}\";" >> $@
|
||||||
|
|
||||||
# EPICS R3.14+:
|
# EPICS R3.14+:
|
||||||
# Create file to fill registry from dbd file.
|
# Create file to fill registry from dbd file.
|
||||||
|
|||||||
Reference in New Issue
Block a user