parse_make_settings.mk 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. include $(SCRIPT_DIR)/internal_make_funcs.mk
  2. FEATURE_DATA_TEMPLATE_ENABLED = y
  3. FEATURE_OTA_SIGNAL_CHANNEL = MQTT
  4. SETTING_VARS := \
  5. BUILD_TYPE \
  6. PLATFORM_CC \
  7. PLATFORM_AR \
  8. PLATFORM_OS \
  9. SWITCH_VARS := \
  10. FEATURE_MQTT_COMM_ENABLED \
  11. FEATURE_OTA_COMM_ENABLED \
  12. FEATURE_AUTH_WITH_NOTLS \
  13. FEATURE_GATEWAY_ENABLED \
  14. FEATURE_GATEWAY_DYN_BIND_SUBDEV_ENABLED \
  15. FEATURE_LOG_UPLOAD_ENABLED \
  16. FEATURE_DEV_DYN_REG_ENABLED \
  17. FEATURE_AT_TCP_ENABLED \
  18. FEATURE_AT_UART_RECV_IRQ \
  19. FEATURE_AT_OS_USED \
  20. FEATURE_AT_DEBUG \
  21. FEATURE_DATA_TEMPLATE_ENABLED \
  22. FEATURE_EVENT_POST_ENABLED \
  23. FEATURE_ACTION_ENABLED \
  24. FEATURE_DEBUG_DEV_INFO_USED \
  25. FEATURE_SYSTEM_COMM_ENABLED \
  26. FEATURE_OTA_USE_HTTPS \
  27. FEATURE_MULTITHREAD_ENABLED \
  28. $(foreach v, \
  29. $(SETTING_VARS) $(SWITCH_VARS), \
  30. $(eval export $(v)=$($(v))) \
  31. )
  32. $(foreach v, \
  33. $(SWITCH_VARS), \
  34. $(if $(filter y,$($(v))), \
  35. $(eval CFLAGS += -D$(subst FEATURE_,,$(v)))) \
  36. )
  37. ifeq (debug,$(strip $(BUILD_TYPE)))
  38. CFLAGS += -DIOT_DEBUG -g -O2
  39. endif
  40. ifneq (linux,$(strip $(PLATFORM_OS)))
  41. ifeq (y,$(strip $(FEATURE_SDKTESTS_ENABLED)))
  42. $(error FEATURE_SDKTESTS_ENABLED with gtest framework just supports to be enabled on PLATFORM_OS = linux!)
  43. endif
  44. else
  45. ifeq (y,$(strip $(FEATURE_SDKTESTS_ENABLED)))
  46. CFLAGS += -DSDKTESTS_ENABLED
  47. endif
  48. endif
  49. ifeq (y,$(strip $(FEATURE_OTA_COMM_ENABLED)))
  50. ifeq (MQTT,$(strip $(FEATURE_OTA_SIGNAL_CHANNEL)))
  51. ifneq (y,$(strip $(FEATURE_MQTT_COMM_ENABLED)))
  52. $(error FEATURE_OTA_SIGNAL_CHANNEL = MQTT requires FEATURE_MQTT_COMM_ENABLED = y!)
  53. endif
  54. CFLAGS += -DOTA_MQTT_CHANNEL
  55. else
  56. ifeq (COAP,$(strip $(FEATURE_OTA_SIGNAL_CHANNEL)))
  57. ifneq (y,$(strip $(FEATURE_COAP_COMM_ENABLED)))
  58. $(error FEATURE_OTA_SIGNAL_CHANNEL = COAP requires FEATURE_COAP_COMM_ENABLED = y!)
  59. endif
  60. CFLAGS += -DOTA_COAP_CHANNEL
  61. else
  62. $(error FEATURE_OTA_SIGNAL_CHANNEL must be MQTT or COAP!)
  63. endif # COAP
  64. endif # MQTT
  65. endif # OTA Enabled
  66. ifeq (CERT,$(strip $(FEATURE_AUTH_MODE)))
  67. ifeq (y,$(strip $(FEATURE_AUTH_WITH_NOTLS)))
  68. $(error FEATURE_AUTH_MODE = CERT requires FEATURE_AUTH_WITH_NOTLS = n!)
  69. endif
  70. CFLAGS += -DAUTH_MODE_CERT
  71. else
  72. ifeq (KEY,$(strip $(FEATURE_AUTH_MODE)))
  73. CFLAGS += -DAUTH_MODE_KEY
  74. else
  75. $(error FEATURE_AUTH_MODE must be CERT or KEY!)
  76. endif
  77. endif # Auth mode
  78. ifeq (y,$(strip $(FEATURE_OTA_USE_HTTPS)))
  79. ifeq (y,$(strip $(FEATURE_AUTH_WITH_NOTLS)))
  80. $(error FEATURE_OTA_USE_HTTPS = y requires FEATURE_AUTH_WITH_NOTLS = n!)
  81. endif
  82. endif
  83. ifeq (y, $(strip $(FEATURE_SYSTEM_COMM_ENABLED)))
  84. CFLAGS += -DSYSTEM_COMM
  85. endif
  86. ifeq (y, $(strip $(FEATURE_LOG_UPLOAD_ENABLED)))
  87. CFLAGS += -DLOG_UPLOAD
  88. endif
  89. ifeq (y, $(strip $(FEATURE_GATEWAY_ENABLED)))
  90. CFLAGS += -DMULTITHREAD_ENABLED
  91. endif
  92. ifeq (y, $(strip $(FEATURE_AT_OS_USED)))
  93. CFLAGS += -DAT_OS_USED
  94. endif
  95. ifeq (y, $(strip $(FEATURE_AT_DEBUG)))
  96. CFLAGS += -DFEATURE_AT_DEBUG
  97. endif