blob: 8730156756a565e4a69224a1290bf24b6555a758 [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
19
20KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)
21
22ifeq ($(KERNEL_BUILD), 1)
23 AUDIO_ROOT := $(KDIR)/techpack/audio
24endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053025
26ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053027 ifeq ($(CONFIG_ARCH_SDM845), y)
28 include $(AUDIO_ROOT)/config/sdm845auto.conf
29 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053030 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053031 endif
32 ifeq ($(CONFIG_ARCH_SDM670), y)
33 include $(AUDIO_ROOT)/config/sdm670auto.conf
34 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053035 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053036 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053037 ifeq ($(CONFIG_ARCH_SDM450), y)
38 include $(AUDIO_ROOT)/config/sdm670auto.conf
39 export
40 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
41 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053042endif
43
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053044# As per target team, build is done as follows:
45# Defconfig : build with default flags
46# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
47# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
48# Perf : Using appropriate msmXXXX-perf_defconfig
49#
50# Shipment builds (user variants) should not have any debug feature
51# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
52# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
53# there is no other way to identify defconfig builds, QTI internal
54# representation of perf builds (identified using the string 'perf'),
55# is used to identify if the build is a slub or defconfig one. This
56# way no critical debug feature will be enabled for perf and shipment
57# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
58# config.
59
60############ UAPI ############
61UAPI_DIR := uapi
62UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
63
64############ COMMON ############
65COMMON_DIR := include
66COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
67
68############ IPC ############
69
Shiv Maliyappanahalli72354822017-11-17 16:07:27 -080070ifdef CONFIG_MSM_QDSP6_APRV2_RPMSG
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053071APRV_GLINK += apr.o
72APRV_GLINK += apr_v2.o
Shiv Maliyappanahalli72354822017-11-17 16:07:27 -080073APRV_GLINK += apr_tal_rpmsg.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053074endif
75
Shiv Maliyappanahalli72354822017-11-17 16:07:27 -080076ifdef CONFIG_MSM_QDSP6_APRV3_RPMSG
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053077APRV_GLINK += apr.o
78APRV_GLINK += apr_v3.o
Shiv Maliyappanahalli72354822017-11-17 16:07:27 -080079APRV_GLINK += apr_tal_rpmsg.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053080endif
81
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053082ifdef CONFIG_WCD_DSP_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053083WDSP_GLINK += wcd-dsp-glink.o
84endif
85
86LINUX_INC += -Iinclude/linux
87
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053088INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053089 $(UAPI_INC)
90
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053091EXTRA_CFLAGS += $(INCS)
92
93
94CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
95 -DANI_LITTLE_BIT_ENDIAN \
96 -DDOT11F_LITTLE_ENDIAN_HOST \
97 -DANI_COMPILER_TYPE_GCC \
98 -DANI_OS_TYPE_ANDROID=6 \
99 -DPTT_SOCK_SVC_ENABLE \
100 -Wall\
101 -Werror\
102 -D__linux__
103
104KBUILD_CPPFLAGS += $(CDEFINES)
105
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530106ifeq ($(KERNEL_BUILD), 0)
107
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530108HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts
109UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include
110$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;)
111$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio.h;)
112$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_aac.h;)
113$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ac3.h;)
114$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_alac.h;)
115$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrnb.h;)
116$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwb.h;)
117$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwbplus.h;)
118$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ape.h;)
119$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_calibration.h;)
120$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711_dec.h;)
121$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711.h;)
122$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_mvs.h;)
123$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_qcp.h;)
124$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_sbc.h;)
125$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_voicememo.h;)
126$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wma.h;)
127$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wmapro.h;)
128
129$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_effects.h;)
130$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_slimslave.h;)
131$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ devdep_params.h;)
132$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ lsm_params.h;)
133$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ msmcal-hwdep.h;)
134$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;)
135$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;)
136
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530137KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
138
139endif
140
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530141# Currently, for versions of gcc which support it, the kernel Makefile
142# is disabling the maybe-uninitialized warning. Re-enable it for the
143# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
144# will override the kernel settings.
145ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
146EXTRA_CFLAGS += -Wmaybe-uninitialized
147endif
148#EXTRA_CFLAGS += -Wmissing-prototypes
149
150ifeq ($(call cc-option-yn, -Wheader-guard),y)
151EXTRA_CFLAGS += -Wheader-guard
152endif
153# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
154# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
155# any string that must be unique for all instances of the driver on the system.
156# This allows multiple instances of the driver with different module names.
157# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
158# treat the driver as the primary driver.
159ifneq ($(MODNAME), qdsp6v2)
160CHIP_NAME ?= $(MODNAME)
161CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
162endif
163
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530164# Module information used by KBuild framework
Shiv Maliyappanahalli72354822017-11-17 16:07:27 -0800165obj-$(CONFIG_MSM_QDSP6_APRV2_RPMSG) += apr_dlkm.o
166obj-$(CONFIG_MSM_QDSP6_APRV3_RPMSG) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530167apr_dlkm-y := $(APRV_GLINK)
168
169obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
170wglink_dlkm-y := $(WDSP_GLINK)
171
172# inject some build related information
173CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"