obj-m += asdrv_dpa.o
asdrv_dpa-objs := dpa_init.o
ifeq ($(TOP_DIR),)
    # dp_proc_mng/apm
    ifneq ($(filter $(TARGET_CHIP_ID), hi1980d),)
        include $(HIAI_DKMS_DIR)/dpa/apm/apm.mk
    else ifneq ($(filter $(TARGET_CHIP_ID), hi1910b hi1980b hi1980),)
        include $(HIAI_DKMS_DIR)/dpa/dp_proc_mng/pmaster/dp_proc_mng_host.mk
    else ifeq ($(TARGET_CHIP_ID), $(ASCEND_FLORENCE_DC_V10))
        include $(HIAI_DKMS_DIR)/dpa/dp_proc_mng/pmaster/dp_proc_mng_host.mk
    endif

    #udis
    ifneq ($(filter $(TARGET_CHIP_ID), hi1980b hi1980d),)
        include $(HIAI_DKMS_DIR)/dpa/udis/udis.mk
    endif

    #rmo
    ifneq ($(filter $(TARGET_CHIP_ID), hi1980b),)
        include $(HIAI_DKMS_DIR)/dpa/rmo/rmo.mk
    endif

    EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/dpa/inc
else
    ifeq ($(PRODUCT_SIDE), host)
        # dp_proc_mng/apm
        ifneq ($(filter $(PRODUCT), ascend950 ascend950esl ascend910_55 ascend910_55fpga ascend910_55esl ascend910_96 ascend910_96esl),)
		    include ${DRIVER_KERNEL_DIR}/src/dpa/apm/apm.mk
        else ifneq ($(filter $(PRODUCT), ascend310B ascend310p ascend910B ascend910),)
            include ${DRIVER_KERNEL_DIR}/src/dpa/dp_proc_mng/master/pmaster/dp_proc_mng_host.mk
        endif

        # rmo
        ifneq ($(filter $(PRODUCT), ascend910B),)
            include ${DRIVER_KERNEL_DIR}/src/dpa/rmo/rmo.mk
        endif

        #udis
        ifneq ($(filter $(PRODUCT), ascend910B ascend950),)
            ifneq ($(ENABLE_UBE), true)
                include ${DRIVER_KERNEL_DIR}/src/dpa/udis/udis.mk
            endif
        endif
    else
        # dp_proc_mng/apm
        ifneq ($(filter $(PRODUCT), ascend950 ascend950esl ascend910_55 ascend910_55fpga ascend910_55esl ascend910_96 ascend910_96esl),)
		    include ${DRIVER_KERNEL_DIR}/src/dpa/apm/apm.mk
        else ifneq ($(filter $(PRODUCT), ascend310B ascend310Brc ascend310p ascend910B ascend910 helper310p),)
            include ${DRIVER_KERNEL_DIR}/src/dpa/dp_proc_mng/agent/device/dp_proc_mng.mk
        else ifneq ($(filter $(PRODUCT), mc62cm12a mc62cm12aesl),)
            include ${DRIVER_KERNEL_DIR}/src/dpa/mdc/dp_proc_mng.mk
        endif

        # rmo
        ifneq ($(filter $(PRODUCT), ascend950 ascend950esl ascend910_96 ascend910_96esl ascend910B),)
            include ${DRIVER_KERNEL_DIR}/src/dpa/rmo/rmo.mk
        endif

        #udis
        ifneq ($(filter $(PRODUCT), ascend910B ascend950),)
            include ${DRIVER_KERNEL_DIR}/src/dpa/udis/udis.mk
        endif
    endif
    EXTRA_CFLAGS += -I$(DRIVER_KERNEL_DIR)/src/dpa/inc
endif

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