post_rules.mk 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #
  2. # post_rules.mk contains post-processing rules for the Helix keyboard.
  3. #
  4. # Post-processing rules convert keyboard-specific shortcuts (that represent
  5. # combinations of standard options) into QMK standard options.
  6. #
  7. define HELIX_CUSTOMISE_MSG
  8. $(info Helix Spacific Build Options)
  9. $(info - OLED_ENABLE = $(OLED_ENABLE))
  10. $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
  11. $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE))
  12. $(info - LED_ANIMATIONS = $(LED_ANIMATIONS))
  13. $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE))
  14. $(info )
  15. endef
  16. define HELIX_HELP_MSG
  17. $(info Helix keyboard convenient command line option)
  18. $(info - make HELIX=<options> helix/pico:<keymap>)
  19. $(info - option= oled | back | under | na | no-ani)
  20. $(info - ios | sc | split-common | scan | verbose)
  21. $(info - ex.)
  22. $(info - make HELIX=oled helix/pico:<keymap>)
  23. $(info - make HELIX=back helix/pico:<keymap>)
  24. $(info - make HELIX=under helix/pico:<keymap>)
  25. $(info - make HELIX=back,na helix/pico:<keymap>)
  26. $(info - make HELIX=back,ios helix/pico:<keymap>)
  27. $(info )
  28. endef
  29. ifneq ($(strip $(HELIX)),)
  30. COMMA=,
  31. helix_option := $(subst $(COMMA), , $(HELIX))
  32. ifneq ($(filter help,$(helix_option)),)
  33. $(eval $(call HELIX_HELP_MSG))
  34. $(error )
  35. endif
  36. ifneq ($(filter oled,$(helix_option)),)
  37. OLED_ENABLE = yes
  38. endif
  39. ifneq ($(filter back,$(helix_option)),)
  40. LED_BACK_ENABLE = yes
  41. else ifneq ($(filter under,$(helix_option)),)
  42. LED_UNDERGLOW_ENABLE = yes
  43. endif
  44. ifneq ($(filter na,$(helix_option)),)
  45. LED_ANIMATIONS = no
  46. endif
  47. ifneq ($(filter no_ani,$(helix_option)),)
  48. LED_ANIMATIONS = no
  49. endif
  50. ifneq ($(filter no-ani,$(helix_option)),)
  51. LED_ANIMATIONS = no
  52. endif
  53. ifneq ($(filter ios,$(helix_option)),)
  54. IOS_DEVICE_ENABLE = yes
  55. endif
  56. ifneq ($(filter sc,$(helix_option)),)
  57. SPLIT_KEYBOARD = yes
  58. endif
  59. ifneq ($(filter split-common,$(helix_option)),)
  60. SPLIT_KEYBOARD = yes
  61. endif
  62. ifneq ($(filter scan,$(helix_option)),)
  63. # use DEBUG_MATRIX_SCAN_RATE
  64. # see docs/newbs_testing_debugging.md
  65. OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
  66. CONSOLE_ENABLE = yes
  67. SHOW_VERBOSE_INFO = yes
  68. endif
  69. ifneq ($(filter verbose,$(helix_option)),)
  70. SHOW_VERBOSE_INFO = yes
  71. endif
  72. SHOW_HELIX_OPTIONS = yes
  73. endif
  74. ifneq ($(strip $(SPLIT_KEYBOARD)), yes)
  75. SRC += local_drivers/serial.c
  76. KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
  77. # A workaround until #7089 is merged.
  78. # serial.c must not be compiled with the -lto option.
  79. # The current LIB_SRC has a side effect with the -fno-lto option, so use it.
  80. LIB_SRC += local_drivers/serial.c
  81. CUSTOM_MATRIX = yes
  82. SRC += pico/matrix.c
  83. SRC += pico/split_util.c
  84. endif
  85. ########
  86. # convert Helix-specific options (that represent combinations of standard options)
  87. # into QMK standard options.
  88. ifeq ($(strip $(LED_BACK_ENABLE)), yes)
  89. RGBLIGHT_ENABLE = yes
  90. OPT_DEFS += -DRGBLED_BACK
  91. ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
  92. $(eval $(call HELIX_CUSTOMISE_MSG))
  93. $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes')
  94. endif
  95. else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
  96. RGBLIGHT_ENABLE = yes
  97. endif
  98. ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
  99. OPT_DEFS += -DIOS_DEVICE_ENABLE
  100. endif
  101. ifeq ($(strip $(LED_ANIMATIONS)), yes)
  102. OPT_DEFS += -DLED_ANIMATIONS
  103. endif
  104. ifeq ($(strip $(OLED_ENABLE)), yes)
  105. SRC += local_drivers/i2c.c
  106. SRC += local_drivers/ssd1306.c
  107. KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
  108. OPT_DEFS += -DOLED_ENABLE
  109. ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
  110. OPT_DEFS += -DLOCAL_GLCDFONT
  111. endif
  112. endif
  113. ifeq ($(strip $(AUDIO_ENABLE)),yes)
  114. ifeq ($(strip $(RGBLIGHT_ENABLE)),yes)
  115. LTO_ENABLE = yes
  116. endif
  117. ifeq ($(strip $(OLED_ENABLE)),yes)
  118. LTO_ENABLE = yes
  119. endif
  120. endif
  121. ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
  122. $(eval $(call HELIX_CUSTOMISE_MSG))
  123. ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
  124. $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
  125. $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE))
  126. $(info -- OPT_DEFS = $(OPT_DEFS))
  127. $(info -- SPLIT_KEYBOARD = $(SPLIT_KEYBOARD))
  128. $(info -- LTO_ENABLE = $(LTO_ENABLE))
  129. $(info )
  130. endif
  131. endif
  132. OLED_ENABLE = no # disable OLED in TOP/common_features.mk