Kbuild 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 ($(KERNEL_BUILD), 0)
  15. ifeq ($(CONFIG_ARCH_SM6150), y)
  16. include $(AUDIO_ROOT)/config/sm6150auto.conf
  17. export
  18. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  19. endif
  20. ifeq ($(CONFIG_ARCH_TRINKET), y)
  21. include $(AUDIO_ROOT)/config/sm6150auto.conf
  22. export
  23. INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
  24. endif
  25. ifeq ($(CONFIG_ARCH_KONA), y)
  26. include $(AUDIO_ROOT)/config/konaauto.conf
  27. INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
  28. endif
  29. ifeq ($(CONFIG_ARCH_LITO), y)
  30. include $(AUDIO_ROOT)/config/litoauto.conf
  31. export
  32. INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
  33. endif
  34. ifeq ($(CONFIG_ARCH_BENGAL), y)
  35. include $(AUDIO_ROOT)/config/bengalauto.conf
  36. export
  37. INCS += -include $(AUDIO_ROOT)/config/bengalautoconf.h
  38. endif
  39. ifeq ($(CONFIG_ARCH_QCS405), y)
  40. include $(AUDIO_ROOT)/config/qcs405auto.conf
  41. export
  42. INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
  43. endif
  44. endif
  45. # As per target team, build is done as follows:
  46. # Defconfig : build with default flags
  47. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  48. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  49. # Perf : Using appropriate msmXXXX-perf_defconfig
  50. #
  51. # Shipment builds (user variants) should not have any debug feature
  52. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  53. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  54. # there is no other way to identify defconfig builds, QTI internal
  55. # representation of perf builds (identified using the string 'perf'),
  56. # is used to identify if the build is a slub or defconfig one. This
  57. # way no critical debug feature will be enabled for perf and shipment
  58. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  59. # config.
  60. ############ UAPI ############
  61. UAPI_DIR := uapi/audio
  62. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  63. ############ COMMON ############
  64. COMMON_DIR := include
  65. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  66. ############ LPASS_CDC ############
  67. # for LPASS_CDC Codec
  68. ifdef CONFIG_SND_SOC_LPASS_CDC
  69. LPASS_CDC_OBJS += lpass-cdc.o
  70. LPASS_CDC_OBJS += lpass-cdc-utils.o
  71. LPASS_CDC_OBJS += lpass-cdc-regmap.o
  72. LPASS_CDC_OBJS += lpass-cdc-tables.o
  73. LPASS_CDC_OBJS += lpass-cdc-clk-rsc.o
  74. endif
  75. ifdef CONFIG_WSA_MACRO
  76. WSA_OBJS += lpass-cdc-wsa-macro.o
  77. endif
  78. ifdef CONFIG_VA_MACRO
  79. VA_OBJS += lpass-cdc-va-macro.o
  80. endif
  81. ifdef CONFIG_TX_MACRO
  82. TX_OBJS += lpass-cdc-tx-macro.o
  83. endif
  84. ifdef CONFIG_RX_MACRO
  85. RX_OBJS += lpass-cdc-rx-macro.o
  86. endif
  87. LINUX_INC += -Iinclude/linux
  88. INCS += $(COMMON_INC) \
  89. $(UAPI_INC)
  90. EXTRA_CFLAGS += $(INCS)
  91. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  92. -DANI_LITTLE_BIT_ENDIAN \
  93. -DDOT11F_LITTLE_ENDIAN_HOST \
  94. -DANI_COMPILER_TYPE_GCC \
  95. -DANI_OS_TYPE_ANDROID=6 \
  96. -DPTT_SOCK_SVC_ENABLE \
  97. -Wall\
  98. -Werror\
  99. -D__linux__
  100. KBUILD_CPPFLAGS += $(CDEFINES)
  101. # Currently, for versions of gcc which support it, the kernel Makefile
  102. # is disabling the maybe-uninitialized warning. Re-enable it for the
  103. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  104. # will override the kernel settings.
  105. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  106. EXTRA_CFLAGS += -Wmaybe-uninitialized
  107. endif
  108. #EXTRA_CFLAGS += -Wmissing-prototypes
  109. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  110. EXTRA_CFLAGS += -Wheader-guard
  111. endif
  112. ifeq ($(KERNEL_BUILD), 0)
  113. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
  114. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
  115. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
  116. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
  117. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
  118. endif
  119. # Module information used by KBuild framework
  120. obj-$(CONFIG_SND_SOC_LPASS_CDC) += lpass_cdc_dlkm.o
  121. lpass_cdc_dlkm-y := $(LPASS_CDC_OBJS)
  122. obj-$(CONFIG_WSA_MACRO) += wsa_macro_dlkm.o
  123. wsa_macro_dlkm-y := $(WSA_OBJS)
  124. obj-$(CONFIG_VA_MACRO) += va_macro_dlkm.o
  125. va_macro_dlkm-y := $(VA_OBJS)
  126. obj-$(CONFIG_TX_MACRO) += tx_macro_dlkm.o
  127. tx_macro_dlkm-y := $(TX_OBJS)
  128. obj-$(CONFIG_RX_MACRO) += rx_macro_dlkm.o
  129. rx_macro_dlkm-y := $(RX_OBJS)
  130. # inject some build related information
  131. DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"