TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#=============================
#USR_CPPFLAGS += -pg -g
#USR_CFLAGS += -pg -g
#USR_LDFLAGS += -pg -g
USR_CPPFLAGS += -g
USR_CFLAGS += -g
USR_LDFLAGS += -g

# ======================================
# Install a few HOST-based scripts:
# =====================================
#SCRIPTS_Linux += start_ImageJ
#SCRIPTS_Linux += start_ImageJ_1
#SCRIPTS_Linux += compareTimestamp.bash
#SCRIPTS_Linux += caget.bash
# ========================================================
# EXTERNAL NON EPICS PACKAGES: USER INCLUDES AND LIBRARIES
#========================================================
USR_INCLUDES += $(ZLIB_INCLUDE)
USR_INCLUDES += $(XZ_INCLUDE)
USR_INCLUDES += $(LIBXML2_INCLUDE)
USR_INCLUDES += $(PCRE_INCLUDE)
USR_INCLUDES += $(HDF5_INCLUDE)
USR_INCLUDES += $(ETHERLAB_INCLUDE)

# PATH TO THE EXTERNAL LIBRARIES
#===================================
z_DIR = $(ZLIB_LIB)
lzma_DIR = $(XZ_LIB)
xml2_DIR = $(LIBXML2_LIB)
hdf5_DIR = $(HDF5_LIB)
pcre_DIR = $(PCRE_LIB)
#=============================
# Build the IOC application
# ProfileMonitor.dbd will be created and installed

PROD_IOC = ProfileMonitor
DBD += ProfileMonitor.dbd

ifeq ($(T_A),linuxRT-x86_64)
  PROD_IOC += ProfileMonitorPlus
  DBD += ProfileMonitorPlus.dbd
  PROD_IOC += andor3ListDevices
  andor3ListDevicesSrcs += andor3ListDevices.cpp
endif


#PROD_NAME = ProfileMonitor
#PROD_IOC_linuxRT-x86_64 = $(PROD_NAME)Plus
#PROD_IOC=$(PROD_NAME)
#PROD_IOC+=$(PROD_IOC_$(T_A))


#ProfileMonitor

ProfileMonitor_DBD += base.dbd
ProfileMonitor_DBD += ecAsyn.dbd
ProfileMonitor_DBD += system.dbd
ProfileMonitor_DBD += devIocStats.dbd
ProfileMonitor_DBD += qsrv.dbd

#areaDetector
ProfileMonitor_DBD += busySupport.dbd
ProfileMonitor_DBD += sscanSupport.dbd
ProfileMonitor_DBD += calcSupport.dbd
ProfileMonitor_DBD += NDPluginSupport.dbd
ProfileMonitor_DBD += ADSupport.dbd
ProfileMonitor_DBD += asyn.dbd
ProfileMonitor_DBD += pgpEdtSupport.dbd
ProfileMonitor_DBD += axisTicks.dbd
ProfileMonitor_DBD += stream.dbd
ProfileMonitor_DBD += dynamicRoi.dbd
ProfileMonitor_DBD += NDPluginDynamicROI.dbd
ProfileMonitor_DBD += NDPluginPva.dbd
ProfileMonitor_DBD += NDDriverStdArraysSupport.dbd
ProfileMonitor_DBD += PVAServerRegister.dbd
# Include dbd files from all support applications and modules:
# Timing EVR support
ProfileMonitor_DBD += evrSupport.dbd
ProfileMonitor_DBD += devMrfEr.dbd
ProfileMonitor_DBD += bsaCore.dbd

# iocAdmin support (IOC Health Monitoring)
ProfileMonitor_DBD += iocAdmin.dbd

# autosave support (IOC save/restore)
ProfileMonitor_DBD += asSupport.dbd

# Supporting modules needed to bring in the areaDetector
ProfileMonitor_DBD += prosilicaSupport.dbd
ProfileMonitor_DBD += NDFileTIFF.dbd
ProfileMonitor_DBD += NDFileJPEG.dbd
ProfileMonitor_DBD += NDFileHDF5.dbd
ProfileMonitor_DBD += NDFileNull.dbd
ProfileMonitor_DBD += timeStampSource.dbd
ProfileMonitor_DBD += drvPerfMeasure.dbd
ProfileMonitor_DBD += devSeqCar.dbd
ProfileMonitor_DBD += NDArrayCopy.dbd


ifeq ($(T_A),linuxRT-x86_64)
  ProfileMonitorPlus_DBD += ProfileMonitor.dbd
  ProfileMonitorPlus_DBD += mcoreutils.dbd
  ProfileMonitorPlus_DBD += pgpCamlinkSupport.dbd
  ProfileMonitorPlus_DBD += rogueSupport.dbd
  ProfileMonitorPlus_DBD += andor3Support.dbd
  ProfileMonitorPlus_DBD += spectrometerRT.dbd
endif


