Kbuild 4.3 KB

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