TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#========================================
# Build the IOC support library

LIBRARY_IOC += bldSupport

# Production flags
USR_CPPFLAGS = -lrt
# USR_CFLAGS += -DlinuxRT

# 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 += 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 += BLDLinux
PROD_IOC += BLDRcvr

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

# BLD*.dbd will be created and installed
DBD += BLDLinux.dbd
DBD += BLDRcvr.dbd

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

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

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

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

# BLDRcvr_DBD += evrSupport.dbd
# BLDRcvr_DBD += devMrfEr.dbd

BLDLinux_DBD += bldSupport.dbd
BLDLinux_DBD += bldClientTest.dbd

BLDRcvr_DBD += bldSupport.dbd
BLDRcvr_DBD += bldServerTest.dbd

# ======================================================================
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
BLDLinux_SRCS += BLDLinux_registerRecordDeviceDriver.cpp

BLDLinux_SRCS_DEFAULT += BLDLinuxMain.cpp

BLDLinux_SRCS_vxWorks += -nil-

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

BLDRcvr_SRCS += BLDRcvr_registerRecordDeviceDriver.cpp

BLDRcvr_SRCS_DEFAULT += BLDLinuxMain.cpp

BLDRcvr_SRCS_vxWorks += -nil-
# ========================================================================
# Add locally compiled object code
# For example, subroutines
# ========================================================================
# BLDLinux_SRCS += file1.c
# BLDLinux_SRCS += file2.c

BLDLinux_SRCS += bldClientTest.cc

BLDRcvr_SRCS += bldServerTest.cc
# =====================================================
# Link in the code from other libraries
# =====================================================
# Needed to link in iocAdmin support
BLDLinux_LIBS += devIocStats
BLDRcvr_LIBS += devIocStats

# Needed to link in autosave support
BLDLinux_LIBS += autosave
BLDRcvr_LIBS += autosave

# Needed to link caPutLog support
BLDLinux_LIBS += caPutLog
BLDRcvr_LIBS += caPutLog

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

# Link in the code from the support library
BLDLinux_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.
# =============================================
#  BLDLinux_LIBS += evrSupport
#  BLDLinux_LIBS += devMrfEr
 
#  BLDRcvr_LIBS += evrSupport
#  BLDRcvr_LIBS += devMrfEr

#  ifneq ($(T_A),linuxRT-x86)
#    ifneq ($(T_A),linux-x86)
#        BLDLinux_LIBS += mrfVme64x
#        BLDRcvr_LIBS += mrfVme64x       
#    endif
#  endif

#  ifeq ($(T_A),linuxRT-x86)
#   BLDLinux_LIBS += drvMrf
#   BLDRcvr_LIBS += drvMrf  
#  endif
 
#  ifeq ($(T_A),linux-x86)
#   BLDLinux_LIBS += drvMrf
#   BLDRcvr_LIBS += drvMrf  
#  endif

# ifeq ($(T_A),linux-x86_64)
#   BLDLinux_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 BLDLinux
    BLDLinux_SNCFLAGS += +r
    BLDLinux_DBD += sncExample.dbd
    BLDLinux_SRCS += sncExample.stt
    BLDLinux_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

BLDLinux_LIBS += $(EPICS_BASE_IOC_LIBS)
BLDRcvr_LIBS += $(EPICS_BASE_IOC_LIBS)

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

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

