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