Kbuild 8.1 KB

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