TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#=============================

#=====================================================
# Path to "NON EPICS" External PACKAGES: USER INCLUDES
#======================================================

# Support needed for ethercat
USR_INCLUDES += $(ZLIB_INCLUDE)
USR_INCLUDES += $(XZ_INCLUDE)
USR_INCLUDES += $(LIBXML2_INCLUDE)

# Support Perl C regular expression library
USR_INCLUDES += $(PCRE_INCLUDE)

# Support for CPSW
USR_INCLUDES = -I$(BOOST_INCLUDE) -I$(CPSW_FRAMEWORK_INCLUDE) -I$(YAML_INCLUDE)
#=====================================================

#======================================================
# PATH TO "NON EPICS" EXTERNAL PACKAGES: USER LIBRARIES
#======================================================
# Support for CPSW
cpsw_DIR = $(CPSW_FRAMEWORK_LIB)
boost_system_DIR = $(BOOST_LIB)
yaml-cpp_DIR = $(YAML_LIB)

# Location of pcre support used by streamdevice
pcre_DIR = $(PCRE_LIB)

# =====================================================
 
# ======================================================
# LINK "NON EPICS" EXTERNAL PACKAGE LIBRARIES STATICALLY
#=======================================================

USR_LIBS_Linux += cpsw boost_system yaml-cpp pcre
#======================================================
 

# ================================================
# Build the IOC application
# ================================================
# This will attempt to build an IOC application 
# for every target including the host computer.
PROD_NAME = masterSource
PROD_IOC = $(PROD_NAME)

# $(PROD_NAME).dbd will be created and installed
DBD += $(PROD_NAME).dbd

# $(PROD_NAME).dbd will be made up from these files:
$(PROD_NAME)_DBD += base.dbd
$(PROD_NAME)_DBD += devIocStats.dbd
$(PROD_NAME)_DBD += asSupport.dbd
# Include dbd files from all support applications:
$(PROD_NAME)_DBD += asyn.dbd
#$(PROD_NAME)_DBD += asynRecord.dbd
$(PROD_NAME)_DBD += drvAsynIPPort.dbd
$(PROD_NAME)_DBD += drvAsynSerialPort.dbd
$(PROD_NAME)_DBD += modbusSupport.dbd
$(PROD_NAME)_DBD += stream.dbd
$(PROD_NAME)_DBD += caPutLog.dbd
#$(PROD_NAME)_DBD += $(CEXP_DBDS)

# ycpswasyn and yamlLoader 
$(PROD_NAME)_DBD += ycpswasyn.dbd
$(PROD_NAME)_DBD += yamlLoader.dbd

# Beckhoff
$(PROD_NAME)_DBD += drvBkhAsyn.dbd

# data conversion for SIM module
$(PROD_NAME)_DBD += dataConversion.dbd
$(PROD_NAME)_DBD += ledConversion.dbd
$(PROD_NAME)_DBD += procRingBuffer.dbd
$(PROD_NAME)_DBD += ringBuffSave.dbd
$(PROD_NAME)_DBD += ringBuffSave2.dbd
$(PROD_NAME)_DBD += prlAmp.dbd


# ================================================================================
# The system command will be mainly used by linux hosted IOCs
# Very useful for changing kernel thread priorities for kernel drivers
# ================================================================================
$(PROD_NAME)_DBD += system.dbd
# ======================================================================
 
# $(PROD_NAME)_registerRecordDeviceDriver.cpp derives from $(PROD_NAME).dbd
$(PROD_NAME)_SRCS += $(PROD_NAME)_registerRecordDeviceDriver.cpp

$(PROD_NAME)_SRCS += dataConversion.c
$(PROD_NAME)_SRCS += ledConversion.c
$(PROD_NAME)_SRCS += procRingBuffer.c
$(PROD_NAME)_SRCS += ringBuffSave.stt
$(PROD_NAME)_SRCS += ringBuffSave2.stt
$(PROD_NAME)_SRCS += prlAmp.st

# Build the main IOC entry point on workstation OSs.
$(PROD_NAME)_SRCS_DEFAULT += $(PROD_NAME)Main.cpp
$(PROD_NAME)_SRCS_vxWorks += -nil-

# =====================================================
# # Link in the libraries from other EPICS modules
# # =====================================================
$(PROD_NAME)_LIBS += yamlLoader
$(PROD_NAME)_LIBS += ycpswasyn
$(PROD_NAME)_LIBS += seq pv

# Beckhoff
$(PROD_NAME)_LIBS += bkhAsyn

# Needed to link in iocAdmin support
$(PROD_NAME)_LIBS += devIocStats

# Needed to link in autosave support
$(PROD_NAME)_LIBS += autosave

# Needed to link caPutLog support
$(PROD_NAME)_LIBS += caPutLog

# Needed to link cexpsh() support
#$(PROD_NAME)_LIBS += $(CEXP_LIBS)

# Add support for streamdevice
$(PROD_NAME)_LIBS += stream

# Modbus
$(PROD_NAME)_LIBS += modbus

# Link Asyn library support.
# Should be last for othe modules that depend on asyn
$(PROD_NAME)_LIBS += asyn

$(PROD_NAME)_LIBS += seq pv

 
# Add support from base/src/vxWorks if needed
#$(PROD_NAME)_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary

# Finally link to the EPICS Base libraries
$(PROD_NAME)_LIBS += $(EPICS_BASE_IOC_LIBS)

#===========================

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

