# SPDX-License-Identifier: GPL-2.0

COMMON_SRC_DIRECTORY=../../common
VDMA_SRC_DIRECTORY=../vdma
UTILS_SRC_DIRECTORY=../utils
BASE_INCLUDE_DIRECTORY=..

obj-m := hailo_pci.o

hailo_pci-objs += src/pcie.o
hailo_pci-objs += src/fops.o
hailo_pci-objs += src/sysfs.o
hailo_pci-objs += src/nnc.o
hailo_pci-objs += src/soc.o

hailo_pci-objs += $(COMMON_SRC_DIRECTORY)/fw_validation.o
hailo_pci-objs += $(COMMON_SRC_DIRECTORY)/fw_operation.o
hailo_pci-objs += $(COMMON_SRC_DIRECTORY)/pcie_common.o
hailo_pci-objs += $(COMMON_SRC_DIRECTORY)/vdma_common.o
hailo_pci-objs += $(COMMON_SRC_DIRECTORY)/hailo_resource.o

hailo_pci-objs += $(UTILS_SRC_DIRECTORY)/logs.o

hailo_pci-objs += $(VDMA_SRC_DIRECTORY)/vdma.o
hailo_pci-objs += $(VDMA_SRC_DIRECTORY)/memory.o
hailo_pci-objs += $(VDMA_SRC_DIRECTORY)/ioctl.o

ccflags-y      += -Werror
ccflags-y      += -I$(src)/include
ccflags-y      += -I$(src)/$(COMMON_SRC_DIRECTORY)
ccflags-y      += -I$(src)/$(BASE_INCLUDE_DIRECTORY)

clean-files := $(hailo_pci-objs)

UNAME_STR=$(shell uname -a)
ifneq (,$(findstring raspi, $(UNAME_STR)))
    ccflags-y      += -DHAILO_RASBERRY_PIE
endif

ifeq ($(EMULATOR), 1)
    ccflags-y      += -DHAILO_EMULATOR
endif