]> git.donarmstrong.com Git - qmk_firmware.git/blob - build_layout.mk
[Keyboard] Enable RGB Light on ARM OLKB Keyboards (#7293)
[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 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
27 $(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))