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