Kbuild 9.1 KB

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