Kbuild 6.7 KB

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