blob: b2c2a72331deb50bad9e27d1e555f12d04fb7870 [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 +05309TARGET_KERNEL_VERSION := 4.9
10
11# These are configurable via Kconfig for kernel-based builds
12# Need to explicitly configure for Android-based builds
13ifeq ($(CONFIG_ARCH_SDM845), y)
14 TARGET_KERNEL_VERSION := 4.9
15endif
16ifeq ($(CONFIG_ARCH_SDM670), y)
17 TARGET_KERNEL_VERSION := 4.9
18endif
Soumya Managolieaff6622018-02-23 12:00:54 +053019ifeq ($(CONFIG_ARCH_SDM450), y)
20 TARGET_KERNEL_VERSION := 4.9
21endif
Vaishnavi Kommaraju59562a12018-04-25 19:33:46 +053022ifeq ($(CONFIG_ARCH_SDM439), y)
23 TARGET_KERNEL_VERSION := 4.9
24endif
Sundara Vinayagam39838332018-05-23 12:04:25 +053025ifeq ($(CONFIG_ARCH_MSM8909), y)
26 TARGET_KERNEL_VERSION := 4.9
27endif
28
Soumya Managolid63fb8e2018-05-08 17:28:01 +053029ifeq ($(CONFIG_ARCH_MSM8917), y)
30 TARGET_KERNEL_VERSION := 4.9
31endif
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053032KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)
33
34ifeq ($(KERNEL_BUILD), 1)
35 AUDIO_ROOT := $(KDIR)/techpack/audio
36endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053037
38ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053039 ifeq ($(CONFIG_ARCH_SDM845), y)
40 include $(AUDIO_ROOT)/config/sdm845auto.conf
41 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053042 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053043 endif
44 ifeq ($(CONFIG_ARCH_SDM670), y)
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053045 include $(AUDIO_ROOT)/config/sdm710auto.conf
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053046 export
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053047 INCS += -include $(AUDIO_ROOT)/config/sdm710autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053048 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053049 ifeq ($(CONFIG_ARCH_SDM450), y)
Soumya Managolieaff6622018-02-23 12:00:54 +053050 include $(AUDIO_ROOT)/config/sdm450auto.conf
Laxminath Kasam942d1c62017-12-29 11:02:22 +053051 export
Soumya Managolieaff6622018-02-23 12:00:54 +053052 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
Laxminath Kasam942d1c62017-12-29 11:02:22 +053053 endif
Vaishnavi Kommaraju59562a12018-04-25 19:33:46 +053054 ifeq ($(CONFIG_ARCH_SDM439), y)
55 include $(AUDIO_ROOT)/config/sdm450auto.conf
56 export
57 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
58 endif
Sundara Vinayagam39838332018-05-23 12:04:25 +053059 ifeq ($(CONFIG_ARCH_MSM8909), y)
60 include $(AUDIO_ROOT)/config/msm8909auto.conf
61 export
62 INCS += -include $(AUDIO_ROOT)/config/msm8909autoconf.h
63 endif
Soumya Managolid63fb8e2018-05-08 17:28:01 +053064 ifeq ($(CONFIG_ARCH_MSM8917), y)
65 include $(AUDIO_ROOT)/config/sdm450auto.conf
66 export
67 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
68 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053069endif
70
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053071# As per target team, build is done as follows:
72# Defconfig : build with default flags
73# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
74# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
75# Perf : Using appropriate msmXXXX-perf_defconfig
76#
77# Shipment builds (user variants) should not have any debug feature
78# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
79# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
80# there is no other way to identify defconfig builds, QTI internal
81# representation of perf builds (identified using the string 'perf'),
82# is used to identify if the build is a slub or defconfig one. This
83# way no critical debug feature will be enabled for perf and shipment
84# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
85# config.
86
87############ UAPI ############
88UAPI_DIR := uapi
89UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
90
91############ COMMON ############
92COMMON_DIR := include
93COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
94
95############ IPC ############
Soumya Managolieaff6622018-02-23 12:00:54 +053096ifdef CONFIG_MSM_QDSP6_APRV2
97APRV_GLINK += apr.o
98APRV_GLINK += apr_v2.o
99APRV_GLINK += apr_tal.o
Soumya Managoli5beccb82018-03-02 19:31:23 +0530100APRV_GLINK += apr_dummy.o
Soumya Managolieaff6622018-02-23 12:00:54 +0530101endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530102
Sundara Vinayagam39838332018-05-23 12:04:25 +0530103ifdef CONFIG_MSM_QDSP6_APRV3
104APRV_GLINK += apr.o
105APRV_GLINK += apr_v3.o
106APRV_GLINK += apr_tal.o
107APRV_GLINK += apr_dummy.o
108endif
109
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530110ifdef CONFIG_MSM_QDSP6_APRV2_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530111APRV_GLINK += apr.o
112APRV_GLINK += apr_v2.o
113APRV_GLINK += apr_tal_glink.o
Laxminath Kasam31b26c52018-02-12 16:32:01 +0530114APRV_GLINK += apr_dummy.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530115endif
116
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530117ifdef CONFIG_MSM_QDSP6_APRV3_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530118APRV_GLINK += apr.o
119APRV_GLINK += apr_v3.o
120APRV_GLINK += apr_tal_glink.o
Laxminath Kasam31b26c52018-02-12 16:32:01 +0530121APRV_GLINK += apr_dummy.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530122endif
123
Sundara Vinayagamc7d61572018-06-05 20:03:46 +0530124ifeq ($(CONFIG_ARCH_MSM8909), $(CONFIG_MSM_BGCOM))
125 ifdef CONFIG_MSM_BG_GLINK
126 BG_GLINK += bg_glink.o
127 endif
Sundara Vinayagama2356d22018-05-21 13:39:39 +0530128endif
129
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530130ifdef CONFIG_WCD_DSP_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530131WDSP_GLINK += wcd-dsp-glink.o
132endif
133
134LINUX_INC += -Iinclude/linux
135
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530136INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530137 $(UAPI_INC)
138
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530139EXTRA_CFLAGS += $(INCS)
140
141
142CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
143 -DANI_LITTLE_BIT_ENDIAN \
144 -DDOT11F_LITTLE_ENDIAN_HOST \
145 -DANI_COMPILER_TYPE_GCC \
146 -DANI_OS_TYPE_ANDROID=6 \
147 -DPTT_SOCK_SVC_ENABLE \
148 -Wall\
149 -Werror\
150 -D__linux__
151
152KBUILD_CPPFLAGS += $(CDEFINES)
153
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530154ifeq ($(KERNEL_BUILD), 0)
155
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530156HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts
157UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include
158$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;)
159$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio.h;)
160$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_aac.h;)
161$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ac3.h;)
162$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_alac.h;)
163$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrnb.h;)
164$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwb.h;)
165$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwbplus.h;)
166$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ape.h;)
167$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_calibration.h;)
168$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711_dec.h;)
169$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711.h;)
170$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_mvs.h;)
171$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_qcp.h;)
172$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_sbc.h;)
173$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_voicememo.h;)
174$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wma.h;)
175$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wmapro.h;)
176
177$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_effects.h;)
178$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_slimslave.h;)
179$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ devdep_params.h;)
180$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ lsm_params.h;)
181$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ msmcal-hwdep.h;)
182$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;)
183$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;)
184
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530185KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
186
187endif
188
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530189# Currently, for versions of gcc which support it, the kernel Makefile
190# is disabling the maybe-uninitialized warning. Re-enable it for the
191# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
192# will override the kernel settings.
193ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
194EXTRA_CFLAGS += -Wmaybe-uninitialized
195endif
196#EXTRA_CFLAGS += -Wmissing-prototypes
197
198ifeq ($(call cc-option-yn, -Wheader-guard),y)
199EXTRA_CFLAGS += -Wheader-guard
200endif
201# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
202# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
203# any string that must be unique for all instances of the driver on the system.
204# This allows multiple instances of the driver with different module names.
205# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
206# treat the driver as the primary driver.
207ifneq ($(MODNAME), qdsp6v2)
208CHIP_NAME ?= $(MODNAME)
209CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
210endif
211
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530212# Module information used by KBuild framework
Soumya Managolieaff6622018-02-23 12:00:54 +0530213obj-$(CONFIG_MSM_QDSP6_APRV2) += apr_dlkm.o
Sundara Vinayagam39838332018-05-23 12:04:25 +0530214obj-$(CONFIG_MSM_QDSP6_APRV3) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530215obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr_dlkm.o
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530216obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530217apr_dlkm-y := $(APRV_GLINK)
218
Sundara Vinayagamc7d61572018-06-05 20:03:46 +0530219ifeq ($(CONFIG_ARCH_MSM8909), $(CONFIG_MSM_BGCOM))
220 obj-$(CONFIG_MSM_BG_GLINK) += bg_glink_dlkm.o
221 bg_glink_dlkm-y := $(BG_GLINK)
222endif
Sundara Vinayagama2356d22018-05-21 13:39:39 +0530223
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530224obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
225wglink_dlkm-y := $(WDSP_GLINK)
226
227# inject some build related information
228CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"