user_options.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # Copyright (c) 2022 Takeshi Ishii (mtei@github)
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. #
  4. # make USROPT=<option>,<option>,... <KEYBOARD>:<KEYMAP>
  5. # options:
  6. # dispoff: OLED, RGBLIGHT disable
  7. # oled: OLED enable
  8. # no-oled: OLED disable
  9. # rgblight: RGBLIGHT enable
  10. # no-rgblight: RGBLIGHT disable
  11. # no_ani: RGBLIGHT ANIMATIONS disable
  12. # mini-ani: RGBLIGHT ANIMATIONS mini set
  13. # ani: RGBLIGHT ANIMATIONS enable
  14. # scan: DEBUG_MATRIX_SCAN_RATE enable
  15. # scan-api: DEBUG_MATRIX_SCAN_RATE api enable
  16. # mdelay=<num> MATRIX_IO_DELAY set <num>
  17. # mdelay_type=<type> use custom matrix_output_unselect_delay()
  18. # type=no,ondemand
  19. # enc: ENCODER enable
  20. # no-enc: ENCODER disable
  21. #
  22. ifneq ($(strip $(USROPT)),)
  23. define USER_OPTION_PARSE
  24. # parse 'debug', 'no-debug', 'dispoff', 'consle', 'scan', 'no-scan', 'scan-api',
  25. # 'mdelay=?', 'mdelay0', 'colemak', 'dvorak', 'eucalyn', 'lto', 'no-lto'
  26. $(if $(SHOW_PARSE),$(info parse .$1.)) #for debug 'make SHOW_PARSE=y ...'
  27. ifeq ($(strip $1),debug)
  28. DEBUG_CONFIG = yes
  29. endif
  30. ifneq ($(filter nodebug no-debug no_debug,$(strip $1)),)
  31. DEBUG_CONFIG = no
  32. endif
  33. ifeq ($(strip $1),dispoff)
  34. OLED_ENABLE = no
  35. RGBLIGHT_ENABLE = no
  36. LED_BACK_ENABLE = no
  37. LED_UNDERGLOW_ENABLE = no
  38. endif
  39. ifneq ($(filter rgblight,$(strip $1)),)
  40. RGBLIGHT_ENABLE = yes
  41. LED_BACK_ENABLE = yes
  42. endif
  43. ifneq ($(filter norgblight no-rgblight,$(strip $1)),)
  44. RGBLIGHT_ENABLE = no
  45. LED_BACK_ENABLE = no
  46. LED_UNDERGLOW_ENABLE = no
  47. endif
  48. ifneq ($(filter na no_ani no-ani,$(strip $1)),)
  49. LED_ANIMATIONS = no
  50. endif
  51. ifneq ($(filter mini-ani mini_ani,$(strip $1)),)
  52. LED_ANIMATIONS = mini
  53. endif
  54. ifneq ($(filter ani animation,$(strip $1)),)
  55. LED_ANIMATIONS = yes
  56. endif
  57. ifneq ($(filter nooled no-oled,$(strip $1)),)
  58. OLED_ENABLE = no
  59. endif
  60. ifeq ($(strip $1),oled)
  61. OLED_ENABLE = yes
  62. endif
  63. ifeq ($(strip $1),console)
  64. CONSOLE_ENABLE = yes
  65. endif
  66. ifeq ($(strip $1),scan)
  67. # use DEBUG_MATRIX_SCAN_RATE
  68. # see docs/newbs_testing_debugging.md
  69. DEBUG_MATRIX_SCAN_RATE_ENABLE = yes
  70. endif
  71. ifeq ($(strip $1),no-scan)
  72. DEBUG_MATRIX_SCAN_RATE_ENABLE = no
  73. endif
  74. ifeq ($(strip $1),scan-api)
  75. # use DEBUG_MATRIX_SCAN_RATE
  76. # see docs/newbs_testing_debugging.md
  77. DEBUG_MATRIX_SCAN_RATE_ENABLE = api
  78. endif
  79. ifneq ($(filter stimer sync-timer,$(strip $1)),)
  80. SYNC_TIMER_ENABLE = yes
  81. endif
  82. ifneq ($(filter nostimer no-sync-timer,$(strip $1)),)
  83. SYNC_TIMER_ENABLE = no
  84. endif
  85. ifeq ($(filter mdelay_type=%,$1),mdelay_type=no)
  86. CUSTOM_MATRIX_DELAY = no
  87. endif
  88. ifeq ($(filter mdelay_type=%,$1),mdelay_type=demand)
  89. CUSTOM_MATRIX_DELAY = on-demand
  90. endif
  91. ifneq ($(filter mdelay=%,$1),)
  92. MDELAY = $(patsubst mdelay=%,%,$1)
  93. endif
  94. ifeq ($(strip $1),mdelay0)
  95. MDELAY = 0
  96. endif
  97. ifeq ($(strip $1),colemak)
  98. ENABLE_COLEMAK = yes
  99. endif
  100. ifeq ($(strip $1),dvorak)
  101. ENABLE_DVORAK = yes
  102. endif
  103. ifeq ($(strip $1),eucalyn)
  104. ENABLE_EUCALYN = yes
  105. endif
  106. ifeq ($(strip $1),lto)
  107. LTO_ENABLE = yes
  108. endif
  109. ifneq ($(filter nolto no-lto no_lto,$(strip $1)),)
  110. LTO_ENABLE = no
  111. endif
  112. ifneq ($(filter enc,$(strip $1)),)
  113. ENCODER_ENABLE = yes
  114. endif
  115. ifneq ($(filter noenc no-enc no_enc,$(strip $1)),)
  116. ENCODER_ENABLE = no
  117. endif
  118. ifneq ($(filter debugenc debug-enc debug_enc,$(strip $1)),)
  119. DEBUG_ENCODER = yes
  120. endif
  121. endef # end of USER_OPTION_PARSE
  122. COMMA=,
  123. $(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(USROPT)), \
  124. $(call USER_OPTION_PARSE,$(A_OPTION_NAME))))
  125. endif