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