Kbuild 7.2 KB

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