Skip to content

Commit

Permalink
Add a mechanism for force building a particular community layout (#5027)
Browse files Browse the repository at this point in the history
* Add a mechanism for force building a particular community layout

* Add docs for FORCE_LAYOUT argument

* Update output name when FORCE_LAYOUT is enabled
  • Loading branch information
zvecr authored and mechmerlin committed Feb 15, 2019
1 parent 85022f8 commit 40e67a3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build_keyboard.mk
Expand Up @@ -135,6 +135,10 @@ ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
OPT_DEFS += -DCONVERT_TO_PROTON_C
endif

ifneq ($(FORCE_LAYOUT),)
TARGET := $(TARGET)_$(FORCE_LAYOUT)
endif

include quantum/mcu_selection.mk

ifdef MCU_FAMILY
Expand Down
9 changes: 9 additions & 0 deletions build_layout.mk
Expand Up @@ -15,4 +15,13 @@ define SEARCH_LAYOUTS
$$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
endef

ifneq ($(FORCE_LAYOUT),)
ifneq (,$(findstring $(FORCE_LAYOUT),$(LAYOUTS)))
$(info Forcing layout: $(FORCE_LAYOUT))
LAYOUTS := $(FORCE_LAYOUT)
else
$(error Forced layout does not exist)
endif
endif

$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))
29 changes: 29 additions & 0 deletions docs/feature_layouts.md
Expand Up @@ -51,6 +51,35 @@ The folder name must be added to the keyboard's `rules.mk`:

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

## Building a Keymap

You should be able to build the keyboard keymap with a command in this format:

make <keyboard>:<layout>

### Conflicting layouts
When a keyboard supports multiple layout options,

LAYOUTS = ortho_4x4 ortho_4x12

And a layout exists for both options,
```
layouts/
+ community/
| + ortho_4x4/
| | + <layout>/
| | | + ...
| + ortho_4x12/
| | + <layout>/
| | | + ...
| + ...
```

The FORCE_LAYOUT argument can be used to specify which layout to build

make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x4
make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x12

## Tips for Making Layouts Keyboard-Agnostic

### Includes
Expand Down

0 comments on commit 40e67a3

Please sign in to comment.