#==============================================================
#
#  Abs:  Makefile to build IOC Application
#
#  Name: Makefile
#
#  Facility: EED Temperature Controls
#
#  Auth: 09-Mar-2007, Stephen Schuh   (SCHUHS)
#  Rev:  dd-mmm-yyyy, First Lastname  (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        23-Oct-2019, N. Balakrishnan (NAMRATA):
#          add PVAServerRegister.dbd fpr qsrv support
#        21-Oct-2019, K. Luchini      (LUCHINI):
#          add modbus for XTA
#        14-Oct-2019, K. Luchini      (LUCHINI):
#          upgrade to epics V7 
#          merge abTemp,snmpTemp,bkhf into tempSoft
#          comment out snmp for now as it doesn't build
#        05-Jul-2007, A. Alarcon       (ALARCON)
#          Deleted references to cmlog
#==============================================================
#
TOP=../..
include $(TOP)/configure/CONFIG

#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#========================================
#
USR_LDFLAGS_Linux  += -L$(NET_SNMP_LIB)
USR_CFLAGS_Linux   += $(shell $(NET_SNMP_TOP)/$(EPICS_HOST_ARCH)/bin/net-snmp-config --cflags)

# =====================================================
# Path to "NON EPICS" External PACKAGES: USER INCLUDES
# ======================================================
# Support Perl C regular expression library
USR_INCLUDES += -I$(NET_SNMP_INCLUDE)
USR_INCLUDES += -I$(STREAMDEVICE)/src
# Used by streamdevice
USR_INCLUDES += -I$(PCRE_INCLUDE)

# ======================================================
# PATH TO "NON EPICS" EXTERNAL PACKAGES: USER LIBRARIES
# ======================================================
# Used by streamdevice
pcre_DIR     = $(PCRE_LIB)
netsnmp_DIR  = $(NET_SNMP_LIB)

# ======================================================
# LINK "NON EPICS" EXTERNAL PACKAGE LIBRARIES STATICALLY
# =======================================================
# Used by streamdevice
USR_LIBS_Linux += pcre

# =============================
# build application object
# =============================
PROD_IOC_RTEMS = temp
PROD_IOC_Linux = tempSoft

# Build the ioc database
DBD += temp.dbd tempSoft.dbd
TEMP_DBD_Linux += base.dbd
TEMP_DBD_Linux += iocAdmin.dbd
TEMP_DBD_Linux += asSupport.dbd
TEMP_DBD_Linux += caPutLog.dbd
TEMP_DBD_Linux += ether_ip.dbd
TEMP_DBD_Linux += ModBusTCPClnt.dbd
TEMP_DBD_Linux += Bk9000_MBT.dbd
TEMP_DBD_Linux += modbusSupport.dbd
TEMP_DBD_Linux += calcSupport.dbd
TEMP_DBD_Linux += analogSub.dbd
TEMP_DBD_Linux += qsrv.dbd
TEMP_DBD_Linux += PVAServerRegister.dbd
TEMP_DBD_Linux += tempSubPoly.dbd
TEMP_DBD_Linux += tempDlwgLimits.dbd

# streams
# Note: aai and aao now included base.dbd
TEMP_DBD_Linux += asyn.dbd
TEMP_DBD_Linux += stream.dbd
TEMP_DBD_Linux += drvAsynIPPort.dbd

# For devlib2
TEMP_DBD_RTEMS += epicsvme.dbd

# For rtems utilities includeing spy
TEMP_DBD_RTEMS += spy.dbd
TEMP_DBD_RTEMS += rtemsUtilsSup.dbd

# For IPAC VME
TEMP_DBD_RTEMS += vmeCardRecord.dbd
TEMP_DBD_RTEMS += devVSAM.dbd
TEMP_DBD_RTEMS += devVSAMCard.dbd

# Rtems dbd
temp_DBD       += $(TEMP_DBD_Linux) $(TEMP_DBD_RTEMS)

# Linux dbd
tempSoft_DBD   += $(TEMP_DBD_Linux) system.dbd devSnmp.dbd

# Build the main IOC entry point on workstation OS.
USR_SRCS_DEFAULT   += tempMain.cpp
temp_SRCS          += temp_registerRecordDeviceDriver.cpp
tempSoft_SRCS      += tempSoft_registerRecordDeviceDriver.cpp
temp_SRCS_vxWorks  += -nil-

# Custom streamdevice decoding
tempSoft_SRCS  += snmpRegister.cpp
tempSoft_SRCS  += snmpSessShow.c
tempSoft_SRCS  += devSnmp.cpp
USR_SRCS        += tempPolynomial.c

# The following adds support from base/src/vxWorks
temp_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary

# Add libraries to application
TEMP_LIBS_Linux += devIocStats
TEMP_LIBS_Linux += autosave
TEMP_LIBS_Linux += caPutLog
TEMP_LIBS_Linux += ether_ip
TEMP_LIBS_Linux += netsnmp
TEMP_LIBS_Linux += Bk9000_MBT
TEMP_LIBS_Linux += ModBusTCPClnt
TEMP_LIBS_Linux += modbus
TEMP_LIBS_Linux += calc
TEMP_LIBS_Linux += sscan
TEMP_LIBS_Linux += qsrv

# streams
TEMP_LIBS_Linux += asyn
TEMP_LIBS_Linux += stream
TEMP_LIBS_Linux += sscan

tempSoft_LIBS   += $(TEMP_LIBS_Linux) 

temp_LIBS_RTEMS += $(filter-out netsnmp, $(TEMP_LIBS_Linux))
temp_LIBS_RTEMS += epicsvme
temp_LIBS_RTEMS += rtemsutils
temp_LIBS_RTEMS += vsam
temp_LIBS_RTEMS += vmeCardRecord

# Build SNL programs
# NOTE: to build SLN programs, SNCSEQ must be defined
# in the <top>/configure/RELEASE file
ifneq ($(SNCSEQ),)
  TEMP_DBD_Linux   += devSeqCar.dbd
  USR_SRCS         += tempDlwgLimits.stt
  USR_LIBS         += seqCar seq pv
endif

# Needed for stream device
USR_LIBS_RTEMS     += $(CEXP_LIBS)
USR_SYS_LIBS_RTEMS += $(CEXP_SYS_LIBS)
USR_LIBS           += $(EPICS_BASE_IOC_LIBS)
USR_LIBS           += $(EPICS_BASE_PVA_CORE_LIBS)

#========================================
include $(TOP)/configure/RULES
#----------------------------------------
#  ADD RULES AFTER THIS LINE

# End of file


