########################################################################### ###
#@File           Makefile
#@Title
#@Copyright     Copyright (c) Innosilicon Technology Ltd. All Rights Reserved
#@Description
#@License       Dual MIT/GPLv2
#
# The contents of this file are subject to the MIT license as set out below.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 2 ("GPL") in which case the provisions
# of GPL are applicable instead of those above.
#
# If you wish to allow use of your version of this file only under the terms of
# GPL, and not to allow others to use your version of this file under the terms
# of the MIT license, indicate your decision by deleting the provisions above
# and replace them with the notice and other provisions required by GPL as set
# out in the file called "GPL-COPYING" included in this distribution. If you do
# not delete the provisions above, a recipient may use your version of this file
# under the terms of either the MIT license or GPL.
#
# This License is also included in this distribution in the file called
# "MIT-COPYING".
#
# EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
# PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
### ###########################################################################

INNOGPU_INCLUDE := \
	-I$(INNOGPU_PRO_PATH)/innogpu/efuse \
	-I$(INNOGPU_PRO_PATH)/innogpu/hal \
	-I$(INNOGPU_PRO_PATH)/innogpu/hal/dma \
	-I$(INNOGPU_PRO_PATH)/innogpu/pcie \
	-I$(INNOGPU_PRO_PATH)/innogpu/osfunc \
	-I$(INNOGPU_PRO_PATH)/innogpu/ion \
	-I$(INNOGPU_PRO_PATH)/innogpu/hwinfo \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips/g0/ \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips/g0/g0_soc \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips/g1/ \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips/g1/g1_soc \
	-I$(INNOGPU_PRO_PATH)/innoion \
	-I$(INNOGPU_PRO_PATH)/innoion/include/linux \
	-I$(INNOGPU_PRO_PATH)/innogpu \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips/g1p \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips/g1p/g1p_soc \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips/g0m \
	-I$(INNOGPU_PRO_PATH)/innogpu/chips/g0m/g0m_soc \
	-I$(INNOGPU_PRO_PATH)/innosrvkm/quirks/

INNOGPU_OBJS := \
	hal/hal.o \
	hal/hal_power.o \
	hal/hal_irq.o \
	hal/hal_pll.o \
	hal/hal_vram.o \
	hal/hal_regif.o \
	hal/hal_interface.o \
	hal/hal_bmc.o \
	hal/hal_gpu_info.o \
	hal/dma/hal_dma.o \
	hal/hal_mcufw_comm.o \
	pcie/innogpu_pci_drv.o \
	osfunc/inno_cpumask.o \
	osfunc/kernel_compat.o \
	osfunc/inno_task.o \
	osfunc/inno_mm.o \
	osfunc/inno_misc.o \
	osfunc/inno_timer.o \
	osfunc/inno_lock.o \
	osfunc/inno_dma.o \
	osfunc/inno_drm.o \
	osfunc/inno_idr.o \
	osfunc/inno_firmware.o \
	osfunc/inno_uaccess.o \
	osfunc/inno_pci.o \
	osfunc/inno_mtrr.o \
	osfunc/inno_plat_dev.o \
	osfunc/inno_fence.o \
	osfunc/inno_interrupt.o \
	osfunc/inno_fs.o \
	osfunc/inno_io.o \
	osfunc/inno_waitqueue.o \
	osfunc/inno_drm_mode.o \
	osfunc/inno_math.o \
	osfunc/inno_pm_runtime.o \
	osfunc/inno_check.o \
	osfunc/inno_debug.o\
	osfunc/inno_insn.o\
	chips/g1/g1_common.o \
	chips/g1/g1_soc/g1_soc.o \
	chips/g1/g1_soc/g1_soc_hwinfo.o \
	chips/g0/g0_soc/g0_soc.o \
	chips/g0/g0_soc/g0_soc_hwinfo.o \
	hwinfo/hwinfo.o \
	chips/g1p/g1p_soc/g1p_soc.o \
	chips/g1p/g1p_soc/g1p_soc_hwinfo.o \
	chips/g1p/g1p_common.o \
	chips/g0m/g0m_soc/g0m_soc.o \
	chips/g0m/g0m_soc/g0m_soc_hwinfo.o \
	chips/g0m/g0m_common.o

INNOGPU = $(addprefix innogpu/, $(INNOGPU_OBJS))

$(srctree)/$(src)/innogpu/hal/hal_regif.o:
ifeq (,$(wildcard $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.c))
  ifeq ($(CONFIG_X86),y)
	cp -f $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o.x86.hex $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o
  else ifeq ($(CONFIG_ARM),y)
	cp -f $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o.arm.hex $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o
  else ifeq ($(CONFIG_ARM64),y)
	cp -f $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o.arm64.hex $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o
  else ifeq ($(CONFIG_LOONGARCH),y)
	cp -f $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o.loongarch.hex $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o
  else ifeq ($(CONFIG_RISCV),y)
	cp -f $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o.riscv.hex $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o
  else ifeq ($(CONFIG_SW64),y)
	cp -f $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o.sw_64.hex $(INNOGPU_PRO_PATH)/innogpu/hal/hal_regif.o
  endif
endif
