]> git.donarmstrong.com Git - qmk_firmware.git/blob - build_layout.mk
Creates a layouts/ folder for keymaps shared between keyboards (#1609)
[qmk_firmware.git] / build_layout.mk
1 LAYOUTS_PATH := layouts
2 LAYOUTS_REPOS := $(patsubst %/,%,$(sort $(dir $(wildcard $(LAYOUTS_PATH)/*/))))
3
4 define SEARCH_LAYOUTS_REPO
5     LAYOUT_KEYMAP_PATH := $$(LAYOUTS_REPO)/$$(LAYOUT)/$$(KEYMAP)
6     LAYOUT_KEYMAP_C := $$(LAYOUT_KEYMAP_PATH)/keymap.c
7     ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_C))","")
8         -include $$(LAYOUT_KEYMAP_PATH)/rules.mk
9         KEYMAP_C := $$(LAYOUT_KEYMAP_C)
10         KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
11     endif
12 endef
13
14 define SEARCH_LAYOUTS
15     $$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
16 endef
17
18 $(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))