blob: b59bcb1194efa1a529ad9c7f69adfd4509589507 [file] [log] [blame]
Aditya Bavanarid273a6f2020-03-03 21:59:03 +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.19
15 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
16endif
17
18ifeq ($(KERNEL_BUILD), 0)
19 ifeq ($(CONFIG_ARCH_BENGAL), y)
20 include $(AUDIO_ROOT)/config/bengalauto.conf
21 export
22 INCS += -include $(AUDIO_ROOT)/config/bengalautoconf.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############ ROULEUR ############
51
52# for ROULEUR Codec
53ifdef CONFIG_SND_SOC_ROULEUR
54 ROULEUR_OBJS += rouleur.o
55 ROULEUR_OBJS += rouleur-regmap.o
56 ROULEUR_OBJS += rouleur-tables.o
57 ROULEUR_OBJS += rouleur-mbhc.o
58endif
59
60ifdef CONFIG_PM2250_SPMI
61 PM2250_SPMI_OBJS += pm2250_spmi.o
62endif
63
64ifdef CONFIG_SND_SOC_ROULEUR_SLAVE
65 ROULEUR_SLAVE_OBJS += rouleur_slave.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_ROULEUR) += rouleur_dlkm.o
111rouleur_dlkm-y := $(ROULEUR_OBJS)
112
113obj-$(CONFIG_SND_SOC_ROULEUR_SLAVE) += rouleur_slave_dlkm.o
114rouleur_slave_dlkm-y := $(ROULEUR_SLAVE_OBJS)
115
116obj-$(CONFIG_PM2250_SPMI) += pm2250_spmi_dlkm.o
117pm2250_spmi_dlkm-y := $(PM2250_SPMI_OBJS)
118
119# inject some build related information
120DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"