blob: 3cea7df07206abd3459dd7f9db56eea79ec42be1 [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)
Soumya Managolieaff6622018-02-23 12:00:54 +053028 include $(AUDIO_ROOT)/config/sdm450auto.conf
Laxminath Kasam942d1c62017-12-29 11:02:22 +053029 export
Soumya Managolieaff6622018-02-23 12:00:54 +053030 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
Laxminath Kasam942d1c62017-12-29 11:02:22 +053031 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053032endif
33
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053034# As per target team, build is done as follows:
35# Defconfig : build with default flags
36# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
37# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
38# Perf : Using appropriate msmXXXX-perf_defconfig
39#
40# Shipment builds (user variants) should not have any debug feature
41# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
42# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
43# there is no other way to identify defconfig builds, QTI internal
44# representation of perf builds (identified using the string 'perf'),
45# is used to identify if the build is a slub or defconfig one. This
46# way no critical debug feature will be enabled for perf and shipment
47# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
48# config.
49
50############ UAPI ############
51UAPI_DIR := uapi
52UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
53
54############ COMMON ############
55COMMON_DIR := include
56COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
57
58############ ASoC Codecs ############
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053059ifdef CONFIG_WCD9XXX_CODEC_CORE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053060 CORE_OBJS += wcd9xxx-rst.o
61 CORE_OBJS += wcd9xxx-core-init.o
62 CORE_OBJS += wcd9xxx-core.o
63 CORE_OBJS += wcd9xxx-irq.o
64 CORE_OBJS += wcd9xxx-slimslave.o
65 CORE_OBJS += wcd9xxx-utils.o
66 CORE_OBJS += wcd9335-regmap.o
67 CORE_OBJS += wcd9335-tables.o
68 CORE_OBJS += msm-cdc-pinctrl.o
69 CORE_OBJS += msm-cdc-supply.o
70 CORE_OBJS += wcd934x/wcd934x-regmap.o
71 CORE_OBJS += wcd934x/wcd934x-tables.o
72endif
73
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053074ifdef CONFIG_SND_SOC_WCD9XXX_V2
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053075 WCD9XXX_OBJS += wcd9xxx-common-v2.o
76 WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o
77 WCD9XXX_OBJS += wcdcal-hwdep.o
78 WCD9XXX_OBJS += wcd9xxx-soc-init.o
79 WCD9XXX_OBJS += wcd-dsp-utils.o
80 WCD9XXX_OBJS += wcd-dsp-mgr.o
Soumya Managolieaff6622018-02-23 12:00:54 +053081endif
82
83ifdef CONFIG_COMMON_CLK_QCOM
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053084 WCD9XXX_OBJS += audio-ext-clk-up.o
85endif
86
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053087ifdef CONFIG_SND_SOC_WCD9335
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053088 WCD9335_OBJS += wcd9335.o
89endif
90
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053091ifdef CONFIG_SND_SOC_WSA881X
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053092 WSA881X_OBJS += wsa881x.o
93 WSA881X_OBJS += wsa881x-tables.o
94 WSA881X_OBJS += wsa881x-regmap.o
95 WSA881X_OBJS += wsa881x-temp-sensor.o
96endif
97
Soumya Managolieaff6622018-02-23 12:00:54 +053098ifdef CONFIG_SND_SOC_WSA881X_ANALOG
99 WSA881X_ANALOG_OBJS += wsa881x-analog.o
100 WSA881X_ANALOG_OBJS += wsa881x-tables-analog.o
101 WSA881X_ANALOG_OBJS += wsa881x-regmap-analog.o
102endif
103
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530104ifdef CONFIG_SND_SOC_MSM_STUB
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530105 STUB_OBJS += msm_stub.o
106endif
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530107ifdef CONFIG_SND_SOC_WCD_SPI
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530108 SPI_OBJS += wcd-spi.o
109endif
110
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530111ifdef CONFIG_SND_SOC_WCD_CPE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530112 WCD_CPE_OBJS += wcd_cpe_core.o
113 WCD_CPE_OBJS += wcd_cpe_services.o
114endif
115
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530116ifdef CONFIG_SND_SOC_WCD_MBHC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530117 MBHC_OBJS += wcd-mbhc-v2.o
118endif
119
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530120ifdef CONFIG_SND_SOC_WCD_MBHC_ADC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530121 MBHC_OBJS += wcd-mbhc-adc.o
122endif
123
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530124ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530125 MBHC_OBJS += wcd-mbhc-legacy.o
126endif
127
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530128ifdef CONFIG_SND_SOC_MSM_HDMI_CODEC_RX
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530129 HDMICODEC_OBJS += msm_hdmi_codec_rx.o
130endif
131
132LINUX_INC += -Iinclude/linux
133
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530134INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530135 $(UAPI_INC)
136
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530137
138EXTRA_CFLAGS += $(INCS)
139
140
141CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
142 -DANI_LITTLE_BIT_ENDIAN \
143 -DDOT11F_LITTLE_ENDIAN_HOST \
144 -DANI_COMPILER_TYPE_GCC \
145 -DANI_OS_TYPE_ANDROID=6 \
146 -DPTT_SOCK_SVC_ENABLE \
147 -Wall\
148 -Werror\
149 -D__linux__
150
151KBUILD_CPPFLAGS += $(CDEFINES)
152
153# Currently, for versions of gcc which support it, the kernel Makefile
154# is disabling the maybe-uninitialized warning. Re-enable it for the
155# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
156# will override the kernel settings.
157ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
158EXTRA_CFLAGS += -Wmaybe-uninitialized
159endif
160#EXTRA_CFLAGS += -Wmissing-prototypes
161
162ifeq ($(call cc-option-yn, -Wheader-guard),y)
163EXTRA_CFLAGS += -Wheader-guard
164endif
165
166
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530167ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530168KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
169KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530170endif
171
172ifeq ($(KERNEL_BUILD), 1)
173 obj-y += wcd934x/
174 obj-y += sdm660_cdc/
175 obj-y += msm_sdw/
176endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530177# Module information used by KBuild framework
178obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o
179wcd_core_dlkm-y := $(CORE_OBJS)
180
181obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += wcd9xxx_dlkm.o
182wcd9xxx_dlkm-y := $(WCD9XXX_OBJS)
183
184obj-$(CONFIG_SND_SOC_WCD9335) += wcd9335_dlkm.o
185wcd9335_dlkm-y := $(WCD9335_OBJS)
186
187obj-$(CONFIG_SND_SOC_WSA881X) += wsa881x_dlkm.o
188wsa881x_dlkm-y := $(WSA881X_OBJS)
189
Soumya Managolieaff6622018-02-23 12:00:54 +0530190obj-$(CONFIG_SND_SOC_WSA881X_ANALOG) += wsa881x_analog_dlkm.o
191wsa881x_analog_dlkm-y := $(WSA881X_ANALOG_OBJS)
192
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530193obj-$(CONFIG_SND_SOC_MSM_STUB) += stub_dlkm.o
194stub_dlkm-y := $(STUB_OBJS)
195
196obj-$(CONFIG_SND_SOC_WCD_CPE) += wcd_cpe_dlkm.o
197wcd_cpe_dlkm-y := $(WCD_CPE_OBJS)
198
199obj-$(CONFIG_SND_SOC_WCD_SPI) += wcd_spi_dlkm.o
200wcd_spi_dlkm-y := $(SPI_OBJS)
201
202obj-$(CONFIG_SND_SOC_WCD_MBHC) += mbhc_dlkm.o
203mbhc_dlkm-y := $(MBHC_OBJS)
204
205obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += hdmi_dlkm.o
206hdmi_dlkm-y := $(HDMICODEC_OBJS)
207
208# inject some build related information
209DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"