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 BLDLinux
# ================================================
# This will attempt to build an IOC application 
# for every target including the host computer.
PROD_IOC += BLDLinux

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

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

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

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

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

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

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

BLDLinux_SRCS_DEFAULT += BLDLinuxMain.cpp

BLDLinux_SRCS_vxWorks += -nil-

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

BLDLinux_SRCS += bldTest.cpp
# =====================================================
# Link in the code from other libraries for BLDLinux
# =====================================================
# Needed to link in iocAdmin support
BLDLinux_LIBS += devIocStats

# Needed to link in autosave support
BLDLinux_LIBS += autosave

# Needed to link caPutLog support
BLDLinux_LIBS += caPutLog

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

# Link in the code from the support library
BLDLinux_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
 
 ifneq ($(T_A),linuxRT-x86)
   ifneq ($(T_A),linux-x86)
       BLDLinux_LIBS += mrfVme64x    
   endif   
 endif

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

 ifeq ($(T_A),linux-x86_64)
  BLDLinux_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)

LOADABLE_LIBRARY += service
#===========================

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

