# SPDX-FileCopyrightText: 1998 Argonne National Laboratory
#
# SPDX-License-Identifier: EPICS

TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS BELOW HERE

# Use typed rset structure (see 3.16.1 release notes)
USR_CPPFLAGS += -DUSE_TYPED_RSET

# Build an IOC support library
#LIBRARY_IOC += digSupport

# Add all the support libraries needed by this IOC
#usbdig_LIBS += xxx

USR_LDFLAGS += -L/opt/lib
USR_SYS_LIBS += usb-1.0
USR_SYS_LIBS += hidapi-libusb


# Auto-generate a header file containing a version string.
# Version comes from the VCS if available, else date+time.
GENVERSION = digital_ioVersion.h
# Macro name
GENVERSIONMACRO = digital_ioVERSION

# Build the IOC application
PROD_IOC = AggTest

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

# AggTest.dbd will include these files:
AggTest_DBD += base.dbd
AggTest_DBD += dig.dbd

# AggTest_registerRecordDeviceDriver.cpp derives from AggTest.dbd
AggTest_SRCS += AggTest_registerRecordDeviceDriver.cpp

# Build the main IOC entry point where needed
AggTest_SRCS_DEFAULT += AggTestMain.cpp
AggTest_SRCS_vxWorks += -nil-

# Link in the code from our support library
#AggTest_LIBS += *
AggTest_LIBS += MSU_DigitalSupport

#SNCSEQ=
# To build SNL programs, SNCSEQ must be defined
# in the <top>/configure/RELEASE file
ifneq ($(SNCSEQ),)
    # Build AggTest.stt into AggTest
    AggTest_SNCFLAGS += +r
    AggTest_DBD += sncTest.dbd
    # A .stt sequence program is *not* pre-processed:
    AggTestSupport_SRCS += AggTestProgram.stt
    AggTestSupport_LIBS += seq pv
    AggTest_LIBS += seq pv

    # Build AggTestProgram as a standalone program
    PROD_HOST += AggTestProgram
    AggTestProgram_SNCFLAGS += +m
    # A .st sequence program *is* pre-processed:
    AggTestProgram_SRCS += AggTestProgram.st
    AggTestProgram_LIBS += seq pv
    AggTestProgram_LIBS += $(EPICS_BASE_HOST_LIBS)
endif

# Link QSRV (pvAccess Server) if available
ifdef EPICS_QSRV_MAJOR_VERSION
    AggTest_LIBS += qsrv
    AggTest_LIBS += $(EPICS_BASE_PVA_CORE_LIBS)
    AggTest_DBD += PVAServerRegister.dbd
    AggTest_DBD += qsrv.dbd
endif

# Finally link IOC to the EPICS Base libraries
AggTest_LIBS += $(EPICS_BASE_IOC_LIBS)

include $(TOP)/configure/RULES
#----------------------------------------
#  ADD EXTRA GNUMAKE RULES BELOW HERE

# Explicit dependency needed for generated header file
devAggTestVersion$(DEP): $(COMMON_DIR)/$(GENVERSION)

