blob: 46639d29f01197c77f89c591788f2e3b3e02a89c [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 +053010ifeq ($(KERNEL_BUILD), 1)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053011 # These are configurable via Kconfig for kernel-based builds
12 # Need to explicitly configure for Android-based builds
Siddeswar Aluganti85e9e162018-09-25 19:03:00 -070013 AUDIO_BLD_DIR := $(shell pwd)/kernel/msm-4.9
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053014 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
15endif
16
17ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053018 ifeq ($(CONFIG_ARCH_SDM845), y)
19 include $(AUDIO_ROOT)/config/sdm845auto.conf
20 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053021 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053022 endif
23 ifeq ($(CONFIG_ARCH_SDM670), y)
24 include $(AUDIO_ROOT)/config/sdm670auto.conf
25 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053026 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053027 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053028 ifeq ($(CONFIG_ARCH_SDM450), y)
29 include $(AUDIO_ROOT)/config/sdm670auto.conf
30 export
31 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
32 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053033endif
34
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053035# As per target team, build is done as follows:
36# Defconfig : build with default flags
37# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
38# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
39# Perf : Using appropriate msmXXXX-perf_defconfig
40#
41# Shipment builds (user variants) should not have any debug feature
42# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
43# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
44# there is no other way to identify defconfig builds, QTI internal
45# representation of perf builds (identified using the string 'perf'),
46# is used to identify if the build is a slub or defconfig one. This
47# way no critical debug feature will be enabled for perf and shipment
48# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
49# config.
50
51############ UAPI ############
52UAPI_DIR := uapi
53UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
54
55############ COMMON ############
56COMMON_DIR := include
57COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
58
59############ MSM Soundwire ############
60
61# for MSM Soundwire Codec
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053062ifdef CONFIG_SND_SOC_MSM_SDW
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053063 MSM_SDW_OBJS += msm_sdw_cdc.o
64 MSM_SDW_OBJS += msm_sdw_regmap.o
65 MSM_SDW_OBJS += msm-sdw-tables.o
66 MSM_SDW_OBJS += msm_sdw_cdc_utils.o
67endif
68
69LINUX_INC += -Iinclude/linux
70
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053071INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053072 $(UAPI_INC)
73
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053074EXTRA_CFLAGS += $(INCS)
75
76
77CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
78 -DANI_LITTLE_BIT_ENDIAN \
79 -DDOT11F_LITTLE_ENDIAN_HOST \
80 -DANI_COMPILER_TYPE_GCC \
81 -DANI_OS_TYPE_ANDROID=6 \
82 -DPTT_SOCK_SVC_ENABLE \
83 -Wall\
84 -Werror\
85 -D__linux__
86
87KBUILD_CPPFLAGS += $(CDEFINES)
88
89# Currently, for versions of gcc which support it, the kernel Makefile
90# is disabling the maybe-uninitialized warning. Re-enable it for the
91# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
92# will override the kernel settings.
93ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
94EXTRA_CFLAGS += -Wmaybe-uninitialized
95endif
96#EXTRA_CFLAGS += -Wmissing-prototypes
97
98ifeq ($(call cc-option-yn, -Wheader-guard),y)
99EXTRA_CFLAGS += -Wheader-guard
100endif
101
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530102ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530103KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
104KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
105KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
106KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
107KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530108endif
109
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530110# Module information used by KBuild framework
111obj-$(CONFIG_SND_SOC_MSM_SDW) += msm_sdw_dlkm.o
112msm_sdw_dlkm-y := $(MSM_SDW_OBJS)
113
114# inject some build related information
115DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"