ifeq ($(Driver_Install_Mode), vnpu_guest)
    MODULE_NAME = asdrv_vtrs
else ifeq ($(TARGET_TYPE), ascend610Lite)
    MODULE_NAME = asdrv_trs_v3
else
    MODULE_NAME = asdrv_trs
endif

obj-m += $(MODULE_NAME).o
$(MODULE_NAME)-objs := trs_init.o

ifeq ($(Driver_Install_Mode), vnpu_guest) #asdrv_vtrs
    ifeq ($(TOP_DIR),)
        ifneq ($(filter $(TARGET_CHIP_ID), hi1980b hi1980d),)
            include $(HIAI_DKMS_DIR)/trs/lba/near/sriov_sec_enhanced/adapt/lba_sec_eh.mk
            include $(HIAI_DKMS_DIR)/trs/trs_core/trs_core.mk
        endif
    else
        ifneq ($(filter $(PRODUCT), ascend910B ascend950 ascend950esl),)
            ifeq ($(PRODUCT_SIDE), host)
                include $(DRIVER_KERNEL_DIR)/src/trs/lba/near/sriov_sec_enhanced/adapt/lba_sec_eh.mk
                include $(DRIVER_KERNEL_DIR)/src/trs/trs_core/trs_core.mk
            endif
        endif
    endif
else  #asdrv_trs
    ifeq ($(TOP_DIR),)
        ifneq ($(filter $(TARGET_CHIP_ID), hi1910b hi1980b hi1980d),)
            include $(HIAI_DKMS_DIR)/trs/lba/near/sia/adapt/lba_sia.mk
            include $(HIAI_DKMS_DIR)/trs/trs_core/trs_core.mk
        endif

        ifneq ($(filter $(TARGET_CHIP_ID), hi1910b hi1980b hi1980d),)
            include $(HIAI_DKMS_DIR)/trs/trs_stars/adapt/near/trs_stars.mk
            include $(HIAI_DKMS_DIR)/trs/shr_id/shr_id.mk
        endif

        ifneq ($(filter $(TARGET_CHIP_ID), hi1980b),)
            include $(HIAI_DKMS_DIR)/trs/lba/near/sriov_sec_enhanced/agent/lba_sec_eh_agent.mk
        endif
    else
        ifneq ($(filter $(PRODUCT), ascend310B ascend310Brc mc62cm12aesl mc62cm12a ascend910B ascend950 ascend950esl ascend910_96 ascend910_96esl),)
            ifeq ($(PRODUCT_SIDE), host)
                include $(DRIVER_KERNEL_DIR)/src/trs/lba/near/sia/adapt/lba_sia.mk
            else
                ifneq ($(filter $(PRODUCT), mc62cm12aesl mc62cm12a),)
                    include $(DRIVER_KERNEL_DIR)/src/trs/mdc/lba_local_sia_adapt/lba_sia.mk
                    include $(DRIVER_KERNEL_DIR)/src/trs/mdc/id_pool/id_pool.mk
                else
                    include $(DRIVER_KERNEL_DIR)/src/trs/lba/local/sia/adapt/lba_sia.mk
                    include $(DRIVER_KERNEL_DIR)/src/trs/id_pool/id_pool.mk
                endif
            endif

            ifneq ($(filter $(PRODUCT), mc62cm12aesl mc62cm12a), )
                include $(DRIVER_KERNEL_DIR)/src/trs/mdc/trs_core/trs_core.mk
                include $(DRIVER_KERNEL_DIR)/src/trs/mdc/shr_id/shr_id.mk
            else
                include $(DRIVER_KERNEL_DIR)/src/trs/trs_core/trs_core.mk
            endif
        endif

        ifneq ($(filter $(PRODUCT), ascend310B ascend910B ascend950 ascend950esl ascend910_96 ascend910_96esl),)
            ifeq ($(PRODUCT_SIDE), host)
                include $(DRIVER_KERNEL_DIR)/src/trs/trs_stars/adapt/near/trs_stars.mk
                include $(DRIVER_KERNEL_DIR)/src/trs/shr_id/shr_id.mk
            else
                include $(DRIVER_KERNEL_DIR)/src/trs/lba/near/sia/agent/lba_sia_agent.mk
            endif
        endif

        ifneq ($(filter $(PRODUCT), ascend310B ascend310Brc ascend910B),)
            ifeq ($(PRODUCT_SIDE), device)
                include $(DRIVER_KERNEL_DIR)/src/trs/trs_stars/adapt/local/trs_stars.mk
            endif
        endif

        ifeq ($(PRODUCT_SIDE), device)
            ifneq ($(filter $(PRODUCT), ascend610Lite mc62cm12aesl mc62cm12a),)
                include $(DRIVER_KERNEL_DIR)/src/trs/mdc/tsmng/tsmng.mk
            else
                include $(DRIVER_KERNEL_DIR)/src/trs/tsmng/tsmng.mk
            endif
        endif

        ifneq ($(filter $(PRODUCT), ascend310Brc ascend910B ascend950 ascend950esl ascend910_96 ascend910_96esl),)
            ifeq ($(PRODUCT_SIDE), device)
                include $(DRIVER_KERNEL_DIR)/src/trs/lba/local/mia/adapt/lba_mia.mk
            endif
        endif

        ifneq ($(filter $(PRODUCT), ascend910B ascend950 ascend950esl ascend910_96 ascend910_96esl),)
            ifeq ($(PRODUCT_SIDE), device)
                include $(DRIVER_KERNEL_DIR)/src/trs/lba/near/mia/agent/lba_mia_agent.mk
            endif
        endif

        ifneq ($(filter $(PRODUCT), ascend910B),)
            ifeq ($(PRODUCT_SIDE), host)
                include $(DRIVER_KERNEL_DIR)/src/trs/lba/near/sriov_sec_enhanced/agent/lba_sec_eh_agent.mk
            endif
        endif
    endif
endif

ifeq ($(use_hitest),kernel_true)
    export HITESTCC := $(CC)
    export HITESTLD := $(LD)
    CC = hitest_gcc
    LD = hitest_ld
endif