#==============================================================
#
#  Abs:  Makefile to build EPICS Magnet Application
#
#  Name: Makefile
#
#  Desc: This file generates a database definition file
#        file for a soft ioc mgntSoft.dbd and for an
#        RTEMS ioc mgnt.dbd. 
#
#  Facility:  SLAC/LCLS
#
#  Auth: 26-Jul-2005, K. Luchini          (LUCHINI)
#  Rev:  dd-mmm-yyyy, Reviewer's Name     (USERNAME)
#--------------------------------------------------------------
#  Mod:
#       22-Aug-2010, D Rogind             (DROGIND):
#          add in pau seq to back propagate feedback value to PV
#       09-Jun-2010, K. Luchini           (LUCHINI):
#          remove soft reset lcl_bus_rst.c, which is
#          now included in the RTEMS release
#       02-Jun-2010, K. Luchini           (LUCHINI):
#          Move mgntRegister.c and mgntPauUsr.c to build
#          under RTEMS only.
#       03-Feb-2010, D. Rogind            (DROGIND):
#          add pau,fcom libs, added mgntPauUsr and mgntRegister srcs
#       24-Feb-2009, K. Luchini           (LUCHINI):
#          remove slc-aware lib and db
#       03-Feb-2009, K. Luchini           (LUCHINI):
#          temporily add Till's soft-reboot function
#          for rtems iocs. This will be in a later version
#          of rtems, at which time I'll remove this function
#          from magnets.
#       29-Oct-2008, K. Luchini           (LUCHINI):
#          change iocAdmin library to devIocStats
#          which is needed for the release of  iocAdmin-R2-0-0
#       14-Dec-2007, K. Luchini           (LUCHINI):
#          depricate the mgntSoftInclud.dbd 
#          and mgntInclude.dbd
#       11-Dec-2007, K. Luchini           (LUCHINI):
#          add genSubLib
#       18-Oct-2007, K. Luchini           (LUCHINI):
#          compile subsys.c locally
#          cmlog library is no longer needed.
#       29-Aug-2007, K. Luchini           (LUCHINI):
#          remove libXy9660.a since it is not included
#          in libIpac.a
#       03-Aug-2007, K. Luchini           (LUCHINI):
#          remove std library
#       24-Jul-2007, K. Luchini           (LUCHINI):
#          replaced iocMon with iocAdmin
#       23-July 2007 D. Rogind            (DROGIND):
#          remove drvSupport
#       12-July 2007 D. Rogind            (DROGIND):
#           remove iocCmlog
#       22-Jun-2007, K. Luchini           (LUCHINI):
#          remove drvUniverseDma and devBusMapped
#       09-May-2007, K. Luchini           (LUCHINI):
#          add iocMon library
#       02-May-2007, K. Luchini           (LUCHINI):
#          add vsam and vmeCardRecord libraries
#       01-May-2007, K. Luchini           (LUCHINI):
#          added autosave
#       30-Mar-2007, Kmgnt_LIBS += pau
#          decouple event software from slc-aware
#       21-Mar-2007, K. Luchini           (LUCHINI):
#          specify event package libraires rather than
#          use predefined variables.
#       28-Jan-2007, K. Luchini           (LUCHINI):
#          chg how event and slcaware libraries are added
#       26-Jan-2007, D. Rogind            (DROGIND):
#          add in event libraries
#       21-Sep-2006, K. Luchini           (LUCHINI):
#         add Hytec Ip-Adc-8413 library
#       29-Aug-2006, K. Luchini           (LUCHINI):
#         removed ip440,ip445, async support
#       19-Aug-2006, K. Luchini           (LUCHINI):
#         added Acromag ip231 dac support
#       28-Jul-2006, K. Luchini           (LUCHINI):
#         include asyn library only with RTEMS
#       13-Jul-2006, K. Luchini           (LUCHINI):
#         add ether_ip,asyn libs and slcaware debug flag
#       23-Mar-2006, K. Luchini           (LUCHINI):
#         add VSAM and remove Vipc664 drivers
#       12-Mar-2006, K. Luchini           (LUCHINI):
#         added subSys library.
#       07-Mar-2006, K. Luchini           (LUCHINI):
#         used the new files mgntInclude.dbd and mgntSoft.dbd
#         to generate mgnt.dbd and mgntSoft.dbd
#
#==============================================================
#
TOP=../..
include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#========================================
#
# Build an object
#
PROD_IOC_RTEMS = mgnt
PROD_HOST      = mgntSoft 

