blob: 1cbd20e459f7ecfbb8d69d5039a7b3630b44d9df [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
27endif
28
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053029# As per target team, build is done as follows:
30# Defconfig : build with default flags
31# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
32# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
33# Perf : Using appropriate msmXXXX-perf_defconfig
34#
35# Shipment builds (user variants) should not have any debug feature
36# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
37# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
38# there is no other way to identify defconfig builds, QTI internal
39# representation of perf builds (identified using the string 'perf'),
40# is used to identify if the build is a slub or defconfig one. This
41# way no critical debug feature will be enabled for perf and shipment
42# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
43# config.
44
45############ UAPI ############
46UAPI_DIR := uapi
47UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
48
49############ COMMON ############
50COMMON_DIR := include
51COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
52
53############ ASoC Codecs ############
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053054ifdef CONFIG_WCD9XXX_CODEC_CORE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053055 CORE_OBJS += wcd9xxx-rst.o
56 CORE_OBJS += wcd9xxx-core-init.o
57 CORE_OBJS += wcd9xxx-core.o
58 CORE_OBJS += wcd9xxx-irq.o
59 CORE_OBJS += wcd9xxx-slimslave.o
60 CORE_OBJS += wcd9xxx-utils.o
61 CORE_OBJS += wcd9335-regmap.o
62 CORE_OBJS += wcd9335-tables.o
63 CORE_OBJS += msm-cdc-pinctrl.o
64 CORE_OBJS += msm-cdc-supply.o
65 CORE_OBJS += wcd934x/wcd934x-regmap.o
66 CORE_OBJS += wcd934x/wcd934x-tables.o
67endif
68
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053069ifdef CONFIG_SND_SOC_WCD9XXX_V2
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053070 WCD9XXX_OBJS += wcd9xxx-common-v2.o
71 WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o
72 WCD9XXX_OBJS += wcdcal-hwdep.o
73 WCD9XXX_OBJS += wcd9xxx-soc-init.o
74 WCD9XXX_OBJS += wcd-dsp-utils.o
75 WCD9XXX_OBJS += wcd-dsp-mgr.o
76 WCD9XXX_OBJS += audio-ext-clk-up.o
77endif
78
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053079ifdef CONFIG_SND_SOC_WCD9335
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053080 WCD9335_OBJS += wcd9335.o
81endif
82
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053083ifdef CONFIG_SND_SOC_WSA881X
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053084 WSA881X_OBJS += wsa881x.o
85 WSA881X_OBJS += wsa881x-tables.o
86 WSA881X_OBJS += wsa881x-regmap.o
87 WSA881X_OBJS += wsa881x-temp-sensor.o
88endif
89
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053090ifdef CONFIG_SND_SOC_MSM_STUB
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053091 STUB_OBJS += msm_stub.o
92endif
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053093ifdef CONFIG_SND_SOC_WCD_SPI
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053094 SPI_OBJS += wcd-spi.o
95endif
96
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053097ifdef CONFIG_SND_SOC_WCD_CPE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053098 WCD_CPE_OBJS += wcd_cpe_core.o
99 WCD_CPE_OBJS += wcd_cpe_services.o
100endif
101
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530102ifdef CONFIG_SND_SOC_WCD_MBHC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530103 MBHC_OBJS += wcd-mbhc-v2.o
104endif
105
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530106ifdef CONFIG_SND_SOC_WCD_MBHC_ADC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530107 MBHC_OBJS += wcd-mbhc-adc.o
108endif
109
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530110ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530111 MBHC_OBJS += wcd-mbhc-legacy.o
112endif
113
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530114ifdef CONFIG_SND_SOC_MSM_HDMI_CODEC_RX
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530115 HDMICODEC_OBJS += msm_hdmi_codec_rx.o
116endif
117
118LINUX_INC += -Iinclude/linux
119
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530120INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530121 $(UAPI_INC)
122
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530123
124EXTRA_CFLAGS += $(INCS)
125
126
127CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
128 -DANI_LITTLE_BIT_ENDIAN \
129 -DDOT11F_LITTLE_ENDIAN_HOST \
130 -DANI_COMPILER_TYPE_GCC \
131 -DANI_OS_TYPE_ANDROID=6 \
132 -DPTT_SOCK_SVC_ENABLE \
133 -Wall\
134 -Werror\
135 -D__linux__
136
137KBUILD_CPPFLAGS += $(CDEFINES)
138
139# Currently, for versions of gcc which support it, the kernel Makefile
140# is disabling the maybe-uninitialized warning. Re-enable it for the
141# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
142# will override the kernel settings.
143ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
144EXTRA_CFLAGS += -Wmaybe-uninitialized
145endif
146#EXTRA_CFLAGS += -Wmissing-prototypes
147
148ifeq ($(call cc-option-yn, -Wheader-guard),y)
149EXTRA_CFLAGS += -Wheader-guard
150endif
151
152
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530153ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530154KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
155KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530156endif
157
158ifeq ($(KERNEL_BUILD), 1)
159 obj-y += wcd934x/
160 obj-y += sdm660_cdc/
161 obj-y += msm_sdw/
162endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530163# Module information used by KBuild framework
164obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o
165wcd_core_dlkm-y := $(CORE_OBJS)
166
167obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += wcd9xxx_dlkm.o
168wcd9xxx_dlkm-y := $(WCD9XXX_OBJS)
169
170obj-$(CONFIG_SND_SOC_WCD9335) += wcd9335_dlkm.o
171wcd9335_dlkm-y := $(WCD9335_OBJS)
172
173obj-$(CONFIG_SND_SOC_WSA881X) += wsa881x_dlkm.o
174wsa881x_dlkm-y := $(WSA881X_OBJS)
175
176obj-$(CONFIG_SND_SOC_MSM_STUB) += stub_dlkm.o
177stub_dlkm-y := $(STUB_OBJS)
178
179obj-$(CONFIG_SND_SOC_WCD_CPE) += wcd_cpe_dlkm.o
180wcd_cpe_dlkm-y := $(WCD_CPE_OBJS)
181
182obj-$(CONFIG_SND_SOC_WCD_SPI) += wcd_spi_dlkm.o
183wcd_spi_dlkm-y := $(SPI_OBJS)
184
185obj-$(CONFIG_SND_SOC_WCD_MBHC) += mbhc_dlkm.o
186mbhc_dlkm-y := $(MBHC_OBJS)
187
188obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += hdmi_dlkm.o
189hdmi_dlkm-y := $(HDMICODEC_OBJS)
190
191# inject some build related information
192DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"