Kbuild 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. # These are configurable via Kconfig for kernel-based builds
  9. # Need to explicitly configure for Android-based builds
  10. KDIR := $(TOP)/kernel/msm-4.19
  11. ifeq ($(KERNEL_BUILD), 1)
  12. AUDIO_ROOT := $(KDIR)/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_SM8150), y)
  35. include $(AUDIO_ROOT)/config/sm8150auto.conf
  36. export
  37. INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.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. 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. endif
  50. # As per target team, build is done as follows:
  51. # Defconfig : build with default flags
  52. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  53. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  54. # Perf : Using appropriate msmXXXX-perf_defconfig
  55. #
  56. # Shipment builds (user variants) should not have any debug feature
  57. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  58. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  59. # there is no other way to identify defconfig builds, QTI internal
  60. # representation of perf builds (identified using the string 'perf'),
  61. # is used to identify if the build is a slub or defconfig one. This
  62. # way no critical debug feature will be enabled for perf and shipment
  63. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  64. # config.
  65. ############ UAPI ############
  66. UAPI_DIR := uapi
  67. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  68. ############ COMMON ############
  69. COMMON_DIR := include
  70. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  71. ############ IPC ############
  72. ifdef CONFIG_MSM_QDSP6_APRV2_RPMSG
  73. APRV_GLINK += apr.o
  74. APRV_GLINK += apr_v2.o
  75. APRV_GLINK += apr_tal_rpmsg.o
  76. endif
  77. ifdef CONFIG_MSM_QDSP6_APRV3_RPMSG
  78. APRV_GLINK += apr.o
  79. APRV_GLINK += apr_v3.o
  80. APRV_GLINK += apr_tal_rpmsg.o
  81. endif
  82. ifdef CONFIG_MSM_QDSP6_APRV2_VM
  83. APRV_GLINK += apr_vm.o
  84. APRV_GLINK += apr_v2.o
  85. endif
  86. ifdef CONFIG_WCD_DSP_GLINK
  87. WDSP_GLINK += wcd-dsp-glink.o
  88. endif
  89. LINUX_INC += -Iinclude/linux
  90. INCS += $(COMMON_INC) \
  91. $(UAPI_INC)
  92. EXTRA_CFLAGS += $(INCS)
  93. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  94. -DANI_LITTLE_BIT_ENDIAN \
  95. -DDOT11F_LITTLE_ENDIAN_HOST \
  96. -DANI_COMPILER_TYPE_GCC \
  97. -DANI_OS_TYPE_ANDROID=6 \
  98. -DPTT_SOCK_SVC_ENABLE \
  99. -Wall\
  100. -Werror\
  101. -D__linux__
  102. KBUILD_CPPFLAGS += $(CDEFINES)
  103. ifeq ($(KERNEL_BUILD), 0)
  104. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
  105. endif
  106. # Currently, for versions of gcc which support it, the kernel Makefile
  107. # is disabling the maybe-uninitialized warning. Re-enable it for the
  108. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  109. # will override the kernel settings.
  110. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  111. EXTRA_CFLAGS += -Wmaybe-uninitialized
  112. endif
  113. #EXTRA_CFLAGS += -Wmissing-prototypes
  114. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  115. EXTRA_CFLAGS += -Wheader-guard
  116. endif
  117. # If the module name is not "wlan", then the define MULTI_IF_NAME to be the
  118. # same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
  119. # any string that must be unique for all instances of the driver on the system.
  120. # This allows multiple instances of the driver with different module names.
  121. # If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
  122. # treat the driver as the primary driver.
  123. ifneq ($(MODNAME), qdsp6v2)
  124. CHIP_NAME ?= $(MODNAME)
  125. CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
  126. endif
  127. ifeq ($(CONFIG_SND_SOC_GCOV), y)
  128. GCOV_PROFILE := y
  129. endif
  130. # Module information used by KBuild framework
  131. obj-$(CONFIG_MSM_QDSP6_APRV2_RPMSG) += apr_dlkm.o
  132. obj-$(CONFIG_MSM_QDSP6_APRV3_RPMSG) += apr_dlkm.o
  133. obj-$(CONFIG_MSM_QDSP6_APRV2_VM) += apr_dlkm.o
  134. apr_dlkm-y := $(APRV_GLINK)
  135. obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
  136. wglink_dlkm-y := $(WDSP_GLINK)
  137. # inject some build related information
  138. CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"