# mgntSoft.dbd will be made up from these files:
#
DBD          = mgntSoft.dbd
mgntSoft_DBD += base.dbd
mgntSoft_DBD += iocAdmin.dbd
mgntSoft_DBD += dbRestore.dbd
mgntSoft_DBD += subSys.dbd
mgntSoft_DBD += sSubRecord.dbd
mgntSoft_DBD += genSubRecord.dbd
mgntSoft_DBD += devEtherPSC.dbd
mgntSoft_DBD += drvEtherIP.dbd
mgntSoft_DBD += ether_ip.dbd
mgntSoft_DBD += mgntSub.dbd
mgntSoft_DBD += mgntCtrl.dbd

# mgnt.dbd will be made up from these files:
#
ifeq ($(OS_CLASS),RTEMS)
DBD      += mgnt.dbd
mgnt_DBD += mgntSoft.dbd
mgnt_DBD += drvIpac.dbd
mgnt_DBD += drvXy9660.dbd
mgnt_DBD += IP231.dbd
mgnt_DBD += devHy8413.dbd
mgnt_DBD += vmeCardRecord.dbd
mgnt_DBD += devVSAM.dbd
mgnt_DBD += devVSAMCard.dbd
mgnt_DBD += evrSupport.dbd
mgnt_DBD += devMrfEr.dbd
# DR add PAU
mgnt_DBD += drvPau.dbd
mgnt_DBD += devPau.dbd
mgnt_DBD += drvPauUsr.dbd
mgnt_DBD += sncPau.dbd
# DR add fcomIocShell
mgnt_DBD += fcomIocshSupport.dbd
mgnt_DBD += mgntRegister.dbd
mgnt_DBD += mgntPauUsr.dbd
endif

# For gdb debug flags
USR_CFLAGS_DEFAULT += -DHOST_TEST -g
USR_CFLAGS_RTEMS   += -g -O4
USR_CFLAGS         += -DDEBUG_PRINT

# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
mgnt_SRCS         += mgnt_registerRecordDeviceDriver.cpp
mgntSoft_SRCS     += mgntSoft_registerRecordDeviceDriver.cpp
USR_SRCS_DEFAULT  += mgntMain.cpp
mgnt_SRCS_vxWorks += -nil-
mgnt_SRCS_RTEMS   += -nil-

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

# Add locally compiled object code
USR_SRCS  += subSys.c
USR_SRCS  += mgntSub.c

# Note that order is important.
USR_LIBS  += sSubRecord
USR_LIBS  += genSub
USR_LIBS  += miscUtils 
USR_LIBS  += etherPSC
USR_LIBS  += ether_ip
USR_LIBS  += devIocStats


# Add in VME drivers.
# Note: order of libraries for the event system is very important.
ifeq ($(OS_CLASS),RTEMS)
USR_SRCS  += mgntRegister.c
USR_SRCS  += mgntPauUsr.c
mgnt_LIBS += evrSupport
mgnt_LIBS += generalTime
mgnt_LIBS += devMrfEr
mgnt_LIBS += mrfVme64x
mgnt_LIBS += IP231
mgnt_LIBS += Hy8413
mgnt_LIBS += Ipac
mgnt_LIBS += vsam
mgnt_LIBS += vmeCardRecord
mgnt_LIBS += pau
mgnt_LIBS += fcom 
mgnt_LIBS += udpComm
mgnt_LIBS += fcomIocshSupport 
mgnt_LIBS += fcomUtil
endif

# This library must come after mrfVme64x
USR_LIBS  += restore

# Build SNL programs
# NOTE: to build SLN programs, SNCSEQ must be defined
# in the <top>/configure/RELEASE file
#
ifneq ($(SNCSEQ),)
 USR_SNCFLAGS += +r
 USR SNCFLAGS += -a
 USR_SNCFLAGS += +c
 USR_SNCFLAGS += +d
 USR_SRCS     += mgntCtrl.st
 USR_SRCS     += mgntCtrl_rev.st
 USR_LIBS     += seq pv
endif

USR_LIBS += $(EPICS_BASE_IOC_LIBS) 

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