Kbuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 := $(ANDROID_BUILD_TOP)/kernel/msm-4.14
  12. AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
  13. endif
  14. ifeq ($(KERNEL_BUILD), 0)
  15. # These are configurable via Kconfig for kernel-based builds
  16. # Need to explicitly configure for Android-based builds
  17. ifeq ($(CONFIG_ARCH_SDM670), y)
  18. include $(AUDIO_ROOT)/config/sdm670auto.conf
  19. export
  20. INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
  21. endif
  22. ifeq ($(CONFIG_ARCH_SDM855), y)
  23. include $(AUDIO_ROOT)/config/sdm855auto.conf
  24. export
  25. INCS += -include $(AUDIO_ROOT)/config/sdm855autoconf.h
  26. endif
  27. endif
  28. # As per target team, build is done as follows:
  29. # Defconfig : build with default flags
  30. # Slub : defconfig + CONFIG_SLUB_DEBUG := y +
  31. # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
  32. # Perf : Using appropriate msmXXXX-perf_defconfig
  33. #
  34. # Shipment builds (user variants) should not have any debug feature
  35. # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
  36. # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
  37. # there is no other way to identify defconfig builds, QTI internal
  38. # representation of perf builds (identified using the string 'perf'),
  39. # is used to identify if the build is a slub or defconfig one. This
  40. # way no critical debug feature will be enabled for perf and shipment
  41. # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
  42. # config.
  43. ############ UAPI ############
  44. UAPI_DIR := uapi
  45. UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
  46. ############ COMMON ############
  47. COMMON_DIR := include
  48. COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
  49. # for AQT1000 Codec
  50. ifeq ($(CONFIG_SND_SOC_AQT1000), m)
  51. AQT1000_CDC_OBJS += aqt1000-regmap.o
  52. AQT1000_CDC_OBJS += aqt1000-utils.o
  53. AQT1000_CDC_OBJS += aqt1000-core.o
  54. AQT1000_CDC_OBJS += aqt1000-irq.o
  55. AQT1000_CDC_OBJS += aqt1000-clsh.o
  56. AQT1000_CDC_OBJS += aqt1000.o
  57. AQT1000_CDC_OBJS += aqt1000-mbhc.o
  58. endif
  59. LINUX_INC += -Iinclude/linux
  60. INCS += $(COMMON_INC) \
  61. $(UAPI_INC)
  62. EXTRA_CFLAGS += $(INCS)
  63. CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
  64. -DANI_LITTLE_BIT_ENDIAN \
  65. -DDOT11F_LITTLE_ENDIAN_HOST \
  66. -DANI_COMPILER_TYPE_GCC \
  67. -DANI_OS_TYPE_ANDROID=6 \
  68. -DPTT_SOCK_SVC_ENABLE \
  69. -Wall\
  70. -Werror\
  71. -D__linux__
  72. KBUILD_CPPFLAGS += $(CDEFINES)
  73. # Currently, for versions of gcc which support it, the kernel Makefile
  74. # is disabling the maybe-uninitialized warning. Re-enable it for the
  75. # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
  76. # will override the kernel settings.
  77. ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
  78. EXTRA_CFLAGS += -Wmaybe-uninitialized
  79. endif
  80. #EXTRA_CFLAGS += -Wmissing-prototypes
  81. ifeq ($(call cc-option-yn, -Wheader-guard),y)
  82. EXTRA_CFLAGS += -Wheader-guard
  83. endif
  84. ifeq ($(KERNEL_BUILD), 0)
  85. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
  86. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
  87. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
  88. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
  89. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
  90. KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/aqt1000/Module.symvers
  91. endif
  92. # Module information used by KBuild framework
  93. obj-$(CONFIG_SND_SOC_AQT1000) += aqt1000_cdc_dlkm.o
  94. aqt1000_cdc_dlkm-y := $(AQT1000_CDC_OBJS)
  95. # inject some build related information
  96. DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"