#==============================================================
#
#  Name: Makefile to build EPICS Application for Spear
#
#  Facility: CAMAC-to-VME Controls
#
#  Auth: 04-Jan-2017, K. Luchini      (LUCHINI)
#  Rev:  dd-mmm-yyyy, First Lastname  (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        23-Feb-2023, K. Luchini      (LUCHINI):
#           epics V7 upgrade
#           add qsrv
#           chg autosaveSupport.dbd to asSupport.dbd 
#           chg genSubRecord.dbd to aSubRecord.dbd and remove lib
#           add cexp dbds
#
#==============================================================
#
TOP=../..
include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#=======================================
#
# build an ioc application
#

PROD_IOC_RTEMS = CAMACSpear
 
# For debugging - don't optimize 
USR_CFLAGS += -O0
#USR_LDFLAGS += -Wl,-Map,CAMAC.map 

#USR_CFLAGS_DEFAULT += -DHOST_TEST -g
#USR_CFLAGS         += -O
#USR_CFLAGS_RTEMS   += -g -O4

# CAMAC.dbd will be made up from these files:
#
DBD += CAMACSpear.dbd
CAMACSpear_DBD += base.dbd
CAMACSpear_DBD += devIocStats.dbd
CAMACSpear_DBD += aSubRecord.dbd
CAMACSpear_DBD += asSupport.dbd
CAMACSpear_DBD += dbRestore.dbd
CAMACSpear_DBD += devAnalogIn.dbd
CAMACSpear_DBD += devAnalogOut.dbd
CAMACSpear_DBD += PVAServerRegister.dbd
CAMACSpear_DBD += qsrv.dbd
CAMACSpear_DBD += CVSub.dbd
CAMACSpear_DBD += evrSupport.dbd
CAMACSpear_DBD += devMrfEr.dbd

CAMACSpear_DBD += PSCD.dbd
CAMACSpear_DBD += CAMRoutine.dbd
CAMACSpear_DBD += IDIM.dbd
CAMACSpear_DBD += IDOM.dbd
CAMACSpear_DBD += PIOP.dbd
CAMACSpear_DBD += SAM.dbd
CAMACSpear_DBD += DAC.dbd
CAMACSpear_DBD += CAMCOM.dbd
CAMACSpear_DBD += CV.dbd
CAMACSpear_DBD += $(CEXP_DBDS)

# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
CAMACSpear_SRCS    += CAMACSpear_registerRecordDeviceDriver.cpp
USR_SRCS_DEFAULT   += CAMACSpearMain.cpp

CAMACSpear_SRCS_vxWorks += -nil-
CAMACSpear_SRCS_RTEMS   += -nil-

# The following adds support from base/src/vxWorks
CAMACSpear_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary

# Add in CAMAC-to-VME drivers.
# Note: order of libraries for the 
# event system is very important.
CAMACSpear_LIBS_RTEMS += devIocStats
CAMACSpear_LIBS_RTEMS += analogIn
CAMACSpear_LIBS_RTEMS += analogOut
CAMACSpear_LIBS_RTEMS += CVSub
CAMACSpear_LIBS_RTEMS += qsrv

CAMACSpear_LIBS_RTEMS += evrSupport
CAMACSpear_LIBS_RTEMS += devMrfEr
CAMACSpear_LIBS_RTEMS += mrfVme64x

CAMACSpear_LIBS_RTEMS += DAC
CAMACSpear_LIBS_RTEMS += IDIM
CAMACSpear_LIBS_RTEMS += IDOM
CAMACSpear_LIBS_RTEMS += PIOP
CAMACSpear_LIBS_RTEMS += SAM
CAMACSpear_LIBS_RTEMS += CAMRoutine
CAMACSpear_LIBS_RTEMS += PSCD
CAMACSpear_LIBS_RTEMS += CAMCOM
CAMACSpear_LIBS_RTEMS += CV

# This library must come after mrfVme64x
CAMACSpear_LIBS_RTEMS += autosave
CAMACSpear_LIBS_RTEMS += restore

# Build SNL programs
# NOTE: to build SLN programs, SNCSEQ must be defined
# in the <top>/configure/RELEASE file
#
ifneq ($(SNCSEQ),)
  CAMACSpear_LIBS_RTEMS += seq pv
endif

SR_LIBS_RTEMS         += $(CEXP_LIBS)
USR_SYS_LIBS_RTEMS    += $(CEXP_SYS_LIBS)
CAMACSpear_LIBS_RTEMS += $(EPICS_BASE_IOC_LIBS)
CAMACSpear_LIBS_RTEMS += $(EPICS_BASE_PVA_CORE_LIBS)

#========================================
include $(TOP)/configure/RULES
#----------------------------------------
#  ADD RULES AFTER THIS LINE
#
# End of file


