TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#========================================
INCLUDES += $(BOOST_INCLUDE)
INCLUDES += $(CPSW_INCLUDE)
INCLUDES += $(YAMLCPP_INCLUDE)
INCLUDES += $(LLRF_INCLUDE)
#LIBS     += -L $(TPG_LIB)

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

# Use the following for RTEMS Only IOCs
#PROD_IOC_RTEMS = llrf

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

# llrf.dbd will be made up from these files:
llrf_DBD += base.dbd
llrf_DBD += devIocStats.dbd
llrf_DBD += autosaveSupport.dbd
llrf_DBD += caPutLog.dbd
llrf_DBD += llrfAsynDriver.dbd
llrf_DBD += mrLlrfAsynDriver.dbd
llrf_DBD += registerTimeStampSource.dbd
llrf_DBD += sncLlrfInterlock.dbd
llrf_DBD += $(CEXP_DBDS)

# ================================================================================
# The system command will be mainly used by linux hosted IOCs
# Very useful for changing kernel thread priorities for kernel drivers
# ================================================================================
llrf_DBD += system.dbd
llrf_DBD += asyn.dbd
#llrf_DBD += llrfAsynDriver.dbd
#llrf_DBD += bsaAsynDriver.dbd

# If you don't have an EVR comment the following two lines:
#llrf_DBD += evrSupport.dbd
#llrf_DBD += devMrfEr.dbd

# ======================================================================
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
llrf_SRCS += llrf_registerRecordDeviceDriver.cpp

PROD_LIB = cpswLlrfAsyn

llrf_SRCS += registerTimeStampSource.c

llrf_SRCS += streamDispatch.c
llrf_SRCS += streamDataProc.c
llrf_SRCS += mrLlrfDataProc.c

llrf_SRCS += cpswLlrfAsynDriver.cpp
llrf_SRCS += cpswLlrfParamSetup.cpp
llrf_SRCS += cpswLlrfDefaultSetup.cpp
llrf_SRCS += cpswLlrfRtmInterlock.cpp

llrf_SRCS += mrLlrfAsynDriver.cpp
llrf_SRCS += mrLlrfParamSetup.cpp



#llrf_SRCS += llrfAsynDriver.cpp
#llrf_SRCS += llrfSequencer.cpp
#llrf_SRCS += llrfBsaEdef.cpp

#llrf_SRCS += bsaAsynDriver.cpp

llrf_SRCS_DEFAULT += llrfMain.cpp

llrf_SRCS_vxWorks += -nil-

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

# =====================================================
# Link in the code from other libraries
# =====================================================
#
#
#

llrf_LIBS += asyn


llrf_DIR = $(LLRF_LIB)
llrf_LIBS += llrf

boost_system_DIR = $(BOOST_LIB)
llrf_LIBS += boost_system

cpsw_DIR = $(CPSW_LIB)
llrf_LIBS += cpsw

yaml-cpp_DIR  += $(YAMLCPP_LIB)
llrf_LIBS += yaml-cpp

#llrf_LIBS += asyn

# Needed to link in iocAdmin support
llrf_LIBS += devIocStats

# Needed to link in autosave support
llrf_LIBS += autosave

# Needed to link caPutLog support
llrf_LIBS += caPutLog

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




# =============================================
# Begin to link in the EVR support for
# RTEMS, linux, and linuxRT
# If you don't have an EVR, you can comment out 
# the lines below.
# =============================================
# llrf_LIBS += evrSupport
# llrf_LIBS += devMrfEr

ifneq ($(T_A),linuxRT-x86)
  ifneq ($(T_A),linuxRT-x86_64)
   ifneq ($(T_A),linuxRT_glibc-x86_64)
    ifneq ($(T_A),linux-x86)
      ifneq ($(T_A),linux-x86_64)
#       llrf_LIBS += mrfVme64x
      endif
    endif
  endif
 endif
endif

 ifeq ($(T_A),linuxRT-x86)
#  llrf_LIBS += drvMrf
 endif

 ifeq ($(T_A),linuxRT-x86_64)
#  llrf_LIBS += drvMrf
 endif
 
 ifeq ($(T_A),linuxRT_glibc-x86_64)
#  llrf_LIBS += drvMrf
 endif

 ifeq ($(T_A),linux-x86)
#  llrf_LIBS += drvMrf
 endif

 ifeq ($(T_A),linux-x86_64)
#  llrf_LIBS += drvMrf
 endif
# =====================================================
# END EVR libraries
# =====================================================

# NOTE: To build SNL programs, SNCSEQ must be defined
# in the <top>/configure/RELEASE file

ifneq ($(SNCSEQ),)
    # This builds sncExample as a component of llrf
    llrf_SNCFLAGS += +r
#    llrf_DBD += sncExample.dbd
    llrf_SRCS += sncLlrfInterlock.stt
    llrf_LIBS += seq pv

    # The following builds sncProgram as a standalone application
  ifneq ($(T_A),linuxRT-x86)
#    PROD_HOST += sncProgram
    sncProgram_SNCFLAGS += +m
    sncProgram_SRCS += sncProgram.st
    sncProgram_LIBS += seq pv
    sncProgram_LIBS += $(EPICS_BASE_HOST_LIBS)
  endif
endif

llrf_LIBS += $(EPICS_BASE_IOC_LIBS)

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

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

