Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 1 | # We can build either as part of a standalone Kernel build or as |
| 2 | # an external module. Determine which mechanism is being used |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 3 | ifeq ($(MODNAME),) |
| 4 | KERNEL_BUILD := 1 |
| 5 | else |
| 6 | KERNEL_BUILD := 0 |
| 7 | endif |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 8 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 9 | TARGET_KERNEL_VERSION := 4.9 |
| 10 | |
| 11 | # These are configurable via Kconfig for kernel-based builds |
| 12 | # Need to explicitly configure for Android-based builds |
| 13 | ifeq ($(CONFIG_ARCH_SDM845), y) |
| 14 | TARGET_KERNEL_VERSION := 4.9 |
| 15 | endif |
| 16 | ifeq ($(CONFIG_ARCH_SDM670), y) |
| 17 | TARGET_KERNEL_VERSION := 4.9 |
| 18 | endif |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 19 | ifeq ($(CONFIG_ARCH_SDM450), y) |
| 20 | TARGET_KERNEL_VERSION := 4.9 |
| 21 | endif |
Vaishnavi Kommaraju | 59562a1 | 2018-04-25 19:33:46 +0530 | [diff] [blame] | 22 | ifeq ($(CONFIG_ARCH_SDM439), y) |
| 23 | TARGET_KERNEL_VERSION := 4.9 |
| 24 | endif |
Sundara Vinayagam | 3983833 | 2018-05-23 12:04:25 +0530 | [diff] [blame^] | 25 | ifeq ($(CONFIG_ARCH_MSM8909), y) |
| 26 | TARGET_KERNEL_VERSION := 4.9 |
| 27 | endif |
| 28 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 29 | KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION) |
| 30 | |
| 31 | ifeq ($(KERNEL_BUILD), 1) |
| 32 | AUDIO_ROOT := $(KDIR)/techpack/audio |
| 33 | endif |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 34 | |
| 35 | ifeq ($(KERNEL_BUILD), 0) |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 36 | ifeq ($(CONFIG_ARCH_SDM845), y) |
| 37 | include $(AUDIO_ROOT)/config/sdm845auto.conf |
| 38 | export |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 39 | INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 40 | endif |
| 41 | ifeq ($(CONFIG_ARCH_SDM670), y) |
Aditya Bavanari | 68d3ed8 | 2018-04-08 14:34:47 +0530 | [diff] [blame] | 42 | include $(AUDIO_ROOT)/config/sdm710auto.conf |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 43 | export |
Aditya Bavanari | 68d3ed8 | 2018-04-08 14:34:47 +0530 | [diff] [blame] | 44 | INCS += -include $(AUDIO_ROOT)/config/sdm710autoconf.h |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 45 | endif |
Laxminath Kasam | 942d1c6 | 2017-12-29 11:02:22 +0530 | [diff] [blame] | 46 | ifeq ($(CONFIG_ARCH_SDM450), y) |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 47 | include $(AUDIO_ROOT)/config/sdm450auto.conf |
Laxminath Kasam | 942d1c6 | 2017-12-29 11:02:22 +0530 | [diff] [blame] | 48 | export |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 49 | INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h |
Laxminath Kasam | 942d1c6 | 2017-12-29 11:02:22 +0530 | [diff] [blame] | 50 | endif |
Vaishnavi Kommaraju | 59562a1 | 2018-04-25 19:33:46 +0530 | [diff] [blame] | 51 | 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 Vinayagam | 3983833 | 2018-05-23 12:04:25 +0530 | [diff] [blame^] | 56 | 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 Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 61 | endif |
| 62 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 63 | # 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 ############ |
| 80 | UAPI_DIR := uapi |
| 81 | UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR) |
| 82 | |
| 83 | ############ COMMON ############ |
| 84 | COMMON_DIR := include |
| 85 | COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR) |
| 86 | |
| 87 | ############ IPC ############ |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 88 | ifdef CONFIG_MSM_QDSP6_APRV2 |
| 89 | APRV_GLINK += apr.o |
| 90 | APRV_GLINK += apr_v2.o |
| 91 | APRV_GLINK += apr_tal.o |
Soumya Managoli | 5beccb8 | 2018-03-02 19:31:23 +0530 | [diff] [blame] | 92 | APRV_GLINK += apr_dummy.o |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 93 | endif |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 94 | |
Sundara Vinayagam | 3983833 | 2018-05-23 12:04:25 +0530 | [diff] [blame^] | 95 | ifdef CONFIG_MSM_QDSP6_APRV3 |
| 96 | APRV_GLINK += apr.o |
| 97 | APRV_GLINK += apr_v3.o |
| 98 | APRV_GLINK += apr_tal.o |
| 99 | APRV_GLINK += apr_dummy.o |
| 100 | endif |
| 101 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 102 | ifdef CONFIG_MSM_QDSP6_APRV2_GLINK |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 103 | APRV_GLINK += apr.o |
| 104 | APRV_GLINK += apr_v2.o |
| 105 | APRV_GLINK += apr_tal_glink.o |
Laxminath Kasam | 31b26c5 | 2018-02-12 16:32:01 +0530 | [diff] [blame] | 106 | APRV_GLINK += apr_dummy.o |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 107 | endif |
| 108 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 109 | ifdef CONFIG_MSM_QDSP6_APRV3_GLINK |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 110 | APRV_GLINK += apr.o |
| 111 | APRV_GLINK += apr_v3.o |
| 112 | APRV_GLINK += apr_tal_glink.o |
Laxminath Kasam | 31b26c5 | 2018-02-12 16:32:01 +0530 | [diff] [blame] | 113 | APRV_GLINK += apr_dummy.o |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 114 | endif |
| 115 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 116 | ifdef CONFIG_WCD_DSP_GLINK |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 117 | WDSP_GLINK += wcd-dsp-glink.o |
| 118 | endif |
| 119 | |
| 120 | LINUX_INC += -Iinclude/linux |
| 121 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 122 | INCS += $(COMMON_INC) \ |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 123 | $(UAPI_INC) |
| 124 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 125 | EXTRA_CFLAGS += $(INCS) |
| 126 | |
| 127 | |
| 128 | CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \ |
| 129 | -DANI_LITTLE_BIT_ENDIAN \ |
| 130 | -DDOT11F_LITTLE_ENDIAN_HOST \ |
| 131 | -DANI_COMPILER_TYPE_GCC \ |
| 132 | -DANI_OS_TYPE_ANDROID=6 \ |
| 133 | -DPTT_SOCK_SVC_ENABLE \ |
| 134 | -Wall\ |
| 135 | -Werror\ |
| 136 | -D__linux__ |
| 137 | |
| 138 | KBUILD_CPPFLAGS += $(CDEFINES) |
| 139 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 140 | ifeq ($(KERNEL_BUILD), 0) |
| 141 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 142 | HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts |
| 143 | UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include |
| 144 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;) |
| 145 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio.h;) |
| 146 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_aac.h;) |
| 147 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ac3.h;) |
| 148 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_alac.h;) |
| 149 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrnb.h;) |
| 150 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwb.h;) |
| 151 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwbplus.h;) |
| 152 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ape.h;) |
| 153 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_calibration.h;) |
| 154 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711_dec.h;) |
| 155 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711.h;) |
| 156 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_mvs.h;) |
| 157 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_qcp.h;) |
| 158 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_sbc.h;) |
| 159 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_voicememo.h;) |
| 160 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wma.h;) |
| 161 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wmapro.h;) |
| 162 | |
| 163 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_effects.h;) |
| 164 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_slimslave.h;) |
| 165 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ devdep_params.h;) |
| 166 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ lsm_params.h;) |
| 167 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ msmcal-hwdep.h;) |
| 168 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;) |
| 169 | $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;) |
| 170 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 171 | KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers |
| 172 | |
| 173 | endif |
| 174 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 175 | # Currently, for versions of gcc which support it, the kernel Makefile |
| 176 | # is disabling the maybe-uninitialized warning. Re-enable it for the |
| 177 | # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it |
| 178 | # will override the kernel settings. |
| 179 | ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y) |
| 180 | EXTRA_CFLAGS += -Wmaybe-uninitialized |
| 181 | endif |
| 182 | #EXTRA_CFLAGS += -Wmissing-prototypes |
| 183 | |
| 184 | ifeq ($(call cc-option-yn, -Wheader-guard),y) |
| 185 | EXTRA_CFLAGS += -Wheader-guard |
| 186 | endif |
| 187 | # If the module name is not "wlan", then the define MULTI_IF_NAME to be the |
| 188 | # same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to |
| 189 | # any string that must be unique for all instances of the driver on the system. |
| 190 | # This allows multiple instances of the driver with different module names. |
| 191 | # If the module name is wlan, leave MULTI_IF_NAME undefined and the code will |
| 192 | # treat the driver as the primary driver. |
| 193 | ifneq ($(MODNAME), qdsp6v2) |
| 194 | CHIP_NAME ?= $(MODNAME) |
| 195 | CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\" |
| 196 | endif |
| 197 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 198 | # Module information used by KBuild framework |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 199 | obj-$(CONFIG_MSM_QDSP6_APRV2) += apr_dlkm.o |
Sundara Vinayagam | 3983833 | 2018-05-23 12:04:25 +0530 | [diff] [blame^] | 200 | obj-$(CONFIG_MSM_QDSP6_APRV3) += apr_dlkm.o |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 201 | obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr_dlkm.o |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 202 | obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr_dlkm.o |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 203 | apr_dlkm-y := $(APRV_GLINK) |
| 204 | |
| 205 | obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o |
| 206 | wglink_dlkm-y := $(WDSP_GLINK) |
| 207 | |
| 208 | # inject some build related information |
| 209 | CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\" |