TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#========================================
# =====================================================
# Path to "NON EPICS" External PACKAGES: USER INCLUDES
#======================================================
USR_INCLUDES += $(ZLIB_INCLUDE)
USR_INCLUDES += $(XZ_INCLUDE)
USR_INCLUDES += $(LIBXML2_INCLUDE)
USR_INCLUDES += $(PCRE_INCLUDE)
# =====================================================

##======================================================
# PATH TO "NON EPICS" EXTERNAL PACKAGES: USER LIBRARIES
#======================================================
z_DIR = $(ZLIB_LIB)
lzma_DIR = $(XZ_LIB)
xml2_DIR = $(LIBXML2_LIB)
pcre_DIR = $(PCRE_LIB)
# =====================================================

# ======================================================
# LINK "NON EPICS" EXTERNAL PACKAGE LIBRARIES STATICALLY
#=======================================================
# Needed for static build (using cram)
# USR_SYS_LIBS += pcre
USR_LIBS_Linux += xml2 z lzma pcre
# ======================================================

# ================================================
# Build the IOC application
# ================================================
# This will attempt to build an IOC application 
# for every target including the host computer.
PROD_IOC = tuner

tuner_INCLUDES += $(ECASYN)/include

# tuner.dbd will be created and installed
DBD += tuner.dbd

# tuner.dbd will be made up from these files:
tuner_DBD += base.dbd
tuner_DBD += asyn.dbd
tuner_DBD += asynRecord.dbd

# Required for stream.dbd
# Note: in R3-14-12 aaiRecord and aaoRecord
# are included in base.dbd
tuner_DBD += drvAsynSerialPort.dbd
tuner_DBD += drvAsynIPPort.dbd
tuner_DBD += stream.dbd 

# Required for EtherCAT
tuner_DBD += ecAsyn.dbd
tuner_DBD += motorRecord.dbd
tuner_DBD += motorSupport.dbd
tuner_DBD += EtherCATMotorSupport.dbd

tuner_DBD += devIocStats.dbd
ifdef CAPUTLOG
tuner_DBD += caPutLog.dbd
endif
ifdef CEXP
tuner_DBD += $(CEXP_DBDS)
endif

tuner_DBD += autosaveSupport.dbd

ifdef RESTORE
tuner_DBD += dbRestore.dbd
endif
# ================================================================================
# The system command will be mainly used by linux hosted IOCs
# Very useful for changing kernel thread priorities for kernel drivers
# ================================================================================
tuner_DBD += system.dbd

# ======================================================================
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
tuner_SRCS += tuner_registerRecordDeviceDriver.cpp

tuner_SRCS_DEFAULT += tunerMain.cpp

tuner_SRCS_vxWorks += -nil-

# ========================================================================
# ========================================================================
# Add locally compiled object code
# For example, subroutines
# ========================================================================
# tuner_SRCS += file1.c
# tuner_SRCS += file2.c

# =====================================================
# Link in the code from other libraries
# =====================================================
# Required for EtherCAT
tuner_LIBS += ecAsyn 
tuner_LIBS += motor
tuner_LIBS += EtherCATMotor
# streams
tuner_LIBS += asyn
tuner_LIBS += stream
# scanner software
tuner_LIBS += rtutils scannerlib

tuner_INCLUDES += $(ECASYN)/include
# Needed to link in iocAdmin support
tuner_LIBS += devIocStats

ifdef RESTORE
tuner_LIBS += restore
endif

# Needed to link in autosave support
tuner_LIBS += autosave

# Needed to link caPutLog support
ifdef CAPUTLOG
tuner_LIBS += caPutLog
endif

# Needed to link cexpsh() support
ifdef CEXP
tuner_LIBS += $(CEXP_LIBS)
endif

# This library must come after mrfVme64x
USR_LIBS  += autosave

tuner_LIBS += $(EPICS_BASE_IOC_LIBS)

# ==================================================
# Install external epics executable
# Install scanner program from Ethercat epics module
#===================================================
BIN_INSTALLS += $(ECASYN_BIN)/scanner

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

