Kbuild 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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. ifeq ($(KERNEL_BUILD), 1)
  9. # These are configurable via Kconfig for kernel-based builds
  10. # Need to explicitly configure for Android-based builds
  11. AUDIO_BLD_DIR := $(shell pwd)/kernel/msm-5.4
  12. AUDIO_ROOT := $(AUDIO_BLD_DIR)/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. else
  26. ifeq ($(KERNEL_BUILD), 0)
  27. ifeq ($(CONFIG_ARCH_SM8150), y)
  28. ifdef CONFIG_SND_SOC_SA8155
  29. include $(AUDIO_ROOT)/config/sa8155auto.conf
  30. export
  31. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  32. else
  33. include $(AUDIO_ROOT)/config/sm8150auto.conf
  34. export
  35. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  36. endif
  37. endif
  38. ifeq ($(CONFIG_ARCH_SM6150), y)
  39. ifdef CONFIG_SND_SOC_SA6155
  40. include $(AUDIO_ROOT)/config/sa6155auto.conf
  41. export
  42. INCS += -include $(AUDIO_ROOT)/config/sa6155autoconf.h
  43. else
  44. include $(AUDIO_ROOT)/config/sm6150auto.conf
  45. export
  46. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  47. endif
  48. endif
  49. ifeq ($(CONFIG_ARCH_TRINKET), y)
  50. include $(AUDIO_ROOT)/config/sm6150auto.conf
  51. export
  52. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  53. endif
  54. ifeq ($(CONFIG_ARCH_KONA), y)
  55. include $(AUDIO_ROOT)/config/konaauto.conf
  56. INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
  57. endif
  58. ifeq ($(CONFIG_ARCH_LITO), y)
  59. include $(AUDIO_ROOT)/config/litoauto.conf
  60. export
  61. INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
  62. endif
  63. ifeq ($(CONFIG_ARCH_BENGAL), y)
  64. include $(AUDIO_ROOT)/config/bengalauto.conf
  65. export
  66. INCS += -include $(AUDIO_ROOT)/config/bengalautoconf.h
  67. endif
  68. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  69. ifdef CONFIG_SND_SOC_SA8155
  70. include $(AUDIO_ROOT)/config/sa8155auto.conf
  71. export
  72. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  73. else
  74. include $(AUDIO_ROOT)/config/sm8150auto.conf
  75. export
  76. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  77. endif
  78. endif
  79. ifeq ($(CONFIG_ARCH_QCS405), y)
  80. include $(AUDIO_ROOT)/config/qcs405auto.conf
  81. export
  82. INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
  83. endif
  84. ifeq ($(CONFIG_QTI_QUIN_GVM), y)
  85. include $(AUDIO_ROOT)/config/gvmauto.conf
  86. export
  87. INCS += -include $(AUDIO_ROOT)/config/gvmautoconf.h
  88. endif
  89. ifeq ($(CONFIG_ARCH_SDXLEMUR), y)
  90. include $(AUDIO_ROOT)/config/sdxlemurauto.conf
  91. export
  92. INCS += -include $(AUDIO_ROOT)/config/sdxlemurautoconf.h
  93. endif
  94. endif
  95. endif
  96. # As per target team, build is done as follows:
  97. # Defconfig : build with default flags
  98. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  99. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  100. # Perf : Using appropriate msmXXXX-perf_defconfig
  101. #
  102. # Shipment builds (user variants) should not have any debug feature
  103. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  104. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  105. # there is no other way to identify defconfig builds, QTI internal
  106. # representation of perf builds (identified using the string 'perf'),
  107. # is used to identify if the build is a slub or defconfig one. This
  108. # way no critical debug feature will be enabled for perf and shipment
  109. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  110. # config.
  111. ############ UAPI ############
  112. UAPI_DIR := uapi/audio
  113. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  114. ############ COMMON ############
  115. COMMON_DIR := include
  116. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  117. ############ ASoC Drivers ############
  118. MACHINE_OBJS += msm_common.o
  119. # for SM8150 sound card driver
  120. ifdef CONFIG_SND_SOC_SM8150
  121. MACHINE_OBJS += sm8150.o
  122. MACHINE_OBJS += machine_815x_init.o
  123. endif
  124. # for SM6150 sound card driver
  125. ifdef CONFIG_SND_SOC_SM6150
  126. MACHINE_OBJS += sm6150.o
  127. MACHINE_OBJS += machine_615x_init.o
  128. endif
  129. # For sa6155 sound card driver
  130. ifdef CONFIG_SND_SOC_SA6155
  131. MACHINE_OBJS += sa6155.o
  132. endif
  133. # for qcs405 sound card driver
  134. ifdef CONFIG_SND_SOC_QCS405
  135. MACHINE_OBJS += qcs405.o
  136. endif
  137. # for KONA sound card driver
  138. ifdef CONFIG_SND_SOC_KONA
  139. MACHINE_OBJS += kona.o
  140. endif
  141. # for LAHAINA sound card driver
  142. ifdef CONFIG_SND_SOC_LAHAINA
  143. MACHINE_OBJS += lahaina.o
  144. endif
  145. # for HOLI sound card driver
  146. ifdef CONFIG_SND_SOC_HOLI
  147. MACHINE_OBJS += holi.o
  148. endif
  149. ifdef CONFIG_SND_SOC_LITO
  150. MACHINE_OBJS += kona.o
  151. endif
  152. # for BENGAL sound card driver
  153. ifdef CONFIG_SND_SOC_BENGAL
  154. MACHINE_OBJS += bengal.o
  155. endif
  156. # for sa8155 sound card driver
  157. ifdef CONFIG_SND_SOC_SA8155
  158. MACHINE_OBJS += sa8155.o
  159. endif
  160. ifdef CONFIG_SND_SOC_QDSP6V2
  161. PLATFORM_OBJS += platform_init.o
  162. endif
  163. ifdef CONFIG_SND_SOC_SDX
  164. MACHINE_OBJS += sdx-target.o
  165. endif
  166. LINUX_INC += -Iinclude/linux
  167. INCS += $(COMMON_INC) \
  168. $(UAPI_INC)
  169. EXTRA_CFLAGS += $(INCS)
  170. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  171. -DANI_LITTLE_BIT_ENDIAN \
  172. -DDOT11F_LITTLE_ENDIAN_HOST \
  173. -DANI_COMPILER_TYPE_GCC \
  174. -DANI_OS_TYPE_ANDROID=6 \
  175. -DPTT_SOCK_SVC_ENABLE \
  176. -Wall\
  177. -Werror\
  178. -D__linux__
  179. KBUILD_CPPFLAGS += $(CDEFINES)
  180. # Currently, for versions of gcc which support it, the kernel Makefile
  181. # is disabling the maybe-uninitialized warning. Re-enable it for the
  182. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  183. # will override the kernel settings.
  184. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  185. EXTRA_CFLAGS += -Wmaybe-uninitialized
  186. endif
  187. #EXTRA_CFLAGS += -Wmissing-prototypes
  188. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  189. EXTRA_CFLAGS += -Wheader-guard
  190. endif
  191. ifeq ($(KERNEL_BUILD), 0)
  192. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
  193. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
  194. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd934x/Module.symvers
  195. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd937x/Module.symvers
  196. endif
  197. ifeq ($(KERNEL_BUILD), 1)
  198. obj-y += codecs/
  199. endif
  200. # Module information used by KBuild framework
  201. obj-$(CONFIG_SND_SOC_QDSP6V2) += platform_dlkm.o
  202. platform_dlkm-y := $(PLATFORM_OBJS)
  203. obj-$(CONFIG_SND_SOC_SM8150) += machine_dlkm.o
  204. machine_dlkm-y := $(MACHINE_OBJS)
  205. obj-$(CONFIG_SND_SOC_SM6150) += machine_dlkm.o
  206. machine_dlkm-y := $(MACHINE_OBJS)
  207. obj-$(CONFIG_SND_SOC_SA6155) += machine_dlkm.o
  208. machine_dlkm-y := $(MACHINE_OBJS)
  209. obj-$(CONFIG_SND_SOC_QCS405) += machine_dlkm.o
  210. machine_dlkm-y := $(MACHINE_OBJS)
  211. obj-$(CONFIG_SND_SOC_KONA) += machine_dlkm.o
  212. machine_dlkm-y := $(MACHINE_OBJS)
  213. obj-$(CONFIG_SND_SOC_LAHAINA) += machine_dlkm.o
  214. machine_dlkm-y := $(MACHINE_OBJS)
  215. obj-$(CONFIG_SND_SOC_HOLI) += machine_dlkm.o
  216. machine_dlkm-y := $(MACHINE_OBJS)
  217. obj-$(CONFIG_SND_SOC_LITO) += machine_dlkm.o
  218. machine_dlkm-y := $(MACHINE_OBJS)
  219. obj-$(CONFIG_SND_SOC_BENGAL) += machine_dlkm.o
  220. machine_dlkm-y := $(MACHINE_OBJS)
  221. obj-$(CONFIG_SND_SOC_SA8155) += machine_dlkm.o
  222. machine_dlkm-y := $(MACHINE_OBJS)
  223. obj-$(CONFIG_SND_SOC_SDX) += machine_dlkm.o
  224. machine_dlkm-y := $(MACHINE_OBJS)
  225. # inject some build related information
  226. DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"