summaryrefslogtreecommitdiff
path: root/users/mtei/user_options.mk
blob: a3cf2196f9522ff104838be287abf413fbbe20c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Copyright (c) 2022 Takeshi Ishii (mtei@github)
# SPDX-License-Identifier: GPL-2.0-or-later

#
#  make USROPT=<option>,<option>,...  <KEYBOARD>:<KEYMAP>
#  options:
#    dispoff:     OLED, RGBLIGHT disable
#    oled:        OLED enable
#    no-oled:     OLED disable
#    rgblight:    RGBLIGHT enable
#    no-rgblight: RGBLIGHT disable
#    no_ani:      RGBLIGHT ANIMATIONS disable
#    mini-ani:    RGBLIGHT ANIMATIONS mini set
#    ani:         RGBLIGHT ANIMATIONS enable
#    scan:        DEBUG_MATRIX_SCAN_RATE enable
#    scan-api:    DEBUG_MATRIX_SCAN_RATE api enable
#    mdelay=<num> MATRIX_IO_DELAY set <num>
#    mdelay_type=<type> use custom matrix_output_unselect_delay()
#                 type=no,ondemand
#    enc:         ENCODER enable
#    no-enc:      ENCODER disable
#
ifneq ($(strip $(USROPT)),)
  define USER_OPTION_PARSE
    # parse 'debug', 'no-debug', 'dispoff', 'consle', 'scan', 'no-scan', 'scan-api',
    #   'mdelay=?', 'mdelay0', 'colemak', 'dvorak', 'eucalyn', 'lto', 'no-lto'
    $(if $(SHOW_PARSE),$(info parse .$1.))  #for debug  'make SHOW_PARSE=y ...'
    ifeq ($(strip $1),debug)
        DEBUG_CONFIG = yes
    endif
    ifneq ($(filter nodebug no-debug no_debug,$(strip $1)),)
        DEBUG_CONFIG = no
    endif
    ifeq ($(strip $1),dispoff)
        OLED_ENABLE = no
        RGBLIGHT_ENABLE = no
        LED_BACK_ENABLE = no
        LED_UNDERGLOW_ENABLE = no
    endif
    ifneq ($(filter rgblight,$(strip $1)),)
        RGBLIGHT_ENABLE = yes
        LED_BACK_ENABLE = yes
    endif
    ifneq ($(filter norgblight no-rgblight,$(strip $1)),)
        RGBLIGHT_ENABLE = no
        LED_BACK_ENABLE = no
        LED_UNDERGLOW_ENABLE = no
    endif
    ifneq ($(filter na no_ani no-ani,$(strip $1)),)
        LED_ANIMATIONS = no
    endif
    ifneq ($(filter mini-ani mini_ani,$(strip $1)),)
        LED_ANIMATIONS = mini
    endif
    ifneq ($(filter ani animation,$(strip $1)),)
        LED_ANIMATIONS = yes
    endif
    ifneq ($(filter nooled no-oled,$(strip $1)),)
        OLED_ENABLE = no
    endif
    ifeq ($(strip $1),oled)
        OLED_ENABLE = yes
    endif
    ifeq ($(strip $1),console)
        CONSOLE_ENABLE = yes
    endif
    ifeq ($(strip $1),scan)
        # use DEBUG_MATRIX_SCAN_RATE
        # see docs/newbs_testing_debugging.md
        DEBUG_MATRIX_SCAN_RATE_ENABLE = yes
    endif
    ifeq ($(strip $1),no-scan)
        DEBUG_MATRIX_SCAN_RATE_ENABLE = no
    endif
    ifeq ($(strip $1),scan-api)
        # use DEBUG_MATRIX_SCAN_RATE
        # see docs/newbs_testing_debugging.md
        DEBUG_MATRIX_SCAN_RATE_ENABLE = api
    endif
    ifneq ($(filter stimer sync-timer,$(strip $1)),)
        SYNC_TIMER_ENABLE = yes
    endif
    ifneq ($(filter nostimer no-sync-timer,$(strip $1)),)
        SYNC_TIMER_ENABLE = no
    endif
    ifeq ($(filter mdelay_type=%,$1),mdelay_type=no)
        CUSTOM_MATRIX_DELAY = no
    endif
    ifeq ($(filter mdelay_type=%,$1),mdelay_type=demand)
        CUSTOM_MATRIX_DELAY = on-demand
    endif
    ifneq ($(filter mdelay=%,$1),)
        MDELAY = $(patsubst mdelay=%,%,$1)
    endif
    ifeq ($(strip $1),mdelay0)
        MDELAY = 0
    endif
    ifeq ($(strip $1),colemak)
         ENABLE_COLEMAK = yes
    endif
    ifeq ($(strip $1),dvorak)
         ENABLE_DVORAK = yes
    endif
    ifeq ($(strip $1),eucalyn)
         ENABLE_EUCALYN = yes
    endif
    ifeq ($(strip $1),lto)
        LTO_ENABLE = yes
    endif
    ifneq ($(filter nolto no-lto no_lto,$(strip $1)),)
        LTO_ENABLE = no
    endif
    ifneq ($(filter enc,$(strip $1)),)
        ENCODER_ENABLE = yes
    endif
    ifneq ($(filter noenc no-enc no_enc,$(strip $1)),)
        ENCODER_ENABLE = no
    endif
    ifneq ($(filter debugenc debug-enc debug_enc,$(strip $1)),)
        DEBUG_ENCODER = yes
    endif
  endef # end of USER_OPTION_PARSE

  COMMA=,
  $(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(USROPT)),  \
      $(call USER_OPTION_PARSE,$(A_OPTION_NAME))))
endif