################################################################
#   SPDX-License-Identifier: BSD-3-Clause
#   Copyright(c) 2007-2026 Intel Corporation
# 
#  version: QAT.B.3.15.0-00012
#   These contents may have been developed with support from one or more
#   Intel-operated generative artificial intelligence solutions.
################################################################

.include <bsd.init.mk>
.PATH: ${QATPATH}/qat_hw

KMOD = qat_hw

MK_AUTO_OBJ = yes

NO_OBJ = 1

SRCS+= qat_c3xxx/adf_c3xxx_hw_data.c qat_c3xxx/adf_drv.c
SRCS+= qat_c3xxxvf/adf_c3xxxvf_hw_data.c qat_c3xxxvf/adf_drv.c
SRCS+= qat_c4xxx/adf_c4xxx_hw_data.c qat_c4xxx/adf_drv.c
SRCS+= qat_c4xxx/adf_c4xxx_ae_config.c qat_c4xxx/adf_c4xxx_misc_error_stats.c
SRCS+= qat_c4xxx/adf_c4xxx_pke_replay_stats.c qat_c4xxx/adf_c4xxx_ras.c
SRCS+= qat_c4xxx/adf_c4xxx_res_part.c qat_c4xxx/adf_c4xxx_reset.c
SRCS+= qat_c4xxxvf/adf_c4xxxvf_hw_data.c qat_c4xxxvf/adf_drv.c
SRCS+= qat_c62x/adf_c62x_hw_data.c qat_c62x/adf_drv.c
SRCS+= qat_c62xvf/adf_c62xvf_hw_data.c qat_c62xvf/adf_drv.c
SRCS+= qat_200xx/adf_200xx_hw_data.c qat_200xx/adf_drv.c
SRCS+= qat_200xxvf/adf_200xxvf_hw_data.c qat_200xxvf/adf_drv.c
SRCS+= qat_4xxx/adf_4xxx_hw_data.c qat_4xxx/adf_drv.c
SRCS+= qat_4xxxvf/adf_4xxxvf_hw_data.c qat_4xxxvf/adf_drv.c
SRCS+= qat_420xx/adf_420xx_hw_data.c qat_420xx/adf_drv.c
SRCS+= qat_420xxvf/adf_420xxvf_hw_data.c qat_420xxvf/adf_drv.c
SRCS+= qat_dh895xcc/adf_dh895xcc_hw_data.c qat_dh895xcc/adf_drv.c
SRCS+= qat_dh895xccvf/adf_dh895xccvf_hw_data.c qat_dh895xccvf/adf_drv.c
SRCS+= device_if.h bus_if.h vnode_if.h pci_if.h cryptodev_if.h

.if !defined(LINUXKPI_INCLUDE)
LINUXKPI_INCLUDES+= -I${SYSDIR}/compat/linuxkpi/common/include \
                    -I${SYSDIR}/compat/linuxkpi/dummy/include
.endif

.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 60000
NO_WADDRESS_OF_PACKED_MEMBER = -Wno-address-of-packed-member
CWARNFLAGS.adf_4xxx_hw_data.c= ${NO_WADDRESS_OF_PACKED_MEMBER}
CWARNFLAGS.adf_420xx_hw_data.c= ${NO_WADDRESS_OF_PACKED_MEMBER}
.endif

CFLAGS+= -I${QATPATH}/include
CFLAGS+= -I${QATPATH}/qat_common
CFLAGS+= ${LINUXKPI_INCLUDES}

.ifdef ICP_HB_FAIL_SIM
CFLAGS+= -DQAT_HB_FAIL_SIM
.endif

.ifdef ICP_QAT_DBG
CFLAGS+= -DQAT_DBG
.endif

CLEANFILES += .depend.*

distclean: clean cleandepend cleandir

all: ${PROG}

install:
	@make all
	${INSTALL} -T release -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
	    ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/

uninstall:
	@rm -rf $(KMODDIR)/${PROG}

.include <auto.obj.mk>
.include <bsd.kmod.mk>
