TOP=../..

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

# ================================================
# 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 += asyn.dbd
llrf_DBD += ycpswasyn.dbd
llrf_DBD += yamlLoader.dbd
llrf_DBD += devIocStats.dbd

ifdef CAPUTLOG
llrf_DBD += caPutLog.dbd
endif

ifdef CEXP
llrf_DBD += $(CEXP_DBDS)
endif

llrf_DBD += autosaveSupport.dbd

ifdef RESTORE
llrf_DBD += dbRestore.dbd
endif

llrf_DBD += llrfSupport.dbd

# ================================================================================
# 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

# 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

llrf_SRCS_DEFAULT += llrfMain.cpp

llrf_SRCS_vxWorks += -nil-

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

# =====================================================
# Link in the code from other libraries
# =====================================================
llrf_LIBS += yamlLoader
llrf_LIBS += ycpswasyn
llrf_LIBS += asyn
llrf_LIBS += seq pv

# Needed to link in iocAdmin support
llrf_LIBS += devIocStats

ifdef RESTORE
llrf_LIBS += restore
endif

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

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

# Needed to link in autosave support
# This library must come after mrfVme64x
USR_LIBS += autosave

# =====================================================
# Path to "NON EPICS" External PACKAGES: USER INCLUDES
#======================================================
USR_INCLUDES = -I$(BOOST_INCLUDE) -I$(CPSW_FRAMEWORK_INCLUDE) -I$(YAML_INCLUDE)
# =====================================================

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

# ======================================================
# LINK "NON EPICS" EXTERNAL PACKAGE LIBRARIES STATICALLY
#=======================================================
USR_LIBS_Linux += cpsw boost_system yaml-cpp
# ======================================================

# =============================================
# 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 += sncExample.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

