Kbuild 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. # We can build either as part of a standalone Kernel build or as
  2. # an external module. Determine which mechanism is being used
  3. ifeq ($(MODNAME),)
  4. KERNEL_BUILD := 1
  5. else
  6. KERNEL_BUILD := 0
  7. endif
  8. # These are configurable via Kconfig for kernel-based builds
  9. # Need to explicitly configure for Android-based builds
  10. KDIR := $(TOP)/kernel/msm-4.19
  11. ifeq ($(KERNEL_BUILD), 1)
  12. AUDIO_ROOT := $(KDIR)/techpack/audio
  13. endif
  14. ifeq ($(KERNEL_BUILD), 0)
  15. ifeq ($(CONFIG_ARCH_SM6150), y)
  16. include $(AUDIO_ROOT)/config/sm6150auto.conf
  17. export
  18. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  19. endif
  20. ifeq ($(CONFIG_ARCH_TRINKET), y)
  21. include $(AUDIO_ROOT)/config/sm6150auto.conf
  22. export
  23. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  24. endif
  25. ifeq ($(CONFIG_ARCH_KONA), y)
  26. include $(AUDIO_ROOT)/config/konaauto.conf
  27. INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
  28. endif
  29. ifeq ($(CONFIG_ARCH_LITO), y)
  30. include $(AUDIO_ROOT)/config/litoauto.conf
  31. export
  32. INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
  33. endif
  34. ifeq ($(CONFIG_ARCH_SM8150), y)
  35. ifdef CONFIG_SND_SOC_SA8155
  36. include $(AUDIO_ROOT)/config/sa8155auto.conf
  37. export
  38. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  39. else
  40. include $(AUDIO_ROOT)/config/sm8150auto.conf
  41. export
  42. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  43. endif
  44. endif
  45. ifeq ($(CONFIG_ARCH_QCS405), y)
  46. include $(AUDIO_ROOT)/config/qcs405auto.conf
  47. export
  48. INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
  49. endif
  50. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  51. include $(AUDIO_ROOT)/config/sm8150auto.conf
  52. export
  53. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  54. endif
  55. ifeq ($(CONFIG_QTI_GVM), y)
  56. include $(AUDIO_ROOT)/config/gvmauto.conf
  57. export
  58. INCS += -include $(AUDIO_ROOT)/config/gvmautoconf.h
  59. endif
  60. endif
  61. # As per target team, build is done as follows:
  62. # Defconfig : build with default flags
  63. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  64. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  65. # Perf : Using appropriate msmXXXX-perf_defconfig
  66. #
  67. # Shipment builds (user variants) should not have any debug feature
  68. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  69. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  70. # there is no other way to identify defconfig builds, QTI internal
  71. # representation of perf builds (identified using the string 'perf'),
  72. # is used to identify if the build is a slub or defconfig one. This
  73. # way no critical debug feature will be enabled for perf and shipment
  74. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  75. # config.
  76. ############ UAPI ############
  77. UAPI_DIR := uapi
  78. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  79. ############ COMMON ############
  80. COMMON_DIR := include
  81. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  82. ############ IPC ############
  83. ifdef CONFIG_MSM_QDSP6_APRV2_RPMSG
  84. APRV_GLINK += apr.o
  85. APRV_GLINK += apr_v2.o
  86. APRV_GLINK += apr_tal_rpmsg.o
  87. endif
  88. ifdef CONFIG_MSM_QDSP6_APRV3_RPMSG
  89. APRV_GLINK += apr.o
  90. APRV_GLINK += apr_v3.o
  91. APRV_GLINK += apr_tal_rpmsg.o
  92. endif
  93. ifdef CONFIG_MSM_QDSP6_APRV2_VM
  94. APRV_GLINK += apr_vm.o
  95. APRV_GLINK += apr_v2.o
  96. endif
  97. ifdef CONFIG_WCD_DSP_GLINK
  98. WDSP_GLINK += wcd-dsp-glink.o
  99. endif
  100. LINUX_INC += -Iinclude/linux
  101. INCS += $(COMMON_INC) \
  102. $(UAPI_INC)
  103. EXTRA_CFLAGS += $(INCS)
  104. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  105. -DANI_LITTLE_BIT_ENDIAN \
  106. -DDOT11F_LITTLE_ENDIAN_HOST \
  107. -DANI_COMPILER_TYPE_GCC \
  108. -DANI_OS_TYPE_ANDROID=6 \
  109. -DPTT_SOCK_SVC_ENABLE \
  110. -Wall\
  111. -Werror\
  112. -D__linux__
  113. KBUILD_CPPFLAGS += $(CDEFINES)
  114. ifeq ($(KERNEL_BUILD), 0)
  115. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
  116. endif
  117. # Currently, for versions of gcc which support it, the kernel Makefile
  118. # is disabling the maybe-uninitialized warning. Re-enable it for the
  119. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  120. # will override the kernel settings.
  121. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  122. EXTRA_CFLAGS += -Wmaybe-uninitialized
  123. endif
  124. #EXTRA_CFLAGS += -Wmissing-prototypes
  125. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  126. EXTRA_CFLAGS += -Wheader-guard
  127. endif
  128. # If the module name is not "wlan", then the define MULTI_IF_NAME to be the
  129. # same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
  130. # any string that must be unique for all instances of the driver on the system.
  131. # This allows multiple instances of the driver with different module names.
  132. # If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
  133. # treat the driver as the primary driver.
  134. ifneq ($(MODNAME), qdsp6v2)
  135. CHIP_NAME ?= $(MODNAME)
  136. CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
  137. endif
  138. ifeq ($(CONFIG_SND_SOC_GCOV), y)
  139. GCOV_PROFILE := y
  140. endif
  141. # Module information used by KBuild framework
  142. obj-$(CONFIG_MSM_QDSP6_APRV2_RPMSG) += apr_dlkm.o
  143. obj-$(CONFIG_MSM_QDSP6_APRV3_RPMSG) += apr_dlkm.o
  144. obj-$(CONFIG_MSM_QDSP6_APRV2_VM) += apr_dlkm.o
  145. apr_dlkm-y := $(APRV_GLINK)
  146. obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
  147. wglink_dlkm-y := $(WDSP_GLINK)
  148. # inject some build related information
  149. CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"