#############################################################################
#
# Copyright (c) 2014 - 2016 Samsung Electronics Co., Ltd. All rights reserved
#
#############################################################################

# Needed since this subdir is symlinked in the main Kernel tree
# without this our samsung subdir is NOT cleaned.
clean-files := *.o *.ko

ifneq ($(CONFIG_SCSC_CORE),n)

ccflags-y +=  -Iinclude/scsc
ccflags-y += $(CONFIG_SAMSUNG_MAXWELL_EXTRA)

obj-$(CONFIG_SCSC_DEBUG) += scsc_logring.o
scsc_logring-y += scsc_logring_main.o scsc_logring_ring.o scsc_logring_debugfs.o
##
## The following cumbersome ifeq/else is the only way to make
## this CONFIG_SCSC_PRINTK propagate correctly in any scenario (y,m,n)
## Otherwise using ONLY the else branch when CONFIG_SCSC_DEBUG evaluates
## to m ==>> ccflags-m does NOT work correctly in every build scenario:
## - kernel debug modules : builtin with scsc_logring support
## - kernel nodebug modules : builtins without scsc_logring support
## - kernel debug|nodebug nomodules : no builtin / no scsclogring
##
ifeq ($(CONFIG_SCSC_DEBUG), m)
ccflags-y += -DCONFIG_SCSC_PRINTK
else
ccflags-$(CONFIG_SCSC_DEBUG) += -DCONFIG_SCSC_PRINTK
endif

ifneq ($(CONFIG_SCSC_DEBUG),n)
ccflags-$(CONFIG_SCSC_STATIC_RING)	+= -DCONFIG_SCSC_STATIC_RING_SIZE=$(CONFIG_SCSC_STATIC_RING_SIZE)
endif

#pcie_module for static functions and registration of client modules (only core)
#pcie_mif for instance
obj-$(CONFIG_SCSC_PCIE) += scsc_pcie_mif.o
scsc_pcie_mif-y += pcie_mif_module.o pcie_mif.o pcie_proc.o

obj-$(CONFIG_SCSC_PLATFORM) += scsc_platform_mif.o
scsc_platform_mif-y += platform_mif_module.o platform_mif.o

#core_module for static functions and registration client module (all the service driver modules -wlan, bt,...-)
#core for instance
obj-$(CONFIG_SCSC_CORE_CM) += scsc_mx.o
scsc_mx-y += \
	mxlog_transport.o \
	fw_panic_record.o \
	panicmon.o \
	suspendmon.o \
	mxlog.o \
	mxproc.o \
	scsc_service.o \
	scsc_mx_module.o \
	scsc_mx_impl.o \
	mxman.o \
	miframman.o \
	mifmboxman.o \
	mifproc.o \
	mifintrbit.o \
	fwhdr.o \
	fwimage.o \
	cpacket_buffer.o \
	mifstream.o \
	mxmgmt_transport.o \
	gdb_transport.o \
	mx140_file.o

ifneq ($(CONFIG_SCSC_CM_MX_CLIENT_TEST),n)
obj-$(CONFIG_SCSC_CM_MX_CLIENT_TEST) += mx_client_test.o
mx_client_test-y += client_test.o
endif

ifneq ($(CONFIG_SCSC_MMAP),n)
obj-$(CONFIG_SCSC_MMAP) += scsc_mmap.o
scsc_mmap-y += mx_mmap.o
endif

ifneq ($(CONFIG_SCSC_CLK20MHZ),n)
obj-$(CONFIG_SCSC_CLK20MHZ) += scsc_mx140_clk.o
scsc_mx140_clk-y += mx140_clk.o
ifeq ($(CONFIG_SCSC_CLK20MHZ_TEST),y)
scsc_mx140_clk-y += mx140_clk_test.o
endif
endif

obj-$(CONFIG_SCSC_DBG_SAMPLER) += scsc_dbg_sampler.o
scsc_dbg_sampler-y += mx_dbg_sampler.o

endif

