blob: d3789b553f5b36483def78f692ab8d6d1ce96ef7 [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
Asish Bhattacharya5faacb32017-12-04 17:23:15 +05309ifeq ($(KERNEL_BUILD), 1)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053010 # These are configurable via Kconfig for kernel-based builds
11 # Need to explicitly configure for Android-based builds
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053012 AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
13 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
14endif
15
16ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053017 ifeq ($(CONFIG_ARCH_SDM845), y)
18 include $(AUDIO_ROOT)/config/sdm845auto.conf
19 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053020 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053021 endif
22 ifeq ($(CONFIG_ARCH_SDM670), y)
23 include $(AUDIO_ROOT)/config/sdm670auto.conf
24 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053025 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053026 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053027 ifeq ($(CONFIG_ARCH_SDM450), y)
28 include $(AUDIO_ROOT)/config/sdm670auto.conf
29 export
30 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
31 endif
Banajit Goswamif58e5fc2018-04-11 14:10:09 -070032 ifeq ($(CONFIG_ARCH_SM8150), y)
Xiaoyu Ye60c105d2018-04-12 12:43:13 -070033 include $(AUDIO_ROOT)/config/sm8150auto.conf
Meng Wang5fddb8d2018-01-23 16:56:56 +080034 export
Xiaoyu Ye60c105d2018-04-12 12:43:13 -070035 INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
Meng Wang5fddb8d2018-01-23 16:56:56 +080036 endif
Abhishek Arpure6d74b702018-04-05 13:50:25 +053037 ifeq ($(CONFIG_ARCH_SDM640), y)
38 include $(AUDIO_ROOT)/config/sm8150auto.conf
39 export
40 INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
41 endif
Sudheer Papothie3842cf2018-03-31 02:27:42 +053042 ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
Xiaoyu Ye60c105d2018-04-12 12:43:13 -070043 include $(AUDIO_ROOT)/config/sm8150auto.conf
Sudheer Papothie3842cf2018-03-31 02:27:42 +053044 export
Xiaoyu Ye60c105d2018-04-12 12:43:13 -070045 INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
Sudheer Papothie3842cf2018-03-31 02:27:42 +053046 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053047endif
48
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053049# As per target team, build is done as follows:
50# Defconfig : build with default flags
51# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
52# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
53# Perf : Using appropriate msmXXXX-perf_defconfig
54#
55# Shipment builds (user variants) should not have any debug feature
56# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
57# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
58# there is no other way to identify defconfig builds, QTI internal
59# representation of perf builds (identified using the string 'perf'),
60# is used to identify if the build is a slub or defconfig one. This
61# way no critical debug feature will be enabled for perf and shipment
62# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
63# config.
64
65############ UAPI ############
66UAPI_DIR := uapi
67UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
68
69############ COMMON ############
70COMMON_DIR := include
71COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
72
73############ ASoC Codecs ############
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053074ifdef CONFIG_WCD9XXX_CODEC_CORE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053075 CORE_OBJS += wcd9xxx-rst.o
76 CORE_OBJS += wcd9xxx-core-init.o
77 CORE_OBJS += wcd9xxx-core.o
78 CORE_OBJS += wcd9xxx-irq.o
79 CORE_OBJS += wcd9xxx-slimslave.o
80 CORE_OBJS += wcd9xxx-utils.o
81 CORE_OBJS += wcd9335-regmap.o
82 CORE_OBJS += wcd9335-tables.o
83 CORE_OBJS += msm-cdc-pinctrl.o
84 CORE_OBJS += msm-cdc-supply.o
85 CORE_OBJS += wcd934x/wcd934x-regmap.o
86 CORE_OBJS += wcd934x/wcd934x-tables.o
Vidyakumar Athotaaa0da742018-02-28 15:13:50 -080087 CORE_OBJS += wcd9360/wcd9360-regmap.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053088endif
89
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053090ifdef CONFIG_SND_SOC_WCD9XXX_V2
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053091 WCD9XXX_OBJS += wcd9xxx-common-v2.o
92 WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o
93 WCD9XXX_OBJS += wcdcal-hwdep.o
94 WCD9XXX_OBJS += wcd9xxx-soc-init.o
95 WCD9XXX_OBJS += wcd-dsp-utils.o
96 WCD9XXX_OBJS += wcd-dsp-mgr.o
97 WCD9XXX_OBJS += audio-ext-clk-up.o
98endif
99
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530100ifdef CONFIG_SND_SOC_WCD9335
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530101 WCD9335_OBJS += wcd9335.o
102endif
103
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530104ifdef CONFIG_SND_SOC_WSA881X
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530105 WSA881X_OBJS += wsa881x.o
106 WSA881X_OBJS += wsa881x-tables.o
107 WSA881X_OBJS += wsa881x-regmap.o
108 WSA881X_OBJS += wsa881x-temp-sensor.o
109endif
110
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530111ifdef CONFIG_SND_SOC_MSM_STUB
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530112 STUB_OBJS += msm_stub.o
113endif
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530114ifdef CONFIG_SND_SOC_WCD_SPI
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530115 SPI_OBJS += wcd-spi.o
116endif
117
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530118ifdef CONFIG_SND_SOC_WCD_CPE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530119 WCD_CPE_OBJS += wcd_cpe_core.o
120 WCD_CPE_OBJS += wcd_cpe_services.o
121endif
122
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530123ifdef CONFIG_SND_SOC_WCD_MBHC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530124 MBHC_OBJS += wcd-mbhc-v2.o
125endif
126
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530127ifdef CONFIG_SND_SOC_WCD_MBHC_ADC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530128 MBHC_OBJS += wcd-mbhc-adc.o
129endif
130
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530131ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530132 MBHC_OBJS += wcd-mbhc-legacy.o
133endif
134
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530135ifdef CONFIG_SND_SOC_MSM_HDMI_CODEC_RX
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530136 HDMICODEC_OBJS += msm_hdmi_codec_rx.o
137endif
138
139LINUX_INC += -Iinclude/linux
140
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530141INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530142 $(UAPI_INC)
143
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530144
145EXTRA_CFLAGS += $(INCS)
146
147
148CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
149 -DANI_LITTLE_BIT_ENDIAN \
150 -DDOT11F_LITTLE_ENDIAN_HOST \
151 -DANI_COMPILER_TYPE_GCC \
152 -DANI_OS_TYPE_ANDROID=6 \
153 -DPTT_SOCK_SVC_ENABLE \
154 -Wall\
155 -Werror\
156 -D__linux__
157
158KBUILD_CPPFLAGS += $(CDEFINES)
159
160# Currently, for versions of gcc which support it, the kernel Makefile
161# is disabling the maybe-uninitialized warning. Re-enable it for the
162# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
163# will override the kernel settings.
164ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
165EXTRA_CFLAGS += -Wmaybe-uninitialized
166endif
167#EXTRA_CFLAGS += -Wmissing-prototypes
168
169ifeq ($(call cc-option-yn, -Wheader-guard),y)
170EXTRA_CFLAGS += -Wheader-guard
171endif
172
173
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530174ifeq ($(KERNEL_BUILD), 0)
Meng Wange61ddb02018-03-07 11:18:35 +0800175KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
176KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530177endif
178
179ifeq ($(KERNEL_BUILD), 1)
180 obj-y += wcd934x/
181 obj-y += sdm660_cdc/
182 obj-y += msm_sdw/
183endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530184# Module information used by KBuild framework
185obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o
186wcd_core_dlkm-y := $(CORE_OBJS)
187
188obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += wcd9xxx_dlkm.o
189wcd9xxx_dlkm-y := $(WCD9XXX_OBJS)
190
191obj-$(CONFIG_SND_SOC_WCD9335) += wcd9335_dlkm.o
192wcd9335_dlkm-y := $(WCD9335_OBJS)
193
194obj-$(CONFIG_SND_SOC_WSA881X) += wsa881x_dlkm.o
195wsa881x_dlkm-y := $(WSA881X_OBJS)
196
197obj-$(CONFIG_SND_SOC_MSM_STUB) += stub_dlkm.o
198stub_dlkm-y := $(STUB_OBJS)
199
200obj-$(CONFIG_SND_SOC_WCD_CPE) += wcd_cpe_dlkm.o
201wcd_cpe_dlkm-y := $(WCD_CPE_OBJS)
202
203obj-$(CONFIG_SND_SOC_WCD_SPI) += wcd_spi_dlkm.o
204wcd_spi_dlkm-y := $(SPI_OBJS)
205
206obj-$(CONFIG_SND_SOC_WCD_MBHC) += mbhc_dlkm.o
207mbhc_dlkm-y := $(MBHC_OBJS)
208
209obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += hdmi_dlkm.o
210hdmi_dlkm-y := $(HDMICODEC_OBJS)
211
212# inject some build related information
213DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"