blob: 69fdac34568045e00f1c3b3e7ae12bade153fcb2 [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
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053025KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)
26
27ifeq ($(KERNEL_BUILD), 1)
28 AUDIO_ROOT := $(KDIR)/techpack/audio
29endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053030
31ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053032 ifeq ($(CONFIG_ARCH_SDM845), y)
33 include $(AUDIO_ROOT)/config/sdm845auto.conf
34 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053035 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053036 endif
37 ifeq ($(CONFIG_ARCH_SDM670), y)
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053038 include $(AUDIO_ROOT)/config/sdm710auto.conf
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053039 export
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053040 INCS += -include $(AUDIO_ROOT)/config/sdm710autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053041 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053042 ifeq ($(CONFIG_ARCH_SDM450), y)
Soumya Managolieaff6622018-02-23 12:00:54 +053043 include $(AUDIO_ROOT)/config/sdm450auto.conf
Laxminath Kasam942d1c62017-12-29 11:02:22 +053044 export
Soumya Managolieaff6622018-02-23 12:00:54 +053045 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
Laxminath Kasam942d1c62017-12-29 11:02:22 +053046 endif
Vaishnavi Kommaraju59562a12018-04-25 19:33:46 +053047 ifeq ($(CONFIG_ARCH_SDM439), y)
48 include $(AUDIO_ROOT)/config/sdm450auto.conf
49 export
50 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
51 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053052endif
53
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053054# As per target team, build is done as follows:
55# Defconfig : build with default flags
56# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
57# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
58# Perf : Using appropriate msmXXXX-perf_defconfig
59#
60# Shipment builds (user variants) should not have any debug feature
61# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
62# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
63# there is no other way to identify defconfig builds, QTI internal
64# representation of perf builds (identified using the string 'perf'),
65# is used to identify if the build is a slub or defconfig one. This
66# way no critical debug feature will be enabled for perf and shipment
67# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
68# config.
69
70############ UAPI ############
71UAPI_DIR := uapi
72UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
73
74############ COMMON ############
75COMMON_DIR := include
76COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
77
78############ IPC ############
Soumya Managolieaff6622018-02-23 12:00:54 +053079ifdef CONFIG_MSM_QDSP6_APRV2
80APRV_GLINK += apr.o
81APRV_GLINK += apr_v2.o
82APRV_GLINK += apr_tal.o
Soumya Managoli5beccb82018-03-02 19:31:23 +053083APRV_GLINK += apr_dummy.o
Soumya Managolieaff6622018-02-23 12:00:54 +053084endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053085
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053086ifdef CONFIG_MSM_QDSP6_APRV2_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053087APRV_GLINK += apr.o
88APRV_GLINK += apr_v2.o
89APRV_GLINK += apr_tal_glink.o
Laxminath Kasam31b26c52018-02-12 16:32:01 +053090APRV_GLINK += apr_dummy.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053091endif
92
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053093ifdef CONFIG_MSM_QDSP6_APRV3_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053094APRV_GLINK += apr.o
95APRV_GLINK += apr_v3.o
96APRV_GLINK += apr_tal_glink.o
Laxminath Kasam31b26c52018-02-12 16:32:01 +053097APRV_GLINK += apr_dummy.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053098endif
99
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530100ifdef CONFIG_WCD_DSP_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530101WDSP_GLINK += wcd-dsp-glink.o
102endif
103
104LINUX_INC += -Iinclude/linux
105
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530106INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530107 $(UAPI_INC)
108
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530109EXTRA_CFLAGS += $(INCS)
110
111
112CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
113 -DANI_LITTLE_BIT_ENDIAN \
114 -DDOT11F_LITTLE_ENDIAN_HOST \
115 -DANI_COMPILER_TYPE_GCC \
116 -DANI_OS_TYPE_ANDROID=6 \
117 -DPTT_SOCK_SVC_ENABLE \
118 -Wall\
119 -Werror\
120 -D__linux__
121
122KBUILD_CPPFLAGS += $(CDEFINES)
123
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530124ifeq ($(KERNEL_BUILD), 0)
125
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530126HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts
127UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include
128$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;)
129$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio.h;)
130$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_aac.h;)
131$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ac3.h;)
132$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_alac.h;)
133$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrnb.h;)
134$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwb.h;)
135$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwbplus.h;)
136$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ape.h;)
137$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_calibration.h;)
138$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711_dec.h;)
139$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711.h;)
140$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_mvs.h;)
141$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_qcp.h;)
142$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_sbc.h;)
143$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_voicememo.h;)
144$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wma.h;)
145$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wmapro.h;)
146
147$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_effects.h;)
148$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_slimslave.h;)
149$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ devdep_params.h;)
150$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ lsm_params.h;)
151$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ msmcal-hwdep.h;)
152$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;)
153$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;)
154
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530155KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
156
157endif
158
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530159# Currently, for versions of gcc which support it, the kernel Makefile
160# is disabling the maybe-uninitialized warning. Re-enable it for the
161# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
162# will override the kernel settings.
163ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
164EXTRA_CFLAGS += -Wmaybe-uninitialized
165endif
166#EXTRA_CFLAGS += -Wmissing-prototypes
167
168ifeq ($(call cc-option-yn, -Wheader-guard),y)
169EXTRA_CFLAGS += -Wheader-guard
170endif
171# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
172# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
173# any string that must be unique for all instances of the driver on the system.
174# This allows multiple instances of the driver with different module names.
175# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
176# treat the driver as the primary driver.
177ifneq ($(MODNAME), qdsp6v2)
178CHIP_NAME ?= $(MODNAME)
179CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
180endif
181
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530182# Module information used by KBuild framework
Soumya Managolieaff6622018-02-23 12:00:54 +0530183obj-$(CONFIG_MSM_QDSP6_APRV2) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530184obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr_dlkm.o
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530185obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530186apr_dlkm-y := $(APRV_GLINK)
187
188obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
189wglink_dlkm-y := $(WDSP_GLINK)
190
191# inject some build related information
192CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"