Kbuild 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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 ($(BOARD_PLATFORM), pineapple)
  77. include $(AUDIO_ROOT)/config/pineappleauto.conf
  78. INCS += -include $(AUDIO_ROOT)/config/pineappleautoconf.h
  79. endif
  80. ifeq ($(BOARD_PLATFORM), cliffs)
  81. include $(AUDIO_ROOT)/config/pineappleauto.conf
  82. INCS += -include $(AUDIO_ROOT)/config/pineappleautoconf.h
  83. endif
  84. ifeq ($(BOARD_PLATFORM), volcano)
  85. include $(AUDIO_ROOT)/config/volcanoauto.conf
  86. INCS += -include $(AUDIO_ROOT)/config/volcanoautoconf.h
  87. endif
  88. ifeq ($(CONFIG_ARCH_PITTI), y)
  89. include $(AUDIO_ROOT)/config/pittiauto.conf
  90. INCS += -include $(AUDIO_ROOT)/config/pittiautoconf.h
  91. endif
  92. ifeq ($(CONFIG_ARCH_LITO), y)
  93. include $(AUDIO_ROOT)/config/litoauto.conf
  94. export
  95. INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
  96. endif
  97. ifeq ($(CONFIG_ARCH_KHAJE), y)
  98. include $(AUDIO_ROOT)/config/bengalauto.conf
  99. export
  100. INCS += -include $(AUDIO_ROOT)/config/bengalautoconf.h
  101. endif
  102. ifeq ($(CONFIG_ARCH_HOLI), y)
  103. include $(AUDIO_ROOT)/config/holiauto.conf
  104. INCS += -include $(AUDIO_ROOT)/config/holiautoconf.h
  105. endif
  106. ifeq ($(CONFIG_ARCH_BLAIR), y)
  107. include $(AUDIO_ROOT)/config/holiauto.conf
  108. INCS += -include $(AUDIO_ROOT)/config/holiautoconf.h
  109. endif
  110. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  111. ifdef CONFIG_SND_SOC_SA8155
  112. include $(AUDIO_ROOT)/config/sa8155auto.conf
  113. export
  114. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  115. else
  116. include $(AUDIO_ROOT)/config/sm8150auto.conf
  117. export
  118. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  119. endif
  120. endif
  121. ifeq ($(CONFIG_ARCH_QCS405), y)
  122. include $(AUDIO_ROOT)/config/qcs405auto.conf
  123. export
  124. INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
  125. endif
  126. ifeq ($(CONFIG_QTI_QUIN_GVM), y)
  127. include $(AUDIO_ROOT)/config/gvmauto.conf
  128. export
  129. INCS += -include $(AUDIO_ROOT)/config/gvmautoconf.h
  130. endif
  131. ifeq ($(CONFIG_ARCH_SDXLEMUR), y)
  132. include $(AUDIO_ROOT)/config/sdxlemurauto.conf
  133. export
  134. INCS += -include $(AUDIO_ROOT)/config/sdxlemurautoconf.h
  135. endif
  136. endif
  137. endif
  138. # As per target team, build is done as follows:
  139. # Defconfig : build with default flags
  140. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  141. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  142. # Perf : Using appropriate msmXXXX-perf_defconfig
  143. #
  144. # Shipment builds (user variants) should not have any debug feature
  145. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  146. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  147. # there is no other way to identify defconfig builds, QTI internal
  148. # representation of perf builds (identified using the string 'perf'),
  149. # is used to identify if the build is a slub or defconfig one. This
  150. # way no critical debug feature will be enabled for perf and shipment
  151. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  152. # config.
  153. ############ UAPI ############
  154. UAPI_DIR := uapi/audio
  155. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  156. ############ COMMON ############
  157. COMMON_DIR := include
  158. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  159. ############ ASoC Drivers ############
  160. MACHINE_OBJS += msm_common.o
  161. # for SM8150 sound card driver
  162. ifdef CONFIG_SND_SOC_SM8150
  163. MACHINE_OBJS += sm8150.o
  164. MACHINE_OBJS += machine_815x_init.o
  165. endif
  166. # for SM6150 sound card driver
  167. ifdef CONFIG_SND_SOC_SM6150
  168. MACHINE_OBJS += sm6150.o
  169. MACHINE_OBJS += machine_615x_init.o
  170. endif
  171. # For sa6155 sound card driver
  172. ifdef CONFIG_SND_SOC_SA6155
  173. MACHINE_OBJS += sa6155.o
  174. endif
  175. # for qcs405 sound card driver
  176. ifdef CONFIG_SND_SOC_QCS405
  177. MACHINE_OBJS += qcs405.o
  178. endif
  179. # for KONA sound card driver
  180. ifdef CONFIG_SND_SOC_KONA
  181. MACHINE_OBJS += kona.o
  182. endif
  183. # for LAHAINA sound card driver
  184. ifdef CONFIG_SND_SOC_LAHAINA
  185. MACHINE_OBJS += lahaina.o
  186. endif
  187. # for WAIPIO sound card driver
  188. ifdef CONFIG_SND_SOC_WAIPIO
  189. MACHINE_OBJS += waipio.o
  190. endif
  191. # for KALAMA sound card driver
  192. ifdef CONFIG_SND_SOC_KALAMA
  193. MACHINE_OBJS += kalama.o
  194. endif
  195. # for PINEAPPLE sound card driver
  196. ifdef CONFIG_SND_SOC_PINEAPPLE
  197. MACHINE_OBJS += pineapple.o
  198. endif
  199. # for PITTI sound card driver
  200. ifdef CONFIG_SND_SOC_PITTI
  201. MACHINE_OBJS += pineapple.o
  202. endif
  203. # for HOLI sound card driver
  204. ifdef CONFIG_SND_SOC_HOLI
  205. MACHINE_OBJS += holi.o
  206. endif
  207. ifdef CONFIG_SND_SOC_LITO
  208. MACHINE_OBJS += kona.o
  209. endif
  210. # for BENGAL sound card driver
  211. ifdef CONFIG_SND_SOC_BENGAL
  212. MACHINE_OBJS += bengal.o
  213. endif
  214. # for sa8155 sound card driver
  215. ifdef CONFIG_SND_SOC_SA8155
  216. MACHINE_OBJS += sa8155.o
  217. endif
  218. # for sa7255 sound card driver
  219. ifdef CONFIG_SND_SOC_SA7255_AUTO_SPF
  220. SPF_MACHINE_OBJS += msm_common.o
  221. SPF_MACHINE_OBJS += auto_spf_dummy.o
  222. endif
  223. ifdef CONFIG_SND_SOC_QDSP6V2
  224. PLATFORM_OBJS += platform_init.o
  225. endif
  226. ifdef CONFIG_SND_SOC_SDX
  227. MACHINE_OBJS += sdx-target.o
  228. endif
  229. ifdef CONFIG_SND_SOC_GVM_AUTO_SPF
  230. SPF_MACHINE_OBJS += gvm_auto_spf_dummy.o
  231. endif
  232. LINUX_INC += -Iinclude/linux
  233. INCS += $(COMMON_INC) \
  234. $(UAPI_INC)
  235. EXTRA_CFLAGS += $(INCS)
  236. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  237. -DANI_LITTLE_BIT_ENDIAN \
  238. -DDOT11F_LITTLE_ENDIAN_HOST \
  239. -DANI_COMPILER_TYPE_GCC \
  240. -DANI_OS_TYPE_ANDROID=6 \
  241. -DPTT_SOCK_SVC_ENABLE \
  242. -Wall\
  243. -Werror\
  244. -D__linux__
  245. KBUILD_CPPFLAGS += $(CDEFINES)
  246. # Currently, for versions of gcc which support it, the kernel Makefile
  247. # is disabling the maybe-uninitialized warning. Re-enable it for the
  248. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  249. # will override the kernel settings.
  250. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  251. EXTRA_CFLAGS += -Wmaybe-uninitialized
  252. endif
  253. #EXTRA_CFLAGS += -Wmissing-prototypes
  254. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  255. EXTRA_CFLAGS += -Wheader-guard
  256. endif
  257. ifeq ($(KERNEL_BUILD), 1)
  258. obj-y += codecs/
  259. endif
  260. # Module information used by KBuild framework
  261. obj-$(CONFIG_SND_SOC_QDSP6V2) += platform_dlkm.o
  262. platform_dlkm-y := $(PLATFORM_OBJS)
  263. obj-$(CONFIG_SND_SOC_SM8150) += machine_dlkm.o
  264. machine_dlkm-y := $(MACHINE_OBJS)
  265. obj-$(CONFIG_SND_SOC_SM6150) += machine_dlkm.o
  266. machine_dlkm-y := $(MACHINE_OBJS)
  267. obj-$(CONFIG_SND_SOC_SA6155) += machine_dlkm.o
  268. machine_dlkm-y := $(MACHINE_OBJS)
  269. obj-$(CONFIG_SND_SOC_QCS405) += machine_dlkm.o
  270. machine_dlkm-y := $(MACHINE_OBJS)
  271. obj-$(CONFIG_SND_SOC_KONA) += machine_dlkm.o
  272. machine_dlkm-y := $(MACHINE_OBJS)
  273. obj-$(CONFIG_SND_SOC_LAHAINA) += machine_dlkm.o
  274. machine_dlkm-y := $(MACHINE_OBJS)
  275. obj-$(CONFIG_SND_SOC_WAIPIO) += machine_dlkm.o
  276. machine_dlkm-y := $(MACHINE_OBJS)
  277. obj-$(CONFIG_SND_SOC_KALAMA) += machine_dlkm.o
  278. machine_dlkm-y := $(MACHINE_OBJS)
  279. obj-$(CONFIG_SND_SOC_PINEAPPLE) += machine_dlkm.o
  280. machine_dlkm-y := $(MACHINE_OBJS)
  281. obj-$(CONFIG_SND_SOC_PITTI) += machine_dlkm.o
  282. machine_dlkm-y := $(MACHINE_OBJS)
  283. obj-$(CONFIG_SND_SOC_HOLI) += machine_dlkm.o
  284. machine_dlkm-y := $(MACHINE_OBJS)
  285. obj-$(CONFIG_SND_SOC_LITO) += machine_dlkm.o
  286. machine_dlkm-y := $(MACHINE_OBJS)
  287. obj-$(CONFIG_SND_SOC_BENGAL) += machine_dlkm.o
  288. machine_dlkm-y := $(MACHINE_OBJS)
  289. obj-$(CONFIG_SND_SOC_SA8155) += machine_dlkm.o
  290. machine_dlkm-y := $(MACHINE_OBJS)
  291. obj-$(CONFIG_SND_SOC_SDX) += machine_dlkm.o
  292. machine_dlkm-y := $(MACHINE_OBJS)
  293. obj-$(CONFIG_SND_SOC_GVM_AUTO_SPF) += spf_machine_dlkm.o
  294. spf_machine_dlkm-y := $(SPF_MACHINE_OBJS)
  295. obj-$(CONFIG_SND_SOC_SA7255_AUTO_SPF) += spf_machine_dlkm.o
  296. spf_machine_dlkm-y := $(SPF_MACHINE_OBJS)
  297. # inject some build related information
  298. DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"