blob: b729f90318b7b25af1884d433aee5f257e8c972b [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
3KERNEL_BUILD := 0
4
5TARGET_KERNEL_VERSION := 4.4
6
7ifeq ($(KERNEL_BUILD), 0)
8 # These are configurable via Kconfig for kernel-based builds
9 # Need to explicitly configure for Android-based builds
10 ifeq ($(CONFIG_ARCH_SDM845), y)
11 include $(AUDIO_ROOT)/config/sdm845auto.conf
12 export
13 TARGET_KERNEL_VERSION := 4.9
14 endif
15 ifeq ($(CONFIG_ARCH_SDM670), y)
16 include $(AUDIO_ROOT)/config/sdm670auto.conf
17 export
18 TARGET_KERNEL_VERSION := 4.9
19 endif
20endif
21
22
23# As per target team, build is done as follows:
24# Defconfig : build with default flags
25# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
26# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
27# Perf : Using appropriate msmXXXX-perf_defconfig
28#
29# Shipment builds (user variants) should not have any debug feature
30# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
31# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
32# there is no other way to identify defconfig builds, QTI internal
33# representation of perf builds (identified using the string 'perf'),
34# is used to identify if the build is a slub or defconfig one. This
35# way no critical debug feature will be enabled for perf and shipment
36# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
37# config.
38
39############ UAPI ############
40UAPI_DIR := uapi
41UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
42
43############ COMMON ############
44COMMON_DIR := include
45COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
46
47############ IPC ############
48
49ifeq ($(CONFIG_MSM_QDSP6_APRV2_GLINK), m)
50APRV_GLINK += apr.o
51APRV_GLINK += apr_v2.o
52APRV_GLINK += apr_tal_glink.o
53endif
54
55ifeq ($(CONFIG_MSM_QDSP6_APRV3_GLINK), m)
56APRV_GLINK += apr.o
57APRV_GLINK += apr_v3.o
58APRV_GLINK += apr_tal_glink.o
59endif
60
61ifeq ($(CONFIG_WCD_DSP_GLINK), m)
62WDSP_GLINK += wcd-dsp-glink.o
63endif
64
65LINUX_INC += -Iinclude/linux
66
67INCS := $(COMMON_INC) \
68 $(UAPI_INC)
69
70ifeq ($(CONFIG_ARCH_SDM845), y)
71INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
72endif
73ifeq ($(CONFIG_ARCH_SDM670), y)
74INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
75endif
76
77EXTRA_CFLAGS += $(INCS)
78
79
80CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
81 -DANI_LITTLE_BIT_ENDIAN \
82 -DDOT11F_LITTLE_ENDIAN_HOST \
83 -DANI_COMPILER_TYPE_GCC \
84 -DANI_OS_TYPE_ANDROID=6 \
85 -DPTT_SOCK_SVC_ENABLE \
86 -Wall\
87 -Werror\
88 -D__linux__
89
90KBUILD_CPPFLAGS += $(CDEFINES)
91
92HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts
93UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include
94$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;)
95$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio.h;)
96$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_aac.h;)
97$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ac3.h;)
98$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_alac.h;)
99$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrnb.h;)
100$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwb.h;)
101$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwbplus.h;)
102$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ape.h;)
103$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_calibration.h;)
104$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711_dec.h;)
105$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711.h;)
106$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_mvs.h;)
107$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_qcp.h;)
108$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_sbc.h;)
109$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_voicememo.h;)
110$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wma.h;)
111$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wmapro.h;)
112
113$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_effects.h;)
114$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_slimslave.h;)
115$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ devdep_params.h;)
116$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ lsm_params.h;)
117$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ msmcal-hwdep.h;)
118$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;)
119$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;)
120
121# Currently, for versions of gcc which support it, the kernel Makefile
122# is disabling the maybe-uninitialized warning. Re-enable it for the
123# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
124# will override the kernel settings.
125ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
126EXTRA_CFLAGS += -Wmaybe-uninitialized
127endif
128#EXTRA_CFLAGS += -Wmissing-prototypes
129
130ifeq ($(call cc-option-yn, -Wheader-guard),y)
131EXTRA_CFLAGS += -Wheader-guard
132endif
133# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
134# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
135# any string that must be unique for all instances of the driver on the system.
136# This allows multiple instances of the driver with different module names.
137# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
138# treat the driver as the primary driver.
139ifneq ($(MODNAME), qdsp6v2)
140CHIP_NAME ?= $(MODNAME)
141CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
142endif
143
144KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
145# Module information used by KBuild framework
146obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr_dlkm.o
147apr_dlkm-y := $(APRV_GLINK)
148
149obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
150wglink_dlkm-y := $(WDSP_GLINK)
151
152# inject some build related information
153CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"