TOP=../..

include $(TOP)/configure/CONFIG

USR_CXXFLAGS += -std=c++0x
USR_CXXFLAGS += -DHAVE_YAML
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#========================================
INCLUDES += -I$(TPG_INCLUDE)
INCLUDES += -I$(BSA_INCLUDE)
INCLUDES += -I$(YAML_INCLUDE)
INCLUDES += -I$(BOOST_INCLUDE)

## this part is just for yaml loader driver
INCLUDES += -I$(CPSW_FRAMEWORK_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 = tpgSupport

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

# tpg.dbd will be created and installed
DBD += tpgSupport.dbd

# tpg.dbd will be made up from these files:
tpgSupport_DBD += base.dbd
tpgSupport_DBD += devIocStats.dbd
tpgSupport_DBD += PVAServerRegister.dbd
tpgSupport_DBD += qsrv.dbd

tpgSupport_DBD += iocAdmin.dbd
tpgSupport_DBD += asSupport.dbd
tpgSupport_DBD += devSeqCar.dbd
tpgSupport_DBD += caPutLog.dbd
tpgSupport_DBD += $(CEXP_DBDS)
tpgSupport_DBD += sncMpsRateDrop.dbd
tpgSupport_DBD += sncFaultBuff.dbd

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

# Application dbds
tpgSupport_DBD += bsaBuffReserve.dbd
tpgSupport_DBD += bsaBufferMask.dbd
#
# ======================================================================
# If you don't have an EVR comment the following two lines:
#tpgSupport_DBD += evrSupport.dbd
#tpgSupport_DBD += devMrfEr.dbd

# ======================================================================
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
tpgSupport_SRCS += tpgSupport_registerRecordDeviceDriver.cpp
tpgSupport_SRCS += bsaBuffReserve.st
tpgSupport_SRCS += bsaBufferMask.st
tpgSupport_SRCS += burstApply.c
tpgSupport_SRCS += burstLoad.c
tpgSupport_SRCS += continuousApply.c 
tpgSupport_SRCS += continuousLoad.c

# ===========================================================
# bsaDriver and yamlLoader have been separated out to epics modules
# after testing these lines should be be revmoved
# ===========================================================
# BSA module will be turned to a separated module.
#tpgSupport_SRCS += bsaAsynDriver.cpp

# YAML loader module will be turned to a separate module.

#tpgSupport_SRCS += yamlLoader.cpp
# ===========================================================

tpgSupport_SRCS_DEFAULT += tpgSupportMain.cpp

tpgSupport_SRCS_vxWorks += -nil-

# ========================================================================
# ========================================================================
# Add locally compiled object code
# For example, subroutines
# ========================================================================
# tpgSupport_SRCS += file1.c
# tpgSupport_SRCS += file2.c
#
tpgSupport_SRCS += sncMpsRateDrop.stt
tpgSupport_SRCS += sncFaultBuff.stt

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

#pgSupport_LIBS += tpgSupport

# Needed to link in iocAdmin support
tpgSupport_LIBS += devIocStats

# Needed to link in autosave support
tpgSupport_LIBS += autosave

tpgSupport_LIBS += seq
tpgSupport_LIBS += pv
tpgSupport_LIBS += seqCar

# Needed to link caPutLog support
tpgSupport_LIBS += caPutLog

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


# QSrv Service
tpgSupport_LIBS += qsrv
tpgSupport_LIBS += $(EPICS_BASE_PVA_CORE_LIBS)
#
tpgSupport_LIBS += $(EPICS_BASE_IOC_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.
# =============================================
# tpgSupport_LIBS += evrSupport
# tpgSupport_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)
#       tpgSupport_LIBS += mrfVme64x
      endif
    endif
  endif
 endif
endif

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

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

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

 ifeq ($(T_A),linux-x86_64)
#  tpgSupport_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 tpg
    tpgSupport_SNCFLAGS += +r
    tpgSupport_DBD += sncExample.dbd
    tpgSupport_SRCS += sncExample.stt
    tpgSupport_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

tpgSupport_LIBS += $(EPICS_BASE_IOC_LIBS)

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

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

