TOP=../..

include $(TOP)/configure/CONFIG
#=====================================================
# Path to "NON EPICS" External PACKAGES: USER INCLUDES
#======================================================
# Support for CPSW
USR_INCLUDES += -I$(BOOST_INCLUDE)
USR_INCLUDES += -I$(CPSW_FRAMEWORK_INCLUDE)
USR_INCLUDES += -I$(YAML_INCLUDE)

# KLYSTRON Library API
USR_INCLUDES += -I$(KLYSTRON_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)

# Support for MR KLYSTRON Library (i.e. API)
KlystronLib_DIR = $(KLYSTRON_LIB)

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

# ================================================
# Begin adding EPICS packages
# ================================================

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

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

# Klystron.dbd will be made up from these files:
Klystron_DBD += base.dbd
Klystron_DBD += devIocStats.dbd
Klystron_DBD += asSupport.dbd
Klystron_DBD += caPutLog.dbd
Klystron_DBD += cpswKlystronAsynDriver.dbd
Klystron_DBD += KlystronAsynDriver.dbd
Klystron_DBD += registerTimeStampSource.dbd
Klystron_DBD += sncKlystronInterlock.dbd
Klystron_DBD += KlystronWindowProc.dbd
Klystron_DBD += KlystronStatus.dbd
Klystron_DBD += rssiConnectionMonitor.dbd
Klystron_DBD += $(CEXP_DBDS)
Klystron_DBD += yamlLoader.dbd
Klystron_DBD += ycpswasyn.dbd
# ================================================================================
# The system command will be mainly used by linux hosted IOCs
# Very useful for changing kernel thread priorities for kernel drivers
# ================================================================================
Klystron_DBD += system.dbd
Klystron_DBD += asyn.dbd
#Klystron_DBD += bsaAsynDriver.dbd

# ======================================================================
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
Klystron_SRCS += Klystron_registerRecordDeviceDriver.cpp

Klystron_SRCS += registerTimeStampSource.c

Klystron_SRCS += streamDispatch.c
Klystron_SRCS += streamDataProc.c
Klystron_SRCS += KlystronDataProc.c

Klystron_SRCS += KlystronWindowProc.c

Klystron_SRCS += cpswKlystronAsynDriver.cpp
Klystron_SRCS += cpswKlystronParamSetup.cpp
Klystron_SRCS += cpswKlystronDefaultSetup.cpp
Klystron_SRCS += cpswKlystronRtmInterlock.cpp

Klystron_SRCS += KlystronAsynDriver.cpp
Klystron_SRCS += KlystronParamSetup.cpp


#Klystron_SRCS += KlystronSequencer.cpp
#Klystron_SRCS += KlystronBsaEdef.cpp

#Klystron_SRCS += bsaAsynDriver.cpp

Klystron_SRCS_DEFAULT += KlystronMain.cpp

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

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

Klystron_LIBS += asyn

# Needed to link in iocAdmin support
Klystron_LIBS += devIocStats

# Needed to link in autosave support
Klystron_LIBS += autosave

# Needed to link caPutLog support
Klystron_LIBS += caPutLog

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

# Needed to link yamlLoader support
Klystron_LIBS += yamlLoader

Klystron_LIBS += ycpswasyn

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

ifneq ($(SNCSEQ),)
    # This builds sncExample as a component of Klystron
    Klystron_SNCFLAGS += +r
#    Klystron_DBD += sncExample.dbd
    Klystron_SRCS += sncKlystronInterlock.stt
    Klystron_SRCS += StatusPVs.st
    Klystron_SRCS += DSTA.st
    Klystron_SRCS += PIOPDISP.st
    Klystron_SRCS += rssiConnectionMonitor.stt
    Klystron_LIBS += seq pv
    Klystron_LIBS += seqCar
endif

Klystron_LIBS += $(EPICS_BASE_IOC_LIBS)

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

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

