Kbuild 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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. 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_SM8150), y)
  38. ifdef CONFIG_SND_SOC_SA8155
  39. include $(AUDIO_ROOT)/config/sa8155auto.conf
  40. export
  41. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  42. else
  43. include $(AUDIO_ROOT)/config/sm8150auto.conf
  44. export
  45. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  46. endif
  47. endif
  48. ifeq ($(CONFIG_ARCH_SM6150), y)
  49. ifdef CONFIG_SND_SOC_SA6155
  50. include $(AUDIO_ROOT)/config/sa6155auto.conf
  51. export
  52. INCS += -include $(AUDIO_ROOT)/config/sa6155autoconf.h
  53. else
  54. include $(AUDIO_ROOT)/config/sm6150auto.conf
  55. export
  56. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  57. endif
  58. endif
  59. ifeq ($(CONFIG_ARCH_TRINKET), y)
  60. include $(AUDIO_ROOT)/config/sm6150auto.conf
  61. export
  62. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  63. endif
  64. ifeq ($(CONFIG_ARCH_KONA), y)
  65. include $(AUDIO_ROOT)/config/konaauto.conf
  66. INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
  67. endif
  68. ifeq ($(CONFIG_ARCH_WAIPIO), y)
  69. include $(AUDIO_ROOT)/config/waipioauto.conf
  70. INCS += -include $(AUDIO_ROOT)/config/waipioautoconf.h
  71. endif
  72. ifeq ($(CONFIG_ARCH_KALAMA), y)
  73. include $(AUDIO_ROOT)/config/kalamaauto.conf
  74. INCS += -include $(AUDIO_ROOT)/config/kalamaautoconf.h
  75. endif
  76. ifeq ($(CONFIG_ARCH_PINEAPPLE), y)
  77. include $(AUDIO_ROOT)/config/pineappleauto.conf
  78. INCS += -include $(AUDIO_ROOT)/config/pineappleautoconf.h
  79. endif
  80. ifeq ($(CONFIG_ARCH_PITTI), y)
  81. include $(AUDIO_ROOT)/config/pineappleauto.conf
  82. INCS += -include $(AUDIO_ROOT)/config/pineappleautoconf.h
  83. endif
  84. ifeq ($(CONFIG_ARCH_LITO), y)
  85. include $(AUDIO_ROOT)/config/litoauto.conf
  86. export
  87. INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
  88. endif
  89. ifeq ($(CONFIG_ARCH_KHAJE), y)
  90. include $(AUDIO_ROOT)/config/bengalauto.conf
  91. export
  92. INCS += -include $(AUDIO_ROOT)/config/bengalautoconf.h
  93. endif
  94. ifeq ($(CONFIG_ARCH_HOLI), y)
  95. include $(AUDIO_ROOT)/config/holiauto.conf
  96. INCS += -include $(AUDIO_ROOT)/config/holiautoconf.h
  97. endif
  98. ifeq ($(CONFIG_ARCH_BLAIR), y)
  99. include $(AUDIO_ROOT)/config/holiauto.conf
  100. INCS += -include $(AUDIO_ROOT)/config/holiautoconf.h
  101. endif
  102. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  103. ifdef CONFIG_SND_SOC_SA8155
  104. include $(AUDIO_ROOT)/config/sa8155auto.conf
  105. export
  106. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  107. else
  108. include $(AUDIO_ROOT)/config/sm8150auto.conf
  109. export
  110. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  111. endif
  112. endif
  113. ifeq ($(CONFIG_ARCH_QCS405), y)
  114. include $(AUDIO_ROOT)/config/qcs405auto.conf
  115. export
  116. INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
  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. ############ ASoC Drivers ############
  152. MACHINE_OBJS += msm_common.o
  153. # for SM8150 sound card driver
  154. ifdef CONFIG_SND_SOC_SM8150
  155. MACHINE_OBJS += sm8150.o
  156. MACHINE_OBJS += machine_815x_init.o
  157. endif
  158. # for SM6150 sound card driver
  159. ifdef CONFIG_SND_SOC_SM6150
  160. MACHINE_OBJS += sm6150.o
  161. MACHINE_OBJS += machine_615x_init.o
  162. endif
  163. # For sa6155 sound card driver
  164. ifdef CONFIG_SND_SOC_SA6155
  165. MACHINE_OBJS += sa6155.o
  166. endif
  167. # for qcs405 sound card driver
  168. ifdef CONFIG_SND_SOC_QCS405
  169. MACHINE_OBJS += qcs405.o
  170. endif
  171. # for KONA sound card driver
  172. ifdef CONFIG_SND_SOC_KONA
  173. MACHINE_OBJS += kona.o
  174. endif
  175. # for LAHAINA sound card driver
  176. ifdef CONFIG_SND_SOC_LAHAINA
  177. MACHINE_OBJS += lahaina.o
  178. endif
  179. # for WAIPIO sound card driver
  180. ifdef CONFIG_SND_SOC_WAIPIO
  181. MACHINE_OBJS += waipio.o
  182. endif
  183. # for KALAMA sound card driver
  184. ifdef CONFIG_SND_SOC_KALAMA
  185. MACHINE_OBJS += kalama.o
  186. endif
  187. # for PINEAPPLE sound card driver
  188. ifdef CONFIG_SND_SOC_PINEAPPLE
  189. MACHINE_OBJS += pineapple.o
  190. endif
  191. # for HOLI sound card driver
  192. ifdef CONFIG_SND_SOC_HOLI
  193. MACHINE_OBJS += holi.o
  194. endif
  195. ifdef CONFIG_SND_SOC_LITO
  196. MACHINE_OBJS += kona.o
  197. endif
  198. # for BENGAL sound card driver
  199. ifdef CONFIG_SND_SOC_BENGAL
  200. MACHINE_OBJS += bengal.o
  201. endif
  202. # for sa8155 sound card driver
  203. ifdef CONFIG_SND_SOC_SA8155
  204. MACHINE_OBJS += sa8155.o
  205. endif
  206. # for sa7255 sound card driver
  207. ifdef CONFIG_SND_SOC_SA7255_AUTO_SPF
  208. SPF_MACHINE_OBJS += msm_common.o
  209. SPF_MACHINE_OBJS += auto_spf_dummy.o
  210. endif
  211. ifdef CONFIG_SND_SOC_QDSP6V2
  212. PLATFORM_OBJS += platform_init.o
  213. endif
  214. ifdef CONFIG_SND_SOC_SDX
  215. MACHINE_OBJS += sdx-target.o
  216. endif
  217. ifdef CONFIG_SND_SOC_GVM_AUTO_SPF
  218. SPF_MACHINE_OBJS += gvm_auto_spf_dummy.o
  219. endif
  220. LINUX_INC += -Iinclude/linux
  221. INCS += $(COMMON_INC) \
  222. $(UAPI_INC)
  223. EXTRA_CFLAGS += $(INCS)
  224. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  225. -DANI_LITTLE_BIT_ENDIAN \
  226. -DDOT11F_LITTLE_ENDIAN_HOST \
  227. -DANI_COMPILER_TYPE_GCC \
  228. -DANI_OS_TYPE_ANDROID=6 \
  229. -DPTT_SOCK_SVC_ENABLE \
  230. -Wall\
  231. -Werror\
  232. -D__linux__
  233. KBUILD_CPPFLAGS += $(CDEFINES)
  234. # Currently, for versions of gcc which support it, the kernel Makefile
  235. # is disabling the maybe-uninitialized warning. Re-enable it for the
  236. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  237. # will override the kernel settings.
  238. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  239. EXTRA_CFLAGS += -Wmaybe-uninitialized
  240. endif
  241. #EXTRA_CFLAGS += -Wmissing-prototypes
  242. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  243. EXTRA_CFLAGS += -Wheader-guard
  244. endif
  245. ifeq ($(KERNEL_BUILD), 1)
  246. obj-y += codecs/
  247. endif
  248. # Module information used by KBuild framework
  249. obj-$(CONFIG_SND_SOC_QDSP6V2) += platform_dlkm.o
  250. platform_dlkm-y := $(PLATFORM_OBJS)
  251. obj-$(CONFIG_SND_SOC_SM8150) += machine_dlkm.o
  252. machine_dlkm-y := $(MACHINE_OBJS)
  253. obj-$(CONFIG_SND_SOC_SM6150) += machine_dlkm.o
  254. machine_dlkm-y := $(MACHINE_OBJS)
  255. obj-$(CONFIG_SND_SOC_SA6155) += machine_dlkm.o
  256. machine_dlkm-y := $(MACHINE_OBJS)
  257. obj-$(CONFIG_SND_SOC_QCS405) += machine_dlkm.o
  258. machine_dlkm-y := $(MACHINE_OBJS)
  259. obj-$(CONFIG_SND_SOC_KONA) += machine_dlkm.o
  260. machine_dlkm-y := $(MACHINE_OBJS)
  261. obj-$(CONFIG_SND_SOC_LAHAINA) += machine_dlkm.o
  262. machine_dlkm-y := $(MACHINE_OBJS)
  263. obj-$(CONFIG_SND_SOC_WAIPIO) += machine_dlkm.o
  264. machine_dlkm-y := $(MACHINE_OBJS)
  265. obj-$(CONFIG_SND_SOC_KALAMA) += machine_dlkm.o
  266. machine_dlkm-y := $(MACHINE_OBJS)
  267. obj-$(CONFIG_SND_SOC_PINEAPPLE) += machine_dlkm.o
  268. machine_dlkm-y := $(MACHINE_OBJS)
  269. obj-$(CONFIG_SND_SOC_HOLI) += machine_dlkm.o
  270. machine_dlkm-y := $(MACHINE_OBJS)
  271. obj-$(CONFIG_SND_SOC_LITO) += machine_dlkm.o
  272. machine_dlkm-y := $(MACHINE_OBJS)
  273. obj-$(CONFIG_SND_SOC_BENGAL) += machine_dlkm.o
  274. machine_dlkm-y := $(MACHINE_OBJS)
  275. obj-$(CONFIG_SND_SOC_SA8155) += machine_dlkm.o
  276. machine_dlkm-y := $(MACHINE_OBJS)
  277. obj-$(CONFIG_SND_SOC_SDX) += machine_dlkm.o
  278. machine_dlkm-y := $(MACHINE_OBJS)
  279. obj-$(CONFIG_SND_SOC_GVM_AUTO_SPF) += spf_machine_dlkm.o
  280. spf_machine_dlkm-y := $(SPF_MACHINE_OBJS)
  281. obj-$(CONFIG_SND_SOC_SA7255_AUTO_SPF) += spf_machine_dlkm.o
  282. spf_machine_dlkm-y := $(SPF_MACHINE_OBJS)
  283. # inject some build related information
  284. DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"