Kbuild 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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-4.19
  12. AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
  13. endif
  14. ifeq ($(KERNEL_BUILD), 0)
  15. ifeq ($(CONFIG_ARCH_SM8150), y)
  16. include $(AUDIO_ROOT)/config/sm8150auto.conf
  17. export
  18. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  19. endif
  20. ifeq ($(CONFIG_ARCH_KONA), y)
  21. include $(AUDIO_ROOT)/config/konaauto.conf
  22. INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
  23. endif
  24. ifeq ($(CONFIG_ARCH_LITO), y)
  25. include $(AUDIO_ROOT)/config/litoauto.conf
  26. export
  27. INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
  28. endif
  29. ifeq ($(CONFIG_ARCH_BENGAL), y)
  30. include $(AUDIO_ROOT)/config/litoauto.conf
  31. export
  32. INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
  33. endif
  34. ifeq ($(CONFIG_ARCH_SM6150), y)
  35. include $(AUDIO_ROOT)/config/sm6150auto.conf
  36. export
  37. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  38. endif
  39. ifeq ($(CONFIG_ARCH_TRINKET), y)
  40. include $(AUDIO_ROOT)/config/sm6150auto.conf
  41. export
  42. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  43. endif
  44. ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
  45. include $(AUDIO_ROOT)/config/sm8150auto.conf
  46. export
  47. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
  48. endif
  49. ifeq ($(CONFIG_ARCH_QCS405), y)
  50. include $(AUDIO_ROOT)/config/qcs405auto.conf
  51. export
  52. INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
  53. endif
  54. endif
  55. # As per target team, build is done as follows:
  56. # Defconfig : build with default flags
  57. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  58. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  59. # Perf : Using appropriate msmXXXX-perf_defconfig
  60. #
  61. # Shipment builds (user variants) should not have any debug feature
  62. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  63. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  64. # there is no other way to identify defconfig builds, QTI internal
  65. # representation of perf builds (identified using the string 'perf'),
  66. # is used to identify if the build is a slub or defconfig one. This
  67. # way no critical debug feature will be enabled for perf and shipment
  68. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  69. # config.
  70. ############ UAPI ############
  71. UAPI_DIR := uapi
  72. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  73. ############ COMMON ############
  74. COMMON_DIR := include
  75. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  76. ############ SoC Modules ############
  77. # for pinctrl WCD driver
  78. ifdef CONFIG_PINCTRL_WCD
  79. PINCTRL_WCD_OBJS += pinctrl-wcd.o
  80. endif
  81. # for pinctrl LPI driver
  82. ifdef CONFIG_PINCTRL_LPI
  83. PINCTRL_LPI_OBJS += pinctrl-lpi.o
  84. endif
  85. # for soundwire driver
  86. ifdef CONFIG_SOUNDWIRE_WCD_CTRL
  87. SWR_CTRL_OBJS += swr-wcd-ctrl.o
  88. endif
  89. # for new soundwire driver
  90. ifdef CONFIG_SOUNDWIRE_MSTR_CTRL
  91. SWR_CTRL_OBJS += swr-mstr-ctrl.o
  92. endif
  93. ifdef CONFIG_SOUNDWIRE
  94. SWR_OBJS += regmap-swr.o
  95. SWR_OBJS += soundwire.o
  96. endif
  97. ifdef CONFIG_SND_EVENT
  98. SND_EVENT_OBJS += snd_event.o
  99. endif
  100. ifdef CONFIG_WCD_SPI_AC
  101. WCD_SPI_ACC_CTL_OBJS += wcd-spi-ac.o
  102. WCD_SPI_ACC_CTL_OBJS += wcd_spi_ctl_v01.o
  103. endif
  104. LINUX_INC += -Iinclude/linux
  105. INCS += $(COMMON_INC) \
  106. $(UAPI_INC)
  107. EXTRA_CFLAGS += $(INCS)
  108. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  109. -DANI_LITTLE_BIT_ENDIAN \
  110. -DDOT11F_LITTLE_ENDIAN_HOST \
  111. -DANI_COMPILER_TYPE_GCC \
  112. -DANI_OS_TYPE_ANDROID=6 \
  113. -DPTT_SOCK_SVC_ENABLE \
  114. -Wall\
  115. -Werror\
  116. -D__linux__
  117. KBUILD_CPPFLAGS += $(CDEFINES)
  118. ifeq ($(KERNEL_BUILD), 0)
  119. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
  120. endif
  121. # Currently, for versions of gcc which support it, the kernel Makefile
  122. # is disabling the maybe-uninitialized warning. Re-enable it for the
  123. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  124. # will override the kernel settings.
  125. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  126. EXTRA_CFLAGS += -Wmaybe-uninitialized
  127. endif
  128. #EXTRA_CFLAGS += -Wmissing-prototypes
  129. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  130. EXTRA_CFLAGS += -Wheader-guard
  131. endif
  132. ifeq ($(CONFIG_SND_SOC_GCOV), y)
  133. GCOV_PROFILE := y
  134. endif
  135. # Module information used by KBuild framework
  136. obj-$(CONFIG_PINCTRL_WCD) += pinctrl_wcd_dlkm.o
  137. pinctrl_wcd_dlkm-y := $(PINCTRL_WCD_OBJS)
  138. obj-$(CONFIG_PINCTRL_LPI) += pinctrl_lpi_dlkm.o
  139. pinctrl_lpi_dlkm-y := $(PINCTRL_LPI_OBJS)
  140. obj-$(CONFIG_SOUNDWIRE) += swr_dlkm.o
  141. swr_dlkm-y := $(SWR_OBJS)
  142. obj-$(CONFIG_SND_EVENT) += snd_event_dlkm.o
  143. snd_event_dlkm-y := $(SND_EVENT_OBJS)
  144. obj-$(CONFIG_SOUNDWIRE_WCD_CTRL) += swr_ctrl_dlkm.o
  145. obj-$(CONFIG_SOUNDWIRE_MSTR_CTRL) += swr_ctrl_dlkm.o
  146. swr_ctrl_dlkm-y := $(SWR_CTRL_OBJS)
  147. obj-$(CONFIG_WCD_SPI_AC) += wcd_spi_acc_ctl_dlkm.o
  148. wcd_spi_acc_ctl_dlkm-y := $(WCD_SPI_ACC_CTL_OBJS)
  149. # inject some build related information
  150. DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"