Skip to content

Commit 40e67a3

Browse files
zvecrmechmerlin
authored andcommitted
Add a mechanism for force building a particular community layout (#5027)
* Add a mechanism for force building a particular community layout * Add docs for FORCE_LAYOUT argument * Update output name when FORCE_LAYOUT is enabled
1 parent 85022f8 commit 40e67a3

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

build_keyboard.mk

+4
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
135135
OPT_DEFS += -DCONVERT_TO_PROTON_C
136136
endif
137137

138+
ifneq ($(FORCE_LAYOUT),)
139+
TARGET := $(TARGET)_$(FORCE_LAYOUT)
140+
endif
141+
138142
include quantum/mcu_selection.mk
139143

140144
ifdef MCU_FAMILY

build_layout.mk

+9
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,13 @@ define SEARCH_LAYOUTS
1515
$$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
1616
endef
1717

18+
ifneq ($(FORCE_LAYOUT),)
19+
ifneq (,$(findstring $(FORCE_LAYOUT),$(LAYOUTS)))
20+
$(info Forcing layout: $(FORCE_LAYOUT))
21+
LAYOUTS := $(FORCE_LAYOUT)
22+
else
23+
$(error Forced layout does not exist)
24+
endif
25+
endif
26+
1827
$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))

docs/feature_layouts.md

+29
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,35 @@ The folder name must be added to the keyboard's `rules.mk`:
5151

5252
but the `LAYOUT_<layout>` variable must be defined in `<folder>.h` as well.
5353

54+
## Building a Keymap
55+
56+
You should be able to build the keyboard keymap with a command in this format:
57+
58+
make <keyboard>:<layout>
59+
60+
### Conflicting layouts
61+
When a keyboard supports multiple layout options,
62+
63+
LAYOUTS = ortho_4x4 ortho_4x12
64+
65+
And a layout exists for both options,
66+
```
67+
layouts/
68+
+ community/
69+
| + ortho_4x4/
70+
| | + <layout>/
71+
| | | + ...
72+
| + ortho_4x12/
73+
| | + <layout>/
74+
| | | + ...
75+
| + ...
76+
```
77+
78+
The FORCE_LAYOUT argument can be used to specify which layout to build
79+
80+
make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x4
81+
make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x12
82+
5483
## Tips for Making Layouts Keyboard-Agnostic
5584

5685
### Includes

0 commit comments

Comments
 (0)