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

# Use the following for RTEMS Only IOCs
#PROD_IOC_RTEMS = BunchLengthII
USR_INCLUDES += AmcCarrier.h

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

# BunchLengthII.dbd will be made up from these files:
BunchLengthII_DBD += base.dbd
BunchLengthII_DBD += devIocStats.dbd
BunchLengthII_DBD += autosaveSupport.dbd
BunchLengthII_DBD += caPutLog.dbd
BunchLengthII_DBD += $(CEXP_DBDS)

BunchLengthII_DBD += AmcCarrierSupport.dbd

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

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

# ======================================================================
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
BunchLengthII_SRCS += BunchLengthII_registerRecordDeviceDriver.cpp

BunchLengthII_SRCS_DEFAULT += BunchLengthIIMain.cpp

BunchLengthII_SRCS_vxWorks += -nil-

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

# =====================================================
# Link in the code from other libraries
# =====================================================
# Needed to link in iocAdmin support
BunchLengthII_LIBS += devIocStats

# Needed to link in autosave support
BunchLengthII_LIBS += autosave

# Needed to link caPutLog support
BunchLengthII_LIBS += caPutLog

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

BunchLengthII_LIBS += AmcCarrier
# =============================================
# 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.
# =============================================
 BunchLengthII_LIBS += evrSupport
 BunchLengthII_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)
       BunchLengthII_LIBS += mrfVme64x
      endif
    endif
  endif
 endif
endif

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

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

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

 ifeq ($(T_A),linux-x86_64)
  BunchLengthII_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 BunchLengthII
    BunchLengthII_SNCFLAGS += +r
    BunchLengthII_DBD += sncExample.dbd
    BunchLengthII_SRCS += sncExample.stt
    BunchLengthII_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

BunchLengthII_LIBS += $(EPICS_BASE_IOC_LIBS)

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

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

