#==============================================================
#
#  Abs:  Makefile to build EPICS Database components
#
#  Name: Makefile
#
#  Facility: LCLS Magnet Controls
#
#  Auth: 03-Sep-2006, Kristi Luchini  (LUCHINI)
#  Rev:  dd-mmm-yyyy, First Lastname  (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        20-Mar-2024, K. Luchini      (LUCHINI):
#           install tprTrig.db
#        15-Mar-2024, K. Luchini      (LUCHINI):
#           remove mgnt_bkhf_kick.db
#        05-Mar-2024, K. Luchini      (LUCHINI):
#           remove mgnt_beckhoff_smps.db
#        11-Dec-2023, K. Luchini      (LUCHINI):
#           Install protocal files using PROTO
#           chg protocol file names from <name>_proto.db
#           to <name>.proto
#        08-Nov-2023, A. Le           (ANLE):
#           Rename mgnt_genesys_30_110_proto.db to
#			mgnt_genesys_alt_proto.db
#        20-Mar-2023, K. Luchini      (LUCHINI):
#           Put back mgnt_genesys_30_110_proto.db
#        06-Feb-2023, K. Luchini      (LUCHINI):
#           remove mgnt_genesys_ps.db
#           remove mgnt_genesys_30_110_proto.db
#           install mgnt_awg.proto
#        28-Nov-2022, K. Luchini      (LUCHINI):
#           remove mgnt_cryo_degauss.db
#        01-Nov-2022, K. Luchini      (LUCHINI):
#           install mgnt_cryo_degauss.db
#           install mgnt_degauss.db
#        23-Sep-2022, K. Luchini      (LUCHINI):
#           remove mgnt_kickSc.db
#        15-Sep-2022, A. Le           (ANLE):
#           Install mgnt_genesys_30_110_proto.db
#        16-Aug-2022, K. Luchini      (LUCHINI):
#           install mgnt_kickSc.db
#        22-Mar-2022, K. Luchini      (LUCHINI):
#           remove mgnt_beckhoff_analogout.template
#           remove mgnt_beckhoff_analogin.template
#           remove mgnt_beckhoff_digitalout.template
#           remove mgnt_beckhoff_digitalin.template
#           remove mgnt_bkhf_kick.substitutions
#        18-Mar-2022, K. Luchini      (LUCHINI):
#           install mgnt_multibunch_kickk.db
#        07-Mar-2022, K. Luchini      (LUCHINI):
#           install mgnt_beckhoff_kick.db
#        03-Feb-2022, K. Luchini      (LUCHINI):
#           add mgnt_string_slave_kick.db
#        26-Jan-2022, K. Luchin       (LUCHINI):
#           rename mgnt_plc_interlockin_kick_spr.template
#           to mgnt_plc_interlockin_kickSc.template
#           rename mgnt_plc_kick_spr.substitutions
#           to mgnt_plc_kickSc.substitutions
#        14-Nov-2021, K. Luchin       (LUCHINI):
#           rename mgnt_kick_sc.db to mgnt_plc_kick_spr.db
#        13-Nov-2021, K. Luchin       (LUCHINI):
#           install mgnt_kick_sc.db
#        10-Aug-2021, K. Luchin       (LUCHINI):
#           install mgnt_cryo_epsc.db
#        04-May-2021, K. Luchin       (LUCHINI):
#           install mgnt_emcor_smps_stdz.db
#        20-Oct-2020, K. Luchin       (LUCHINI):
#           install mgnt_string_func.db
#        18-Jun-2020, K. Luchin       (LUCHINI):
#           install mgnt_intermedite_stdz.db
#        18-May-2020, K. Luchin       (LUCHINI):
#           install mgnt_ctrl_allstart_efc.db
#        26-Mar-2020, K. Luchini      (LUCHINI):
#           install mgnt_emcor_smps_efc.db
#           remove install of the following files
#		DB += mgnt_cryo_module.template
#		DB += mgnt_epsc_rev.template
#		DB += mgnt_ctrl.template
#		DB += mgnt_ctrl_func.template
#		DB += mgnt_plc_analog.template
#		DB += mgnt_plc_analogin.template
#		DB += mgnt_plc_analogout.template
#		DB += mgnt_plc_digitalin.template
#		DB += mgnt_plc_digitalout.template
#		DB += mgnt_plc_digitalout_momentary.template
#		DB += mgnt_plc_interlockin.template
#		DB += mgnt_plc_reset.template
#		DB += mgnt_plc_voltage_kick.template
#        07-Oct-2019, K. Luchini      (LUCHINI):
#           install mgnt_ctrl_degauss.db
#        01-Oct-2019, K. Luchini      (LUCHINI):
#           install mgnt_emcor_smps_fbck.db
#        26-Sep-2018, K. Luchini      (LUCHINI):
#           remove plot databases for history buffer
#           use different method that does not involve
#           adding pvs.
#           install mgnt_genesys_ps.db
#        29-Aug-2018, K. Luchini      (LUCHINI):
#           move mgnt_soft_calcout.templage and 
#           mgnt_ctrl_degauss.substitutions to mgntApp/Db/und 
#        24-Aug-2018, K. Luchini      (LUCHINI):
#           remove mgnt_string_slave_notrims.db
#           remove mgnt_string_slave_notrim_2.db
#           rename mgnt_string_slave.db to mgnt_string_slave_trim.db
#           add mgnt_string_slave_trim.db
#        22-Aug-2018, K. Luchiin      (LUCHINI):
#           renmae mgnt_bulk.db to mgnt_genesys_smps.db
#        20-Aug-2018, K. Luchini      (LUCHINI):
#           remove mgnt_lgps_linac.template
#        19-Aug-2018, K. Luchini      (LUCHINI):
#           install mgnt_dbPau.db
#        12-Aug-2018, K. Luchini      (LUCHINI):
#           remove mgnt_string_slave_smps.template
#           remvoe mgnt_beckhoff_ps.db
#        15-Sep-2017, K. Luchini      (LUCHINI)
#           install mgnt_nohw_lgps.db
#        12-Oct-2016, K. Luchini      (LUCHINI)
#           remove VSAM module dbs
#        26-Feb-2016, K. Luchini      (LUCHINI):
#           remove mgnt_string_ctrl2.template
#        24-Sep-2015, K. Luchini      (LUCHINI):
#           install of mgnt_string_status2.template
#           install of mgnt_string_ctrl2.template
#        19-Aug-2015, K. Luchini      (LUCHINI):
#           remove install of mgnt_epsc_rev.template
#        18-Jan-2012, K. Luchini      (LUCHINI):
#           remove baseSecurity.acf for epics R3.14.12
#           add USR_DBFLAGS
#        25-Oct-2011, K. Luchini      (LUCHINI):
#           install bkhf-9000.db
#        07-Sep-2011, K. Luchini      (LUCHINI):
#           add mgnt_beckhoff_ps.db
#        30-Jun-2011, K. Luchini      (LUCHINI):
#           add mgnt_mcor12_linac.template
#        11-Aug-2010, K. Luchini      (LUCHINI):
#           remove mgnt_slc.db, no longer used
#        02-Jun-2010, K. Luchini      (LUCHINI):
#           temp install mgnt_smps_fbck.db
#        12-Mar-2010, K. Luchini      (LUCHINI):
#           install mgnt_intermediate_rev.db for 50b1 and li21 q21301
#        26-Jan-2010, K. Luchini      (LUCHINI):
#           add common files for Linac Alcove
#           Corrector and QE magnets
#        23-Sep-2009, K. Luchini      (LUCHINI):
#           install iocAdminRTEMS.db, iocAdminSoft.db
#           and iocRelease.db
#           remove iocAdmin.db
#        24-Feb-2009, K. Luchini      (LUCHINI):
#           remove slc-aware db
#        17-Dec-2008, K. Luchini      (LUCHINI):
#           install slc_model.template
#        07-Dec-2008, K. Luchini      (LUCHINI):
#          add mgnt_string_slave_notrims.db
#        06-Oct-2008, K. Luchini      (LUCHINI):
#          add mgnt_string_ctrl2.template and mgnt_string_status2.template
#        16-Sep-2008, K. Luchini      (LUCHINI):
#          add mgnt_pattern.substitutions
#          add mgnt_linac_mcor.substitutions
#        20-Aug-2008, K. Luchini      (LUCHINI):
#          remove deprecated db mgnt_plc_kick
#        12-Mar-2008, K. Luchini      (LUCHINI):
#          chg location of TOP
#        08-Aug-2008, K. Luchini      (LUCHINI):
#          removed mgnt_adc.db and mgnt_adc.db
#        23-Jul-2007, K. Luchini      (LUCHINI):
#          comment out AUTOSAVE
#          replace iocMon with iocAdmin
#        14-May-2007, K. Luchini      (LUCHINI):
#          add mgnt_dac.db,mgnt_adc.db and mgnt_epsc_dev.db
#        09-May-2007, K. Luchini      (LUCHINI):
#          replace stats db with iocMon.db
#        02-May-2007, K. Luchini      (LUCHINI):
#          add vsam templates
#        01-May-2007, K. Luchini      (LUCHINI):
#          add save_restoreStatus.db
#
#==============================================================
#
TOP=../../..
include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE

