blob: c6cf4b705617395646ce6b29e8603c80b9e2c12f [file] [log] [blame]
Soumya Managolid11d6f02020-05-27 17:25:12 +05301# We can build either as part of a standalone Kernel build or as
2# an external module. Determine which mechanism is being used
3ifeq ($(MODNAME),)
4 KERNEL_BUILD := 1
5else
6 KERNEL_BUILD := 0
7endif
8
9
10ifeq ($(KERNEL_BUILD), 1)
11 # These are configurable via Kconfig for kernel-based builds
12 # Need to explicitly configure for Android-based builds
13 AUDIO_BLD_DIR := $(shell pwd)/kernel/msm-4.19
14 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
15endif
16
17ifeq ($(KERNEL_BUILD), 0)
18 ifeq ($(CONFIG_ARCH_SDM660), y)
19 include $(AUDIO_ROOT)/config/sdm660auto.conf
20 export
21 INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
22 endif
23endif
24
25# As per target team, build is done as follows:
26# Defconfig : build with default flags
27# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
28# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
29# Perf : Using appropriate msmXXXX-perf_defconfig
30#
31# Shipment builds (user variants) should not have any debug feature
32# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
33# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
34# there is no other way to identify defconfig builds, QTI internal
35# representation of perf builds (identified using the string 'perf'),
36# is used to identify if the build is a slub or defconfig one. This
37# way no critical debug feature will be enabled for perf and shipment
38# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
39# config.
40
41############ UAPI ############
42UAPI_DIR := uapi
43UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
44
45############ COMMON ############
46COMMON_DIR := include
47COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
48
49############ SDM660_CDC ############
50
51# for SDM660_CDC Codec
52ifdef CONFIG_SND_SOC_ANALOG_CDC
53 ANALOG_CDC_OBJS += msm-analog-cdc.o
54 ANALOG_CDC_OBJS += sdm660-cdc-irq.o
55endif
56
57ifdef CONFIG_SND_SOC_DIGITAL_CDC
58 DIGITAL_CDC_OBJS += msm-digital-cdc.o
59 DIGITAL_CDC_OBJS += msm-digital-cdc-regmap.o
60endif
61LINUX_INC += -Iinclude/linux
62
63INCS += $(COMMON_INC) \
64 $(UAPI_INC)
65
66EXTRA_CFLAGS += $(INCS)
67
68
69CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
70 -DANI_LITTLE_BIT_ENDIAN \
71 -DDOT11F_LITTLE_ENDIAN_HOST \
72 -DANI_COMPILER_TYPE_GCC \
73 -DANI_OS_TYPE_ANDROID=6 \
74 -DPTT_SOCK_SVC_ENABLE \
75 -Wall\
76 -Werror\
77 -D__linux__
78
79KBUILD_CPPFLAGS += $(CDEFINES)
80
81# Currently, for versions of gcc which support it, the kernel Makefile
82# is disabling the maybe-uninitialized warning. Re-enable it for the
83# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
84# will override the kernel settings.
85ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
86EXTRA_CFLAGS += -Wmaybe-uninitialized
87endif
88#EXTRA_CFLAGS += -Wmissing-prototypes
89
90ifeq ($(call cc-option-yn, -Wheader-guard),y)
91EXTRA_CFLAGS += -Wheader-guard
92endif
93
94
95ifeq ($(KERNEL_BUILD), 0)
96KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
97KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
98KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
99KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
100KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
101endif
102
103ifeq ($(CONFIG_SND_SOC_GCOV), y)
104GCOV_PROFILE := y
105endif
106
107# Module information used by KBuild framework
108obj-$(CONFIG_SND_SOC_ANALOG_CDC) += analog_cdc_dlkm.o
109analog_cdc_dlkm-y := $(ANALOG_CDC_OBJS)
110
111obj-$(CONFIG_SND_SOC_DIGITAL_CDC) += digital_cdc_dlkm.o
112digital_cdc_dlkm-y := $(DIGITAL_CDC_OBJS)
113
114# inject some build related information
115DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"