# Install external package executables
ifeq ($(T_A),linuxRT-x86_64)
BIN_INSTALLS += $(EPICS_BASE_BIN)/caRepeater
BIN_INSTALLS += $(EPICS_BASE_BIN)/caget
BIN_INSTALLS += $(EPICS_BASE_BIN)/caput
BIN_INSTALLS += $(EPICS_BASE_BIN)/camonitor
BIN_INSTALLS += $(EPICS_BASE_BIN)/cainfo
BIN_INSTALLS += $(ECASYN_BIN)/scanner
BIN_INSTALLS += $(ETHERLAB_BIN)/ethercat
BIN_INSTALLS += $(EVRMA_MANAGER_BIN)/evrManager
BIN_INSTALLS += $(DHCPD_BIN)/dhcpd

# Install external package libraries
LIB_INSTALLS += $(FRAMEGRABBER_LIB)/PgpCardG3_CLink.ko
LIB_INSTALLS += $(EVRMA_DRIVER_LIB)/evrma.ko
LIB_INSTALLS += $(ETHERCAT_MASTER_LIB)/ec_master.ko
LIB_INSTALLS += $(ETHERCAT_DEVICE_LIB)/ec_generic.ko
LIB_INSTALLS += $(wildcard $(ADANDOR3)/lib/$(T_A)/libatcore.so*)
LIB_INSTALLS += $(OCEANDIRECT_LIB)/liboceandirect.so
LIB_INSTALLS += $(wildcard $(LIBUSB01_LIB)/libusb-0.1.so*)
endif

USR_SRCS_DEFAULT += ProfileMonitorMain.cpp
ProfileMonitor_SRCS         += ProfileMonitor_registerRecordDeviceDriver.cpp
ProfileMonitor_SRCS_vxWorks += -nil-
ProfileMonitor_SRCS += dynamicRoi.c
ProfileMonitor_SRCS += NDPluginDynamicROI.cpp
ProfileMonitor_SRCS += NDArrayCopy.c

ProfileMonitorPlus_SRCS     += ProfileMonitorPlus_registerRecordDeviceDriver.cpp
ProfileMonitorPlus_SRCS_vxWorks += -nil-
ProfileMonitorPlus_SRCS += dynamicRoi.c
ProfileMonitorPlus_SRCS += NDPluginDynamicROI.cpp
ProfileMonitorPlus_SRCS += NDArrayCopy.c

# Add all the support libraries needed by this IOC
ProfileMonitor_LIBS += devIocStats
ProfileMonitor_LIBS += autosave
ProfileMonitor_LIBS += caPutLog
ProfileMonitor_LIBS += prosilica
ProfileMonitor_LIBS += ecAsyn rtutils scannerlib 
ProfileMonitor_LIBS += qsrv
#areaDetector
ProfileMonitor_LIBS += NDPlugin
ProfileMonitor_LIBS += NDDriverStdArrays
ProfileMonitor_LIBS += pgpEdt
ProfileMonitor_LIBS += ADBase
ProfileMonitor_LIBS += calc
ProfileMonitor_LIBS += seqCar seq pv
ProfileMonitor_LIBS += busy
ProfileMonitor_LIBS += netCDF
ProfileMonitor_LIBS += NeXus
ProfileMonitor_LIBS += xml2 tiff jpeg
ProfileMonitor_LIBS += hdf5 hdf5_hl
ProfileMonitor_LIBS += sscan
ProfileMonitor_LIBS += asyn
ProfileMonitor_LIBS += szip
ProfileMonitor_LIBS += zlib
ProfileMonitor_LIBS += timeStampSource
ProfileMonitor_LIBS += perfMeasure
ProfileMonitor_LIBS += PvAPI
ProfileMonitor_LIBS += z
ProfileMonitor_LIBS += lzma
ProfileMonitor_LIBS += axisTicks
ProfileMonitor_LIBS += evrSupport
ProfileMonitor_LIBS += devMrfEr
ProfileMonitor_LIBS += BsaCore
ProfileMonitor_LIBS += stream
ProfileMonitor_LIBS += pcre
ProfileMonitor_LIBS += ntndArrayConverter
ProfileMonitor_LIBS += nt
ProfileMonitor_LIBS += pvDatabase

ProfileMonitor_INCLUDES += $(ECASYN)/include
ProfileMonitor_LIBS += drvMrf
evrma_DIR = $(EVRMA_LIB)
ProfileMonitor_LIBS += evrma

ifeq ($(T_A),linuxRT-x86_64)
  ProfileMonitorPlus_LIBS += $(ProfileMonitor_LIBS)
  ProfileMonitorPlus_LIBS += pgpCamlink
  ProfileMonitorPlus_LIBS += rogue-core
  ProfileMonitorPlus_LIBS += mcoreutils
  ProfileMonitorPlus_LIBS += andor3
  # Andor3 vendor library
  PROD_SYS_LIBS_Linux += atcore
  ProfileMonitorPlus_LIBS += spectrometerRT
  ProfileMonitorPlus_SYS_LIBS += oceandirect usb-0.1
endif

# Finally link to the EPICS Base libraries
USR_LIBS    += $(EPICS_BASE_PVA_CORE_LIBS)
USR_LIBS    += $(EPICS_BASE_IOC_LIBS)

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

