blob: 087aa44f6107de9c8ca550db9288f4b50b9b5b57 [file] [log] [blame]
Rohit kumar759426e2018-05-14 18:21:52 +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.9
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############ WCD937X ############
51
52# for WCD937X Codec
53ifdef CONFIG_SND_SOC_WCD937X
54 WCD937X_OBJS += wcd937x.o
55endif
56
57ifdef CONFIG_SND_SOC_WCD937X_SLAVE
58 WCD937X_SLAVE_OBJS += wcd937x_slave.o
59endif
60
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
94ifeq ($(KERNEL_BUILD), 0)
95KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
96KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
97KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
98KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
99KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
100endif
101
102# Module information used by KBuild framework
103obj-$(CONFIG_SND_SOC_WCD937X) += wcd937x_dlkm.o
104wcd937x_dlkm-y := $(WCD937X_OBJS)
105
106obj-$(CONFIG_SND_SOC_WCD937X_SLAVE) += wcd937x_slave_dlkm.o
107wcd937x_slave_dlkm-y := $(WCD937X_SLAVE_OBJS)
108
109# inject some build related information
110DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"