#----------------------------------------------------
#  Optimization of db files using dbst (DEFAULT: NO)
DB_OPT = YES.
USR_DBFLAGS += -I../O.Common

#----------------------------------------------------
# Create and install (or just install) into <top>/db
# databases, templates, substitutions like this
#
# For iocAdmin database
DB_INSTALLS       += $(IOCADMIN)/db/iocAdminRTEMS.db
DB_INSTALLS       += $(IOCADMIN)/db/iocAdminSoft.db
DB_INSTALLS       += $(IOCADMIN)/db/access.db
DB_INSTALLS       += $(IOCADMIN)/db/iocAdminScanMon.db
IOCRELEASE_DB     += iocRelease.db

# Seequence Admin
DB_INSTALLS       += $(SNCSEQ)/db/devSeqCar.db

# PLC
PLCADMIN_TEMPLATE += $(PLCADMIN)/db/plcAdminControlLogix.template
ETHER_IP_TEMPLATE += $(ETHER_IP)/db/eip_stat.db

# MCOR
DB_INSTALLS       += $(DRVPCIMCOR)/db/pciMcorDemo.db

# Timing dbs
EVENT_TEMPLATE    += $(EVENT)/db/evr.db
EVENT_TEMPLATE    += $(EVENT)/db/evrEventCtrl.db
EVENT_TEMPLATE    += $(EVENT)/db/evrPatternAll.db
EVENT_TEMPLATE    += $(EVENT)/db/evrEventAll.db

