Kbuild 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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-5.4
  11. ifeq ($(KERNEL_BUILD), 1)
  12. AUDIO_ROOT := $(KDIR)/techpack/audio
  13. endif
  14. ifeq ($(CONFIG_SND_SOC_AUTO), y)
  15. ifdef CONFIG_SND_SOC_SA8155
  16. include $(AUDIO_ROOT)/config/sa8155auto.conf
  17. export
  18. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  19. endif
  20. ifdef CONFIG_SND_SOC_SA6155
  21. include $(AUDIO_ROOT)/config/sa6155auto.conf
  22. export
  23. INCS += -include $(AUDIO_ROOT)/config/sa6155autoconf.h
  24. endif
  25. ifdef CONFIG_SND_SOC_GVM
  26. include $(AUDIO_ROOT)/config/gvmauto.conf
  27. export
  28. INCS += -include $(AUDIO_ROOT)/config/gvmautoconf.h
  29. endif
  30. ifdef CONFIG_SND_SOC_SA7255
  31. include $(AUDIO_ROOT)/config/sa7255auto.conf
  32. export
  33. INCS += -include $(AUDIO_ROOT)/config/sa7255autoconf.h
  34. endif
  35. else
  36. ifeq ($(KERNEL_BUILD), 0)
  37. ifeq ($(CONFIG_ARCH_SM6150), y)
  38. ifdef CONFIG_SND_SOC_SA6155
  39. include $(AUDIO_ROOT)/config/sa6155auto.conf
  40. export
  41. INCS += -include $(AUDIO_ROOT)/config/sa6155autoconf.h
  42. else
  43. include $(AUDIO_ROOT)/config/sm6150auto.conf
  44. export
  45. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  46. endif
  47. endif
  48. ifeq ($(CONFIG_ARCH_TRINKET), y)
  49. include $(AUDIO_ROOT)/config/sm6150auto.conf
  50. export
  51. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  52. endif
  53. ifeq ($(CONFIG_ARCH_KONA), y)
  54. include $(AUDIO_ROOT)/config/konaauto.conf
  55. INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
  56. endif
  57. ifeq ($(CONFIG_ARCH_WAIPIO), y)
  58. include $(AUDIO_ROOT)/config/waipioauto.conf
  59. INCS += -include $(AUDIO_ROOT)/config/waipioautoconf.h
  60. endif
  61. ifeq ($(CONFIG_ARCH_KALAMA), y)
  62. include $(AUDIO_ROOT)/config/kalamaauto.conf
  63. INCS += -include $(AUDIO_ROOT)/config/kalamaautoconf.h
  64. endif
  65. ifeq ($(CONFIG_ARCH_PINEAPPLE), y)
  66. include $(AUDIO_ROOT)/config/pineappleauto.conf
  67. INCS += -include $(AUDIO_ROOT)/config/pineappleautoconf.h
  68. endif
  69. ifeq ($(CONFIG_ARCH_PITTI), y)
  70. include $(AUDIO_ROOT)/config/pittiauto.conf
  71. INCS += -include $(AUDIO_ROOT)/config/pittiautoconf.h
  72. endif
  73. ifeq ($(CONFIG_ARCH_LITO), y)
  74. include $(AUDIO_ROOT)/config/litoauto.conf
  75. export
  76. INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
  77. endif
  78. ifeq ($(CONFIG_ARCH_KHAJE), y)
  79. include $(AUDIO_ROOT)/config/bengalauto.conf
  80. export
  81. INCS += -include $(AUDIO_ROOT)/config/bengalautoconf.h
  82. endif
  83. ifeq ($(CONFIG_ARCH_HOLI), y)
  84. include $(AUDIO_ROOT)/config/holiauto.conf
  85. INCS += -include $(AUDIO_ROOT)/config/holiautoconf.h
  86. endif
  87. ifeq ($(CONFIG_ARCH_BLAIR), y)
  88. include $(AUDIO_ROOT)/config/holiauto.conf
  89. INCS += -include $(AUDIO_ROOT)/config/holiautoconf.h
  90. endif
  91. ifeq ($(CONFIG_ARCH_SM8150), y)
  92. ifdef CONFIG_SND_SOC_SA8155
  93. include $(AUDIO_ROOT)/config/sa8155auto.conf
  94. export
  95. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  96. else
  97. include $(AUDIO_ROOT)/config/sm8150auto.conf
  98. export
  99. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  100. endif
  101. endif
  102. ifeq ($(CONFIG_ARCH_QCS405), y)
  103. include $(AUDIO_ROOT)/config/qcs405auto.conf
  104. export
  105. INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
  106. endif
  107. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  108. ifdef CONFIG_SND_SOC_SA8155
  109. include $(AUDIO_ROOT)/config/sa8155auto.conf
  110. export
  111. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  112. else
  113. include $(AUDIO_ROOT)/config/sm8150auto.conf
  114. export
  115. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  116. endif
  117. endif
  118. ifeq ($(CONFIG_QTI_QUIN_GVM), y)
  119. include $(AUDIO_ROOT)/config/gvmauto.conf
  120. export
  121. INCS += -include $(AUDIO_ROOT)/config/gvmautoconf.h
  122. endif
  123. ifeq ($(CONFIG_ARCH_SDXLEMUR), y)
  124. include $(AUDIO_ROOT)/config/sdxlemurauto.conf
  125. export
  126. INCS += -include $(AUDIO_ROOT)/config/sdxlemurautoconf.h
  127. endif
  128. endif
  129. endif
  130. # As per target team, build is done as follows:
  131. # Defconfig : build with default flags
  132. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  133. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  134. # Perf : Using appropriate msmXXXX-perf_defconfig
  135. #
  136. # Shipment builds (user variants) should not have any debug feature
  137. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  138. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  139. # there is no other way to identify defconfig builds, QTI internal
  140. # representation of perf builds (identified using the string 'perf'),
  141. # is used to identify if the build is a slub or defconfig one. This
  142. # way no critical debug feature will be enabled for perf and shipment
  143. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  144. # config.
  145. ############ UAPI ############
  146. UAPI_DIR := uapi/audio
  147. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  148. ############ COMMON ############
  149. COMMON_DIR := include
  150. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  151. ############ IPC ############
  152. ifdef CONFIG_MSM_QDSP6_GPR_RPMSG
  153. GPRV_GLINK += gpr-lite.o
  154. endif
  155. ifdef CONFIG_AUDIO_PKT
  156. AUDIO_PKT += audio-pkt.o
  157. endif
  158. LINUX_INC += -Iinclude/linux
  159. INCS += $(COMMON_INC) \
  160. $(UAPI_INC)
  161. EXTRA_CFLAGS += $(INCS)
  162. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  163. -DANI_LITTLE_BIT_ENDIAN \
  164. -DDOT11F_LITTLE_ENDIAN_HOST \
  165. -DANI_COMPILER_TYPE_GCC \
  166. -DANI_OS_TYPE_ANDROID=6 \
  167. -DPTT_SOCK_SVC_ENABLE \
  168. -Wall\
  169. -Werror\
  170. -D__linux__
  171. KBUILD_CPPFLAGS += $(CDEFINES)
  172. # Currently, for versions of gcc which support it, the kernel Makefile
  173. # is disabling the maybe-uninitialized warning. Re-enable it for the
  174. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  175. # will override the kernel settings.
  176. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  177. EXTRA_CFLAGS += -Wmaybe-uninitialized
  178. endif
  179. #EXTRA_CFLAGS += -Wmissing-prototypes
  180. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  181. EXTRA_CFLAGS += -Wheader-guard
  182. endif
  183. # If the module name is not "wlan", then the define MULTI_IF_NAME to be the
  184. # same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
  185. # any string that must be unique for all instances of the driver on the system.
  186. # This allows multiple instances of the driver with different module names.
  187. # If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
  188. # treat the driver as the primary driver.
  189. ifneq ($(MODNAME), qdsp6v2)
  190. CHIP_NAME ?= $(MODNAME)
  191. CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
  192. endif
  193. ifeq ($(CONFIG_SND_SOC_GCOV), y)
  194. GCOV_PROFILE := y
  195. endif
  196. # Module information used by KBuild framework
  197. obj-$(CONFIG_MSM_QDSP6_GPR_RPMSG) += gpr_dlkm.o
  198. gpr_dlkm-y := $(GPRV_GLINK)
  199. obj-$(CONFIG_AUDIO_PKT) += audio_pkt_dlkm.o
  200. audio_pkt_dlkm-y := $(AUDIO_PKT)
  201. # inject some build related information
  202. CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"