blob: 8e841ea58a458e6331d7808eaed3eb0f69c97b8f [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
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053029KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)
30
31ifeq ($(KERNEL_BUILD), 1)
32 AUDIO_ROOT := $(KDIR)/techpack/audio
33endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053034
35ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053036 ifeq ($(CONFIG_ARCH_SDM845), y)
37 include $(AUDIO_ROOT)/config/sdm845auto.conf
38 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053039 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053040 endif
41 ifeq ($(CONFIG_ARCH_SDM670), y)
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053042 include $(AUDIO_ROOT)/config/sdm710auto.conf
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053043 export
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053044 INCS += -include $(AUDIO_ROOT)/config/sdm710autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053045 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053046 ifeq ($(CONFIG_ARCH_SDM450), y)
Soumya Managolieaff6622018-02-23 12:00:54 +053047 include $(AUDIO_ROOT)/config/sdm450auto.conf
Laxminath Kasam942d1c62017-12-29 11:02:22 +053048 export
Soumya Managolieaff6622018-02-23 12:00:54 +053049 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
Laxminath Kasam942d1c62017-12-29 11:02:22 +053050 endif
Vaishnavi Kommaraju59562a12018-04-25 19:33:46 +053051 ifeq ($(CONFIG_ARCH_SDM439), y)
52 include $(AUDIO_ROOT)/config/sdm450auto.conf
53 export
54 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
55 endif
Sundara Vinayagam39838332018-05-23 12:04:25 +053056 ifeq ($(CONFIG_ARCH_MSM8909), y)
57 include $(AUDIO_ROOT)/config/msm8909auto.conf
58 export
59 INCS += -include $(AUDIO_ROOT)/config/msm8909autoconf.h
60 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053061endif
62
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053063# As per target team, build is done as follows:
64# Defconfig : build with default flags
65# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
66# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
67# Perf : Using appropriate msmXXXX-perf_defconfig
68#
69# Shipment builds (user variants) should not have any debug feature
70# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
71# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
72# there is no other way to identify defconfig builds, QTI internal
73# representation of perf builds (identified using the string 'perf'),
74# is used to identify if the build is a slub or defconfig one. This
75# way no critical debug feature will be enabled for perf and shipment
76# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
77# config.
78
79############ UAPI ############
80UAPI_DIR := uapi
81UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
82
83############ COMMON ############
84COMMON_DIR := include
85COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
86
87############ IPC ############
Soumya Managolieaff6622018-02-23 12:00:54 +053088ifdef CONFIG_MSM_QDSP6_APRV2
89APRV_GLINK += apr.o
90APRV_GLINK += apr_v2.o
91APRV_GLINK += apr_tal.o
Soumya Managoli5beccb82018-03-02 19:31:23 +053092APRV_GLINK += apr_dummy.o
Soumya Managolieaff6622018-02-23 12:00:54 +053093endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053094
Sundara Vinayagam39838332018-05-23 12:04:25 +053095ifdef CONFIG_MSM_QDSP6_APRV3
96APRV_GLINK += apr.o
97APRV_GLINK += apr_v3.o
98APRV_GLINK += apr_tal.o
99APRV_GLINK += apr_dummy.o
100endif
101
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530102ifdef CONFIG_MSM_QDSP6_APRV2_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530103APRV_GLINK += apr.o
104APRV_GLINK += apr_v2.o
105APRV_GLINK += apr_tal_glink.o
Laxminath Kasam31b26c52018-02-12 16:32:01 +0530106APRV_GLINK += apr_dummy.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530107endif
108
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530109ifdef CONFIG_MSM_QDSP6_APRV3_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530110APRV_GLINK += apr.o
111APRV_GLINK += apr_v3.o
112APRV_GLINK += apr_tal_glink.o
Laxminath Kasam31b26c52018-02-12 16:32:01 +0530113APRV_GLINK += apr_dummy.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530114endif
115
Sundara Vinayagamc7d61572018-06-05 20:03:46 +0530116ifeq ($(CONFIG_ARCH_MSM8909), $(CONFIG_MSM_BGCOM))
117 ifdef CONFIG_MSM_BG_GLINK
118 BG_GLINK += bg_glink.o
119 endif
Sundara Vinayagama2356d22018-05-21 13:39:39 +0530120endif
121
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530122ifdef CONFIG_WCD_DSP_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530123WDSP_GLINK += wcd-dsp-glink.o
124endif
125
126LINUX_INC += -Iinclude/linux
127
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530128INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530129 $(UAPI_INC)
130
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530131EXTRA_CFLAGS += $(INCS)
132
133
134CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
135 -DANI_LITTLE_BIT_ENDIAN \
136 -DDOT11F_LITTLE_ENDIAN_HOST \
137 -DANI_COMPILER_TYPE_GCC \
138 -DANI_OS_TYPE_ANDROID=6 \
139 -DPTT_SOCK_SVC_ENABLE \
140 -Wall\
141 -Werror\
142 -D__linux__
143
144KBUILD_CPPFLAGS += $(CDEFINES)
145
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530146ifeq ($(KERNEL_BUILD), 0)
147
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530148HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts
149UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include
150$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;)
151$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio.h;)
152$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_aac.h;)
153$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ac3.h;)
154$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_alac.h;)
155$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrnb.h;)
156$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwb.h;)
157$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwbplus.h;)
158$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ape.h;)
159$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_calibration.h;)
160$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711_dec.h;)
161$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711.h;)
162$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_mvs.h;)
163$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_qcp.h;)
164$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_sbc.h;)
165$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_voicememo.h;)
166$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wma.h;)
167$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wmapro.h;)
168
169$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_effects.h;)
170$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_slimslave.h;)
171$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ devdep_params.h;)
172$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ lsm_params.h;)
173$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ msmcal-hwdep.h;)
174$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;)
175$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;)
176
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530177KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
178
179endif
180
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530181# Currently, for versions of gcc which support it, the kernel Makefile
182# is disabling the maybe-uninitialized warning. Re-enable it for the
183# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
184# will override the kernel settings.
185ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
186EXTRA_CFLAGS += -Wmaybe-uninitialized
187endif
188#EXTRA_CFLAGS += -Wmissing-prototypes
189
190ifeq ($(call cc-option-yn, -Wheader-guard),y)
191EXTRA_CFLAGS += -Wheader-guard
192endif
193# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
194# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
195# any string that must be unique for all instances of the driver on the system.
196# This allows multiple instances of the driver with different module names.
197# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
198# treat the driver as the primary driver.
199ifneq ($(MODNAME), qdsp6v2)
200CHIP_NAME ?= $(MODNAME)
201CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
202endif
203
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530204# Module information used by KBuild framework
Soumya Managolieaff6622018-02-23 12:00:54 +0530205obj-$(CONFIG_MSM_QDSP6_APRV2) += apr_dlkm.o
Sundara Vinayagam39838332018-05-23 12:04:25 +0530206obj-$(CONFIG_MSM_QDSP6_APRV3) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530207obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr_dlkm.o
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530208obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530209apr_dlkm-y := $(APRV_GLINK)
210
Sundara Vinayagamc7d61572018-06-05 20:03:46 +0530211ifeq ($(CONFIG_ARCH_MSM8909), $(CONFIG_MSM_BGCOM))
212 obj-$(CONFIG_MSM_BG_GLINK) += bg_glink_dlkm.o
213 bg_glink_dlkm-y := $(BG_GLINK)
214endif
Sundara Vinayagama2356d22018-05-21 13:39:39 +0530215
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530216obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
217wglink_dlkm-y := $(WDSP_GLINK)
218
219# inject some build related information
220CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"