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 | ifeq ($(KERNEL_BUILD), 1) |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 10 | # These are configurable via Kconfig for kernel-based builds |
| 11 | # Need to explicitly configure for Android-based builds |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 12 | AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9 |
| 13 | AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio |
| 14 | endif |
| 15 | |
| 16 | ifeq ($(KERNEL_BUILD), 0) |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 17 | ifeq ($(CONFIG_ARCH_SDM845), y) |
| 18 | include $(AUDIO_ROOT)/config/sdm845auto.conf |
| 19 | export |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 20 | INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 21 | endif |
| 22 | ifeq ($(CONFIG_ARCH_SDM670), y) |
| 23 | include $(AUDIO_ROOT)/config/sdm670auto.conf |
| 24 | export |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 25 | INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 26 | endif |
| 27 | endif |
| 28 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 29 | # As per target team, build is done as follows: |
| 30 | # Defconfig : build with default flags |
| 31 | # Slub : defconfig + CONFIG_SLUB_DEBUG := y + |
| 32 | # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y |
| 33 | # Perf : Using appropriate msmXXXX-perf_defconfig |
| 34 | # |
| 35 | # Shipment builds (user variants) should not have any debug feature |
| 36 | # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds |
| 37 | # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since |
| 38 | # there is no other way to identify defconfig builds, QTI internal |
| 39 | # representation of perf builds (identified using the string 'perf'), |
| 40 | # is used to identify if the build is a slub or defconfig one. This |
| 41 | # way no critical debug feature will be enabled for perf and shipment |
| 42 | # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT |
| 43 | # config. |
| 44 | |
| 45 | ############ UAPI ############ |
| 46 | UAPI_DIR := uapi |
| 47 | UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR) |
| 48 | |
| 49 | ############ COMMON ############ |
| 50 | COMMON_DIR := include |
| 51 | COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR) |
| 52 | |
| 53 | ############ ASoC Codecs ############ |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 54 | ifdef CONFIG_WCD9XXX_CODEC_CORE |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 55 | CORE_OBJS += wcd9xxx-rst.o |
| 56 | CORE_OBJS += wcd9xxx-core-init.o |
| 57 | CORE_OBJS += wcd9xxx-core.o |
| 58 | CORE_OBJS += wcd9xxx-irq.o |
| 59 | CORE_OBJS += wcd9xxx-slimslave.o |
| 60 | CORE_OBJS += wcd9xxx-utils.o |
| 61 | CORE_OBJS += wcd9335-regmap.o |
| 62 | CORE_OBJS += wcd9335-tables.o |
| 63 | CORE_OBJS += msm-cdc-pinctrl.o |
| 64 | CORE_OBJS += msm-cdc-supply.o |
| 65 | CORE_OBJS += wcd934x/wcd934x-regmap.o |
| 66 | CORE_OBJS += wcd934x/wcd934x-tables.o |
| 67 | endif |
| 68 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 69 | ifdef CONFIG_SND_SOC_WCD9XXX_V2 |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 70 | WCD9XXX_OBJS += wcd9xxx-common-v2.o |
| 71 | WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o |
| 72 | WCD9XXX_OBJS += wcdcal-hwdep.o |
| 73 | WCD9XXX_OBJS += wcd9xxx-soc-init.o |
| 74 | WCD9XXX_OBJS += wcd-dsp-utils.o |
| 75 | WCD9XXX_OBJS += wcd-dsp-mgr.o |
| 76 | WCD9XXX_OBJS += audio-ext-clk-up.o |
| 77 | endif |
| 78 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 79 | ifdef CONFIG_SND_SOC_WCD9335 |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 80 | WCD9335_OBJS += wcd9335.o |
| 81 | endif |
| 82 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 83 | ifdef CONFIG_SND_SOC_WSA881X |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 84 | WSA881X_OBJS += wsa881x.o |
| 85 | WSA881X_OBJS += wsa881x-tables.o |
| 86 | WSA881X_OBJS += wsa881x-regmap.o |
| 87 | WSA881X_OBJS += wsa881x-temp-sensor.o |
| 88 | endif |
| 89 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 90 | ifdef CONFIG_SND_SOC_MSM_STUB |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 91 | STUB_OBJS += msm_stub.o |
| 92 | endif |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 93 | ifdef CONFIG_SND_SOC_WCD_SPI |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 94 | SPI_OBJS += wcd-spi.o |
| 95 | endif |
| 96 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 97 | ifdef CONFIG_SND_SOC_WCD_CPE |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 98 | WCD_CPE_OBJS += wcd_cpe_core.o |
| 99 | WCD_CPE_OBJS += wcd_cpe_services.o |
| 100 | endif |
| 101 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 102 | ifdef CONFIG_SND_SOC_WCD_MBHC |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 103 | MBHC_OBJS += wcd-mbhc-v2.o |
| 104 | endif |
| 105 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 106 | ifdef CONFIG_SND_SOC_WCD_MBHC_ADC |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 107 | MBHC_OBJS += wcd-mbhc-adc.o |
| 108 | endif |
| 109 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 110 | ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 111 | MBHC_OBJS += wcd-mbhc-legacy.o |
| 112 | endif |
| 113 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 114 | ifdef CONFIG_SND_SOC_MSM_HDMI_CODEC_RX |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 115 | HDMICODEC_OBJS += msm_hdmi_codec_rx.o |
| 116 | endif |
| 117 | |
| 118 | LINUX_INC += -Iinclude/linux |
| 119 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 120 | INCS += $(COMMON_INC) \ |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 121 | $(UAPI_INC) |
| 122 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 123 | |
| 124 | EXTRA_CFLAGS += $(INCS) |
| 125 | |
| 126 | |
| 127 | CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \ |
| 128 | -DANI_LITTLE_BIT_ENDIAN \ |
| 129 | -DDOT11F_LITTLE_ENDIAN_HOST \ |
| 130 | -DANI_COMPILER_TYPE_GCC \ |
| 131 | -DANI_OS_TYPE_ANDROID=6 \ |
| 132 | -DPTT_SOCK_SVC_ENABLE \ |
| 133 | -Wall\ |
| 134 | -Werror\ |
| 135 | -D__linux__ |
| 136 | |
| 137 | KBUILD_CPPFLAGS += $(CDEFINES) |
| 138 | |
| 139 | # Currently, for versions of gcc which support it, the kernel Makefile |
| 140 | # is disabling the maybe-uninitialized warning. Re-enable it for the |
| 141 | # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it |
| 142 | # will override the kernel settings. |
| 143 | ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y) |
| 144 | EXTRA_CFLAGS += -Wmaybe-uninitialized |
| 145 | endif |
| 146 | #EXTRA_CFLAGS += -Wmissing-prototypes |
| 147 | |
| 148 | ifeq ($(call cc-option-yn, -Wheader-guard),y) |
| 149 | EXTRA_CFLAGS += -Wheader-guard |
| 150 | endif |
| 151 | |
| 152 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 153 | ifeq ($(KERNEL_BUILD), 0) |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 154 | KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers |
| 155 | KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame^] | 156 | endif |
| 157 | |
| 158 | ifeq ($(KERNEL_BUILD), 1) |
| 159 | obj-y += wcd934x/ |
| 160 | obj-y += sdm660_cdc/ |
| 161 | obj-y += msm_sdw/ |
| 162 | endif |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 163 | # Module information used by KBuild framework |
| 164 | obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o |
| 165 | wcd_core_dlkm-y := $(CORE_OBJS) |
| 166 | |
| 167 | obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += wcd9xxx_dlkm.o |
| 168 | wcd9xxx_dlkm-y := $(WCD9XXX_OBJS) |
| 169 | |
| 170 | obj-$(CONFIG_SND_SOC_WCD9335) += wcd9335_dlkm.o |
| 171 | wcd9335_dlkm-y := $(WCD9335_OBJS) |
| 172 | |
| 173 | obj-$(CONFIG_SND_SOC_WSA881X) += wsa881x_dlkm.o |
| 174 | wsa881x_dlkm-y := $(WSA881X_OBJS) |
| 175 | |
| 176 | obj-$(CONFIG_SND_SOC_MSM_STUB) += stub_dlkm.o |
| 177 | stub_dlkm-y := $(STUB_OBJS) |
| 178 | |
| 179 | obj-$(CONFIG_SND_SOC_WCD_CPE) += wcd_cpe_dlkm.o |
| 180 | wcd_cpe_dlkm-y := $(WCD_CPE_OBJS) |
| 181 | |
| 182 | obj-$(CONFIG_SND_SOC_WCD_SPI) += wcd_spi_dlkm.o |
| 183 | wcd_spi_dlkm-y := $(SPI_OBJS) |
| 184 | |
| 185 | obj-$(CONFIG_SND_SOC_WCD_MBHC) += mbhc_dlkm.o |
| 186 | mbhc_dlkm-y := $(MBHC_OBJS) |
| 187 | |
| 188 | obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += hdmi_dlkm.o |
| 189 | hdmi_dlkm-y := $(HDMICODEC_OBJS) |
| 190 | |
| 191 | # inject some build related information |
| 192 | DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\" |