blob: 60b24853e37fd8498e246385f8b9a05fee63c97c [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
Laxminath Kasam942d1c62017-12-29 11:02:22 +053029 ifeq ($(CONFIG_ARCH_SDM450), y)
30 include $(AUDIO_ROOT)/config/sdm670auto.conf
31 export
32 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
33 endif
Sudheer Papothicc0a22d2018-03-02 06:29:57 +053034 ifeq ($(CONFIG_ARCH_SDM855), y)
35 include $(AUDIO_ROOT)/config/sdm855auto.conf
36 export
37 INCS += -include $(AUDIO_ROOT)/config/sdm855autoconf.h
38 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053039endif
40
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053041# As per target team, build is done as follows:
42# Defconfig : build with default flags
43# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
44# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
45# Perf : Using appropriate msmXXXX-perf_defconfig
46#
47# Shipment builds (user variants) should not have any debug feature
48# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
49# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
50# there is no other way to identify defconfig builds, QTI internal
51# representation of perf builds (identified using the string 'perf'),
52# is used to identify if the build is a slub or defconfig one. This
53# way no critical debug feature will be enabled for perf and shipment
54# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
55# config.
56
57############ UAPI ############
58UAPI_DIR := uapi
59UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
60
61############ COMMON ############
62COMMON_DIR := include
63COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
64
65############ WCD934X ############
66
67# for WCD934X Codec
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053068ifdef CONFIG_SND_SOC_WCD934X
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053069 WCD934X_OBJS += wcd934x.o
70 WCD934X_OBJS += wcd934x-dsp-cntl.o
71 WCD934X_OBJS += wcd934x-mbhc.o
72 WCD934X_OBJS += wcd934x-dsd.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
95# Currently, for versions of gcc which support it, the kernel Makefile
96# is disabling the maybe-uninitialized warning. Re-enable it for the
97# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
98# will override the kernel settings.
99ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
100EXTRA_CFLAGS += -Wmaybe-uninitialized
101endif
102#EXTRA_CFLAGS += -Wmissing-prototypes
103
104ifeq ($(call cc-option-yn, -Wheader-guard),y)
105EXTRA_CFLAGS += -Wheader-guard
106endif
107
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530108ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530109KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
110KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
111KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
112KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
113KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530114endif
115
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530116# Module information used by KBuild framework
117obj-$(CONFIG_SND_SOC_WCD934X) += wcd934x_dlkm.o
118wcd934x_dlkm-y := $(WCD934X_OBJS)
119
120# inject some build related information
121DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"