# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note OR MIT
#
# (C) COPYRIGHT 2019-2024 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
# Foundation, and any use by you of this program is subject to the terms
# of such GNU license.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you can access it online at
# http://www.gnu.org/licenses/gpl-2.0.html.
#
#

# make $(src) as absolute path if it is not already, by prefixing $(srctree)
# This is to prevent any build issue due to wrong path.
src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src))

obj-$(CONFIG_MALI_ARBITER_MODULES) += arbiter/
obj-$(CONFIG_MALI_GPU_POWER_MODULES) += power/
obj-$(CONFIG_MALI_PARTITION_MANAGER) += ptm/

ifeq ($(MALI_KCONFIG_EXT_PREFIX),)
    obj-$(CONFIG_MALI_XEN) += ../../../xen/arm/
endif

obj-y += tests/

INCLUDES = \
        -I$(src)/../../../../include \
        -I$(src) \
        -I$(src)/../midgard \
        -I$(src)/../midgard/arbiter \
        -I$(src)/../midgard/tests/include \
        -I$(src)/arbiter/mali_arbiter/tests/mali_kutf_arbiter


ifneq ($(CONFIG_MALI_PARTITION_MANAGER),n)
INCLUDES += \
        -I$(src)/ptm/common \
        -I$(src)/ptm/tests/thirdparty
endif

ifeq ($(CONFIG_MALI_DEBUG), y)
    MALI_UNIT_TEST = 1
else
    MALI_UNIT_TEST ?= 0
endif

ccflags-y += $(INCLUDES) \
	-DMALI_UNIT_TEST=$(MALI_UNIT_TEST)
subdir-ccflags-y += $(INCLUDES) \
	-DMALI_UNIT_TEST=$(MALI_UNIT_TEST)
