blob: 31632de3c9047d0baa5a2894bcbe7c2d1834ab3a [file] [log] [blame]
Sudheer Papothic9443c22018-08-28 05:35:34 +05301# We can build either as part of a standalone Kernel build or as
2# an external module. Determine which mechanism is being used
3ifeq ($(MODNAME),)
4 KERNEL_BUILD := 1
5else
6 KERNEL_BUILD := 0
7endif
8
9ifeq ($(KERNEL_BUILD), 1)
10 # These are configurable via Kconfig for kernel-based builds
11 # Need to explicitly configure for Android-based builds
12 AUDIO_BLD_DIR := $(shell pwd)/kernel/msm-4.19
13 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
14endif
15
16ifeq ($(KERNEL_BUILD), 0)
17 ifeq ($(CONFIG_ARCH_KONA), y)
18 include $(AUDIO_ROOT)/config/konaauto.conf
Sudheer Papothic9443c22018-08-28 05:35:34 +053019 INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
20 endif
Vatsal Buchad284ff12019-04-01 15:34:50 +053021 ifeq ($(CONFIG_ARCH_LITO), y)
22 include $(AUDIO_ROOT)/config/litoauto.conf
Vatsal Buchad284ff12019-04-01 15:34:50 +053023 INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
24 endif
Sudheer Papothic9443c22018-08-28 05:35:34 +053025
26endif
27
28# As per target team, build is done as follows:
29# Defconfig : build with default flags
30# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
31# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
32# Perf : Using appropriate msmXXXX-perf_defconfig
33#
34# Shipment builds (user variants) should not have any debug feature
35# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
36# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
37# there is no other way to identify defconfig builds, QTI internal
38# representation of perf builds (identified using the string 'perf'),
39# is used to identify if the build is a slub or defconfig one. This
40# way no critical debug feature will be enabled for perf and shipment
41# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
42# config.
43
44############ UAPI ############
45UAPI_DIR := uapi
46UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
47
48############ COMMON ############
49COMMON_DIR := include
50COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
51
52############ WCD938X ############
53
54# for WCD938X Codec
55ifdef CONFIG_SND_SOC_WCD938X
56 WCD938X_OBJS += wcd938x.o
57 WCD938X_OBJS += wcd938x-regmap.o
58 WCD938X_OBJS += wcd938x-tables.o
59 WCD938X_OBJS += wcd938x-mbhc.o
60endif
61
62ifdef CONFIG_SND_SOC_WCD938X_SLAVE
63 WCD938X_SLAVE_OBJS += wcd938x-slave.o
64endif
65
66LINUX_INC += -Iinclude/linux
67
68INCS += $(COMMON_INC) \
69 $(UAPI_INC)
70
71EXTRA_CFLAGS += $(INCS)
72
73
74CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
75 -DANI_LITTLE_BIT_ENDIAN \
76 -DDOT11F_LITTLE_ENDIAN_HOST \
77 -DANI_COMPILER_TYPE_GCC \
78 -DANI_OS_TYPE_ANDROID=6 \
79 -DPTT_SOCK_SVC_ENABLE \
80 -Wall\
Sudheer Papothic9443c22018-08-28 05:35:34 +053081 -D__linux__
82
83KBUILD_CPPFLAGS += $(CDEFINES)
84
85# Currently, for versions of gcc which support it, the kernel Makefile
86# is disabling the maybe-uninitialized warning. Re-enable it for the
87# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
88# will override the kernel settings.
89ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
90EXTRA_CFLAGS += -Wmaybe-uninitialized
91endif
92#EXTRA_CFLAGS += -Wmissing-prototypes
93
94ifeq ($(call cc-option-yn, -Wheader-guard),y)
95EXTRA_CFLAGS += -Wheader-guard
96endif
97
98ifeq ($(KERNEL_BUILD), 0)
99KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
100KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
101KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
102KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
103KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
104endif
105
106# Module information used by KBuild framework
107obj-$(CONFIG_SND_SOC_WCD938X) += wcd938x_dlkm.o
108wcd938x_dlkm-y := $(WCD938X_OBJS)
109
110obj-$(CONFIG_SND_SOC_WCD938X_SLAVE) += wcd938x_slave_dlkm.o
111wcd938x_slave_dlkm-y := $(WCD938X_SLAVE_OBJS)