blob: 309089074f24267de3833b913ae670a55e353bba [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
19 export
20 INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
21 endif
22
23endif
24
25# As per target team, build is done as follows:
26# Defconfig : build with default flags
27# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
28# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
29# Perf : Using appropriate msmXXXX-perf_defconfig
30#
31# Shipment builds (user variants) should not have any debug feature
32# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
33# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
34# there is no other way to identify defconfig builds, QTI internal
35# representation of perf builds (identified using the string 'perf'),
36# is used to identify if the build is a slub or defconfig one. This
37# way no critical debug feature will be enabled for perf and shipment
38# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
39# config.
40
41############ UAPI ############
42UAPI_DIR := uapi
43UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
44
45############ COMMON ############
46COMMON_DIR := include
47COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
48
49############ WCD938X ############
50
51# for WCD938X Codec
52ifdef CONFIG_SND_SOC_WCD938X
53 WCD938X_OBJS += wcd938x.o
54 WCD938X_OBJS += wcd938x-regmap.o
55 WCD938X_OBJS += wcd938x-tables.o
56 WCD938X_OBJS += wcd938x-mbhc.o
57endif
58
59ifdef CONFIG_SND_SOC_WCD938X_SLAVE
60 WCD938X_SLAVE_OBJS += wcd938x-slave.o
61endif
62
63LINUX_INC += -Iinclude/linux
64
65INCS += $(COMMON_INC) \
66 $(UAPI_INC)
67
68EXTRA_CFLAGS += $(INCS)
69
70
71CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
72 -DANI_LITTLE_BIT_ENDIAN \
73 -DDOT11F_LITTLE_ENDIAN_HOST \
74 -DANI_COMPILER_TYPE_GCC \
75 -DANI_OS_TYPE_ANDROID=6 \
76 -DPTT_SOCK_SVC_ENABLE \
77 -Wall\
78 -Werror\
79 -D__linux__
80
81KBUILD_CPPFLAGS += $(CDEFINES)
82
83# Currently, for versions of gcc which support it, the kernel Makefile
84# is disabling the maybe-uninitialized warning. Re-enable it for the
85# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
86# will override the kernel settings.
87ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
88EXTRA_CFLAGS += -Wmaybe-uninitialized
89endif
90#EXTRA_CFLAGS += -Wmissing-prototypes
91
92ifeq ($(call cc-option-yn, -Wheader-guard),y)
93EXTRA_CFLAGS += -Wheader-guard
94endif
95
96ifeq ($(KERNEL_BUILD), 0)
97KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
98KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
99KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
100KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
101KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
102endif
103
104# Module information used by KBuild framework
105obj-$(CONFIG_SND_SOC_WCD938X) += wcd938x_dlkm.o
106wcd938x_dlkm-y := $(WCD938X_OBJS)
107
108obj-$(CONFIG_SND_SOC_WCD938X_SLAVE) += wcd938x_slave_dlkm.o
109wcd938x_slave_dlkm-y := $(WCD938X_SLAVE_OBJS)
110
111# inject some build related information
112DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"