TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#========================================
USR_CPPFLAGS = -lrt
# ================================================
# bldRecord.h will be created from bldRecord.dbd
DBDINC += bldRecord
# ================================================
# Build the IOC support libraries
# ================================================
LIBRARY_IOC += bldSupport

# bldRecord.h will be created from bldRecord.dbd
DBDINC += bldRecord
# Install devBldSoft.dbd into <top>/dbd
DBD += bldSupport.dbd

# Compile and add the code to the support library
bldSupport_SRCS += bldRecord.c
bldSupport_SRCS += devBldSoft.c

# Link locally-provided code into the support library,
# rather than directly into the IOC application.
bldSupport_SRCS += dbSubBld.c
bldSupport_SRCS += bld.c
bldSupport_SRCS += initTrace.c

bldSupport_LIBS += $(EPICS_BASE_IOC_LIBS)
# ================================================
# Build the IOC application
# ================================================
# This will attempt to build an IOC application 
# for every target including the host computer.
PROD_IOC += bld
PROD_IOC += bldRcvr

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

# bld.dbd will be created and installed
DBD += bld.dbd
DBD += bldRcvr.dbd

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

bld_DBD += bldSupport.dbd
bld_DBD += dbSubBld.dbd
bld_DBD += bld.dbd
bld_DBD += initTrace.dbd

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

bldRcvr_DBD += bldSupport.dbd
bldRcvr_DBD += dbSubBld.dbd
bldRcvr_DBD += bldRcvr.dbd
bldRcvr_DBD += initTrace.dbd

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

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

bldRcvr_DBD += evrSupport.dbd
bldRcvr_DBD += devMrfEr.dbd
# ======================================================================
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
bld_SRCS += bld_registerRecordDeviceDriver.cpp

bld_SRCS_DEFAULT += bldMain.cpp

bld_SRCS_vxWorks += -nil-

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

bldRcvr_SRCS += bldRcvr_registerRecordDeviceDriver.cpp

bldRcvr_SRCS_DEFAULT += bldMain.cpp

bldRcvr_SRCS_vxWorks += -nil-

# ========================================================================
# Add locally compiled object code
# For example, subroutines
# ========================================================================
bld_SRCS += bldTest.cc

bldRcvr_SRCS += bldRcvr.cc

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

# Needed to link in autosave support
bld_LIBS += autosave
bldRcvr_LIBS += autosave

# Needed to link caPutLog support
bld_LIBS += caPutLog
bldRcvr_LIBS += caPutLog

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

# Link in the code from the support library
bld_LIBS += bldSupport
bldRcvr_LIBS += bldSupport

# =============================================
# 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.
# =============================================
 bld_LIBS += evrSupport
 bld_LIBS += devMrfEr
 
 bldRcvr_LIBS += evrSupport
 bldRcvr_LIBS += devMrfEr

 ifneq ($(T_A),linuxRT-x86)
   ifneq ($(T_A),linux-x86)
       bld_LIBS += mrfVme64x
       bldRcvr_LIBS += mrfVme64x       
   endif
 endif

 ifeq ($(T_A),linuxRT-x86)
  bld_LIBS += drvMrf
  bldRcvr_LIBS += drvMrf  
 endif
 
 ifeq ($(T_A),linux-x86)
  bld_LIBS += drvMrf
  bldRcvr_LIBS += drvMrf  
 endif

 ifeq ($(T_A),linux-x86_64)
  bld_LIBS += drvMrf
  bldRcvr_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 bld
    bld_SNCFLAGS += +r
    bld_DBD += sncExample.dbd
    bld_SRCS += sncExample.stt
    bld_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

bld_LIBS += $(EPICS_BASE_IOC_LIBS)
bldRcvr_LIBS += $(EPICS_BASE_IOC_LIBS)

LOADABLE_LIBRARY += service

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

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

