# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note OR MIT
#
# (C) COPYRIGHT 2020-2021 Arm Limited or its affiliates. All rights reserved.
#
#

# When building in module mode, link to the common source such that RG and AW
# can resolve their own build dependencies in parallel builds.
$(obj)/mali_gpu_ptm_msg.tmp.c: $(src)/../common/mali_gpu_ptm_msg.c
	ln -sf $(src)/../common/mali_gpu_ptm_msg.c $(src)/mali_gpu_ptm_msg.tmp.c

# Add this link to be cleaned when make clean is invoked.
clean-files += mali_gpu_ptm_msg.tmp.c

obj-$(CONFIG_MALI_PARTITION_MANAGER) += mali_gpu_resource_group.o
mali_gpu_resource_group-y = mali_gpu_resource_group_main.o

# Only include the common objects when building as a module, in built-in  mode
# these symbols will already be available.
mali_gpu_resource_group-m += mali_gpu_ptm_msg.tmp.o

# Set up defaults if not defined by build system
MALI_ARBITER_TEST_API ?= 0

# Set up our defines, which will be passed to gcc
DEFINES = \
	-DMALI_ARBITER_TEST_API=$(MALI_ARBITER_TEST_API)

# Use our defines when compiling
ccflags-y += $(DEFINES)
ccflags-y += -I$(srctree)/$(src)/../include
ccflags-y += -I$(srctree)/$(src)/../common
ccflags-y += -I$(srctree)/$(src)/../../include
ccflags-y += -I$(srctree)/$(src)/../../mali_arbiter
subdir-ccflags-y += $(DEFINES)
