Kbuild 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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_KONA), y)
  43. include $(AUDIO_ROOT)/config/konaauto.conf
  44. INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
  45. endif
  46. ifeq ($(CONFIG_ARCH_WAIPIO), y)
  47. include $(AUDIO_ROOT)/config/waipioauto.conf
  48. INCS += -include $(AUDIO_ROOT)/config/waipioautoconf.h
  49. endif
  50. ifeq ($(CONFIG_ARCH_KALAMA), y)
  51. include $(AUDIO_ROOT)/config/kalamaauto.conf
  52. INCS += -include $(AUDIO_ROOT)/config/kalamaautoconf.h
  53. endif
  54. ifeq ($(BOARD_PLATFORM), pineapple)
  55. include $(AUDIO_ROOT)/config/pineappleauto.conf
  56. INCS += -include $(AUDIO_ROOT)/config/pineappleautoconf.h
  57. endif
  58. ifeq ($(BOARD_PLATFORM), cliffs)
  59. include $(AUDIO_ROOT)/config/pineappleauto.conf
  60. INCS += -include $(AUDIO_ROOT)/config/pineappleautoconf.h
  61. endif
  62. ifeq ($(BOARD_PLATFORM), volcano)
  63. include $(AUDIO_ROOT)/config/volcanoauto.conf
  64. INCS += -include $(AUDIO_ROOT)/config/volcanoautoconf.h
  65. endif
  66. ifeq ($(CONFIG_ARCH_PITTI), y)
  67. include $(AUDIO_ROOT)/config/pittiauto.conf
  68. INCS += -include $(AUDIO_ROOT)/config/pittiautoconf.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_SM6150), y)
  89. ifdef CONFIG_SND_SOC_SA6155
  90. include $(AUDIO_ROOT)/config/sa6155auto.conf
  91. INCS += -include $(AUDIO_ROOT)/config/sa6155autoconf.h
  92. else
  93. include $(AUDIO_ROOT)/config/sm6150auto.conf
  94. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  95. endif
  96. endif
  97. ifeq ($(CONFIG_ARCH_TRINKET), y)
  98. include $(AUDIO_ROOT)/config/sm6150auto.conf
  99. export
  100. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  101. endif
  102. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  103. ifdef CONFIG_SND_SOC_SA8155
  104. include $(AUDIO_ROOT)/config/sa8155auto.conf
  105. INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
  106. else
  107. include $(AUDIO_ROOT)/config/sm8150auto.conf
  108. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  109. endif
  110. endif
  111. ifeq ($(CONFIG_ARCH_QCS405), y)
  112. include $(AUDIO_ROOT)/config/qcs405auto.conf
  113. export
  114. INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
  115. endif
  116. ifeq ($(CONFIG_QTI_QUIN_GVM), y)
  117. include $(AUDIO_ROOT)/config/gvmauto.conf
  118. INCS += -include $(AUDIO_ROOT)/config/gvmautoconf.h
  119. endif
  120. ifeq ($(CONFIG_ARCH_SDXLEMUR), y)
  121. include $(AUDIO_ROOT)/config/sdxlemurauto.conf
  122. export
  123. INCS += -include $(AUDIO_ROOT)/config/sdxlemurautoconf.h
  124. endif
  125. endif
  126. endif
  127. # As per target team, build is done as follows:
  128. # Defconfig : build with default flags
  129. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  130. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  131. # Perf : Using appropriate msmXXXX-perf_defconfig
  132. #
  133. # Shipment builds (user variants) should not have any debug feature
  134. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  135. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  136. # there is no other way to identify defconfig builds, QTI internal
  137. # representation of perf builds (identified using the string 'perf'),
  138. # is used to identify if the build is a slub or defconfig one. This
  139. # way no critical debug feature will be enabled for perf and shipment
  140. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  141. # config.
  142. ############ UAPI ############
  143. UAPI_DIR := uapi/audio
  144. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  145. ############ COMMON ############
  146. COMMON_DIR := include
  147. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  148. ############ SoC Modules ############
  149. # for pinctrl WCD driver
  150. ifdef CONFIG_PINCTRL_WCD
  151. PINCTRL_WCD_OBJS += pinctrl-wcd.o
  152. endif
  153. # for pinctrl LPI driver
  154. ifdef CONFIG_PINCTRL_LPI
  155. PINCTRL_LPI_OBJS += pinctrl-lpi.o
  156. endif
  157. # for soundwire driver
  158. ifdef CONFIG_SOUNDWIRE_WCD_CTRL
  159. SWR_CTRL_OBJS += swr-wcd-ctrl.o
  160. endif
  161. # for new soundwire driver
  162. ifdef CONFIG_SOUNDWIRE_MSTR_CTRL
  163. SWR_CTRL_OBJS += swr-mstr-ctrl.o
  164. endif
  165. ifdef CONFIG_SOUNDWIRE
  166. INCS += -include $(KERNEL_SRC)/drivers/base/regmap/internal.h
  167. SWR_OBJS += regmap-swr.o
  168. SWR_OBJS += soundwire.o
  169. endif
  170. ifdef CONFIG_SND_EVENT
  171. SND_EVENT_OBJS += snd_event.o
  172. endif
  173. ifdef CONFIG_WCD_SPI_AC
  174. WCD_SPI_ACC_CTL_OBJS += wcd-spi-ac.o
  175. WCD_SPI_ACC_CTL_OBJS += wcd_spi_ctl_v01.o
  176. endif
  177. LINUX_INC += -Iinclude/linux
  178. INCS += $(COMMON_INC) \
  179. $(UAPI_INC)
  180. EXTRA_CFLAGS += $(INCS)
  181. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  182. -DANI_LITTLE_BIT_ENDIAN \
  183. -DDOT11F_LITTLE_ENDIAN_HOST \
  184. -DANI_COMPILER_TYPE_GCC \
  185. -DANI_OS_TYPE_ANDROID=6 \
  186. -DPTT_SOCK_SVC_ENABLE \
  187. -Wall\
  188. -Werror\
  189. -D__linux__
  190. KBUILD_CPPFLAGS += $(CDEFINES)
  191. # Currently, for versions of gcc which support it, the kernel Makefile
  192. # is disabling the maybe-uninitialized warning. Re-enable it for the
  193. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  194. # will override the kernel settings.
  195. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  196. EXTRA_CFLAGS += -Wmaybe-uninitialized
  197. endif
  198. #EXTRA_CFLAGS += -Wmissing-prototypes
  199. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  200. EXTRA_CFLAGS += -Wheader-guard
  201. endif
  202. ifeq ($(CONFIG_SND_SOC_GCOV), y)
  203. GCOV_PROFILE := y
  204. endif
  205. # Module information used by KBuild framework
  206. obj-$(CONFIG_PINCTRL_WCD) += pinctrl_wcd_dlkm.o
  207. pinctrl_wcd_dlkm-y := $(PINCTRL_WCD_OBJS)
  208. obj-$(CONFIG_PINCTRL_LPI) += pinctrl_lpi_dlkm.o
  209. pinctrl_lpi_dlkm-y := $(PINCTRL_LPI_OBJS)
  210. obj-$(CONFIG_SOUNDWIRE) += swr_dlkm.o
  211. swr_dlkm-y := $(SWR_OBJS)
  212. obj-$(CONFIG_SND_EVENT) += snd_event_dlkm.o
  213. snd_event_dlkm-y := $(SND_EVENT_OBJS)
  214. obj-$(CONFIG_SOUNDWIRE_WCD_CTRL) += swr_ctrl_dlkm.o
  215. obj-$(CONFIG_SOUNDWIRE_MSTR_CTRL) += swr_ctrl_dlkm.o
  216. swr_ctrl_dlkm-y := $(SWR_CTRL_OBJS)
  217. obj-$(CONFIG_WCD_SPI_AC) += wcd_spi_acc_ctl_dlkm.o
  218. wcd_spi_acc_ctl_dlkm-y := $(WCD_SPI_ACC_CTL_OBJS)
  219. # inject some build related information
  220. DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"