blob: 1a6d45a88871a76d293516d30fb506e84cd8450c [file] [log] [blame]
Laxminath Kasam8b1366a2017-10-05 01:44:16 +05301# We can build either as part of a standalone Kernel build or as
2# an external module. Determine which mechanism is being used
Asish Bhattacharya5faacb32017-12-04 17:23:15 +05303ifeq ($(MODNAME),)
4 KERNEL_BUILD := 1
5else
6 KERNEL_BUILD := 0
7endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +05308
9
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053010ifeq ($(KERNEL_BUILD), 1)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053011 # These are configurable via Kconfig for kernel-based builds
12 # Need to explicitly configure for Android-based builds
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053013 AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
14 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
15endif
16
17ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053018 ifeq ($(CONFIG_ARCH_SDM845), y)
19 include $(AUDIO_ROOT)/config/sdm845auto.conf
20 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053021 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053022 endif
23 ifeq ($(CONFIG_ARCH_SDM670), y)
24 include $(AUDIO_ROOT)/config/sdm670auto.conf
25 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053026 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053027 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053028 ifeq ($(CONFIG_ARCH_SDM450), y)
29 include $(AUDIO_ROOT)/config/sdm670auto.conf
30 export
31 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
32 endif
Meng Wang5fddb8d2018-01-23 16:56:56 +080033 ifeq ($(CONFIG_ARCH_SDM855), y)
34 include $(AUDIO_ROOT)/config/sdm855auto.conf
35 export
36 INCS += -include $(AUDIO_ROOT)/config/sdm855autoconf.h
37 endif
Sudheer Papothie3842cf2018-03-31 02:27:42 +053038 ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
39 include $(AUDIO_ROOT)/config/sdm855auto.conf
40 export
41 INCS += -include $(AUDIO_ROOT)/config/sdm855autoconf.h
42 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053043endif
44
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053045# As per target team, build is done as follows:
46# Defconfig : build with default flags
47# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
48# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
49# Perf : Using appropriate msmXXXX-perf_defconfig
50#
51# Shipment builds (user variants) should not have any debug feature
52# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
53# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
54# there is no other way to identify defconfig builds, QTI internal
55# representation of perf builds (identified using the string 'perf'),
56# is used to identify if the build is a slub or defconfig one. This
57# way no critical debug feature will be enabled for perf and shipment
58# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
59# config.
60
61############ UAPI ############
62UAPI_DIR := uapi
63UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
64
65############ COMMON ############
66COMMON_DIR := include
67COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
68
69############ ASoC Drivers ############
70
71
72# for SDM6xx sound card driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053073ifdef CONFIG_SND_SOC_SDM670
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053074 MACHINE_OBJS += sdm660-common.o
75endif
76
77# for SDM6xx sound card driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053078ifdef CONFIG_SND_SOC_INT_CODEC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053079 MACHINE_OBJS += sdm660-internal.o
80endif
81
82# for SDM6xx sound card driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053083ifdef CONFIG_SND_SOC_EXT_CODEC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053084 MACHINE_OBJS += sdm660-external.o
85 MACHINE_OBJS += sdm660-ext-dai-links.o
86endif
87
88# for SDM845 sound card driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053089ifdef CONFIG_SND_SOC_MACHINE_SDM845
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053090 MACHINE_OBJS += sdm845.o
91endif
92
Meng Wang5fddb8d2018-01-23 16:56:56 +080093# for SDM855 sound card driver
94ifdef CONFIG_SND_SOC_SDM855
95 MACHINE_OBJS += sdm855.o
96endif
97
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053098ifdef CONFIG_SND_SOC_CPE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053099 CPE_LSM_OBJS += msm-cpe-lsm.o
100endif
101
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530102ifdef CONFIG_SND_SOC_QDSP6V2
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530103 PLATFORM_OBJS += msm-audio-effects-q6-v2.o
104 PLATFORM_OBJS += msm-compress-q6-v2.o
105 PLATFORM_OBJS += msm-dai-fe.o
106 PLATFORM_OBJS += msm-dai-q6-hdmi-v2.o
107 PLATFORM_OBJS += msm-dai-q6-v2.o
108 PLATFORM_OBJS += msm-dai-slim.o
109 PLATFORM_OBJS += msm-dai-stub-v2.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530110 PLATFORM_OBJS += msm-lsm-client.o
111 PLATFORM_OBJS += msm-pcm-afe-v2.o
112 PLATFORM_OBJS += msm-pcm-dtmf-v2.o
113 PLATFORM_OBJS += msm-pcm-hostless.o
114 PLATFORM_OBJS += msm-pcm-host-voice-v2.o
115 PLATFORM_OBJS += msm-pcm-loopback-v2.o
116 PLATFORM_OBJS += msm-pcm-q6-noirq.o
117 PLATFORM_OBJS += msm-pcm-q6-v2.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530118 PLATFORM_OBJS += msm-pcm-routing-v2.o
119 PLATFORM_OBJS += msm-pcm-voice-v2.o
120 PLATFORM_OBJS += msm-pcm-voip-v2.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530121 PLATFORM_OBJS += msm-transcode-loopback-q6-v2.o
122 PLATFORM_OBJS += platform_init.o
123endif
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530124ifdef CONFIG_DOLBY_DS2
125 PLATFORM_OBJS += msm-ds2-dap-config.o
126endif
127ifdef CONFIG_DOLBY_LICENSE
128 PLATFORM_OBJS += msm-ds2-dap-config.o
129endif
Laxminath Kasam9a8caf42018-01-03 21:13:17 +0530130ifdef CONFIG_SND_HWDEP_ROUTING
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530131 PLATFORM_OBJS += msm-pcm-routing-devdep.o
132endif
133ifdef CONFIG_QTI_PP
134 PLATFORM_OBJS += msm-qti-pp-config.o
135endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530136
137LINUX_INC += -Iinclude/linux
138
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530139INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530140 $(UAPI_INC)
141
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530142EXTRA_CFLAGS += $(INCS)
143
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530144CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
145 -DANI_LITTLE_BIT_ENDIAN \
146 -DDOT11F_LITTLE_ENDIAN_HOST \
147 -DANI_COMPILER_TYPE_GCC \
148 -DANI_OS_TYPE_ANDROID=6 \
149 -DPTT_SOCK_SVC_ENABLE \
150 -Wall\
151 -Werror\
152 -D__linux__
153
154KBUILD_CPPFLAGS += $(CDEFINES)
155
156# Currently, for versions of gcc which support it, the kernel Makefile
157# is disabling the maybe-uninitialized warning. Re-enable it for the
158# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
159# will override the kernel settings.
160ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
161EXTRA_CFLAGS += -Wmaybe-uninitialized
162endif
163#EXTRA_CFLAGS += -Wmissing-prototypes
164
165ifeq ($(call cc-option-yn, -Wheader-guard),y)
166EXTRA_CFLAGS += -Wheader-guard
167endif
168
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530169ifeq ($(KERNEL_BUILD), 0)
Meng Wange61ddb02018-03-07 11:18:35 +0800170KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
171KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
172KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd934x/Module.symvers
173KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/sdm660_cdc/Module.symvers
174KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/msm_sdw/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530175endif
176ifeq ($(KERNEL_BUILD), 1)
177 obj-y += codecs/
178endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530179# Module information used by KBuild framework
180obj-$(CONFIG_SND_SOC_QDSP6V2) += platform_dlkm.o
181platform_dlkm-y := $(PLATFORM_OBJS)
182
183obj-$(CONFIG_SND_SOC_MACHINE_SDM845) += machine_dlkm.o
184machine_dlkm-y := $(MACHINE_OBJS)
185
Meng Wang5fddb8d2018-01-23 16:56:56 +0800186obj-$(CONFIG_SND_SOC_SDM855) += machine_dlkm.o
187machine_dlkm-y := $(MACHINE_OBJS)
188
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530189obj-$(CONFIG_SND_SOC_EXT_CODEC) += machine_dlkm.o
190machine_dlkm-y := $(MACHINE_OBJS)
191
192obj-$(CONFIG_SND_SOC_INT_CODEC) += machine_dlkm.o
193machine_dlkm-y := $(MACHINE_OBJS)
194
195obj-$(CONFIG_SND_SOC_CPE) += cpe_lsm_dlkm.o
196cpe_lsm_dlkm-y := $(CPE_LSM_OBJS)
197
198# inject some build related information
199DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"