blob: e46e39d20cf60381f01416f27c985d162561186a [file] [log] [blame]
Laxminath Kasam8b1366a2017-10-05 01:44:16 +05301# We can build either as part of a standalone Kernel build or as
2# an external module. Determine which mechanism is being used
Asish Bhattacharya5faacb32017-12-04 17:23:15 +05303ifeq ($(MODNAME),)
4 KERNEL_BUILD := 1
5else
6 KERNEL_BUILD := 0
7endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +05308
9
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053010
11ifeq ($(KERNEL_BUILD), 1)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053012 # These are configurable via Kconfig for kernel-based builds
13 # Need to explicitly configure for Android-based builds
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053014 AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
15 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
16endif
17
18ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053019 ifeq ($(CONFIG_ARCH_SDM845), y)
20 include $(AUDIO_ROOT)/config/sdm845auto.conf
21 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053022 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053023 endif
24 ifeq ($(CONFIG_ARCH_SDM670), y)
25 include $(AUDIO_ROOT)/config/sdm670auto.conf
26 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053027 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053028 endif
29endif
30
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053031# As per target team, build is done as follows:
32# Defconfig : build with default flags
33# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
34# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
35# Perf : Using appropriate msmXXXX-perf_defconfig
36#
37# Shipment builds (user variants) should not have any debug feature
38# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
39# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
40# there is no other way to identify defconfig builds, QTI internal
41# representation of perf builds (identified using the string 'perf'),
42# is used to identify if the build is a slub or defconfig one. This
43# way no critical debug feature will be enabled for perf and shipment
44# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
45# config.
46
47############ UAPI ############
48UAPI_DIR := uapi
49UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
50
51############ COMMON ############
52COMMON_DIR := include
53COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
54
55############ WCD934X ############
56
57# for WCD934X Codec
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053058ifdef CONFIG_SND_SOC_WCD934X
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053059 WCD934X_OBJS += wcd934x.o
60 WCD934X_OBJS += wcd934x-dsp-cntl.o
61 WCD934X_OBJS += wcd934x-mbhc.o
62 WCD934X_OBJS += wcd934x-dsd.o
63endif
64
65LINUX_INC += -Iinclude/linux
66
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053067INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053068 $(UAPI_INC)
69
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053070EXTRA_CFLAGS += $(INCS)
71
72
73CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
74 -DANI_LITTLE_BIT_ENDIAN \
75 -DDOT11F_LITTLE_ENDIAN_HOST \
76 -DANI_COMPILER_TYPE_GCC \
77 -DANI_OS_TYPE_ANDROID=6 \
78 -DPTT_SOCK_SVC_ENABLE \
79 -Wall\
80 -Werror\
81 -D__linux__
82
83KBUILD_CPPFLAGS += $(CDEFINES)
84
85# Currently, for versions of gcc which support it, the kernel Makefile
86# is disabling the maybe-uninitialized warning. Re-enable it for the
87# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
88# will override the kernel settings.
89ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
90EXTRA_CFLAGS += -Wmaybe-uninitialized
91endif
92#EXTRA_CFLAGS += -Wmissing-prototypes
93
94ifeq ($(call cc-option-yn, -Wheader-guard),y)
95EXTRA_CFLAGS += -Wheader-guard
96endif
97
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053098ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053099KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
100KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
101KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
102KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
103KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530104endif
105
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530106# Module information used by KBuild framework
107obj-$(CONFIG_SND_SOC_WCD934X) += wcd934x_dlkm.o
108wcd934x_dlkm-y := $(WCD934X_OBJS)
109
110# inject some build related information
111DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"