# PciE TPR db
DB_INSTALLS+=$(TPRTRIGGER)/db/tprTrig.db

# Asyn database
DB_INSTALLS+=$(ASYN)/db/asynRecord.db

# Fast Feedback db and templates
# NOTE: 
# Copied dbPau.template to mgntApp/Db/common/mgnt_dbPau.substitutions
# Copied dbMux.templage to mgntApp/Db/common/mgnt_dbMux.substitutions
# 
DB_INSTALLS+=$(PAU)/db/dbPau.db
DB_INSTALLS+=$(PAU)/db/dbPauBeamcodeTimeslot.db
DB_INSTALLS+=$(PAU)/db/dbPauPattern.db
DB_INSTALLS+=$(PAU)/db/dbMux.db
DB_INSTALLS+=$(PAU)/db/dbMuxDataSlot.db
DB_INSTALLS+=$(PAU)/db/dbMuxOffset.db

# For bumpless reboot using autosave
DB_INSTALLS   += $(AUTOSAVE)/db/save_restoreStatus.db

#-----------------------------------------------------
# Pattern Aware
DB += mgnt_dbPau.db
DB += mgnt_dbMux.db

# Hardware
# MCOR
DB += mgnt_emcor_chan.template
DB += mgnt_emcor_controller.template
DB += mgnt_mcor_chan.db
DB += mgnt_mcor_linac.db
DB += mgnt_mcor12_linac.db
DB += mgnt_mcor_controller.template
# Genesys PS
DB += mgnt_genesys_ps.template
DB += mgnt_genesys_ps_alias.db
# Timing
DB += mgnt_evr.db
DB += mgnt_pattern.db
# VME ADC
DB += mgnt_ip8413_module_v2.template
# Allen-Bradley PLC
DB += mgnt_plc_ps_system.db
DB += mgnt_plc_ps.db
DB += mgnt_plc_kick.db
DB += mgnt_plc_kickSc.db
# Ethernet PS Controller (EPSC)
DB += mgnt_epsc_test.db
DB += mgnt_epsc.template
DB += mgnt_epsc.db
DB += mgnt_epsc_qe_linac.db

# Misc
DB += mgnt_degauss.db

# Top-level databases based on controller
DB += mgnt_emcor_linac.db
DB += mgnt_emcor_smps.db
DB += mgnt_emcor_smps_fbck.db
DB += mgnt_emcor_smps_stdz.db
DB += mgnt_emcor_smps_efc.db
DB += mgnt_genesys_smps.db
DB += mgnt_smps.db
DB += mgnt_intermediate.db
DB += mgnt_intermediate_stdz.db
DB += mgnt_kick.db
DB += mgnt_multibunch_kick.db
DB += mgnt_lgps.db
DB += mgnt_nohw_lgps.db
DB += mgnt_genesys_lgps.db
DB += mgnt_string_slave_notrim.db
DB += mgnt_string_slave_trim.db
DB += mgnt_string_slave_kick.db

# Control functions
DB += mgnt_func.db
DB += mgnt_string_func.db
DB += mgnt_ctrl_allstar_efc.db
DB += mgnt_ctrl_allstar.db
DB += mgnt_ctrl_func_linac.db
DB += mgnt_ctrl_func_mcor_linac.db
DB += mgnt_ctrl_func_qe_linac.db
DB += mgnt_ctrl_degauss.db

# IVB Polynomial 
DB += mgnt_poly_qe_linac.db
DB += mgnt_poly_mcor_linac.db
DB += mgnt_poly.template
DB += mgnt_poly.db
DB += mgnt_poly_linac.db

# Templates used by sector substituion files directly
# that do not need to be installed to $(TOP)/db
DB += mgnt_string_ctrl.template
DB += mgnt_model.template

# Cryo module
DB += mgnt_cryo_func.db
DB += mgnt_cryo_module.db
DB += mgnt_cryo_intermediate.db
DB += mgnt_cryo_epsc.db

# Proteus P2588D
PROTO += mgnt_awg.proto
PROTO += mgnt_genesys.proto
PROTO += mgnt_genesys_alt.proto

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


