2017-08-24 02:29:07 +00:00
|
|
|
LAYOUTS_PATH := layouts
|
|
|
|
LAYOUTS_REPOS := $(patsubst %/,%,$(sort $(dir $(wildcard $(LAYOUTS_PATH)/*/))))
|
|
|
|
|
2023-11-27 20:53:43 +00:00
|
|
|
ifneq ($(QMK_USERSPACE),)
|
|
|
|
LAYOUTS_REPOS += $(patsubst %/,%,$(QMK_USERSPACE)/$(LAYOUTS_PATH))
|
|
|
|
endif
|
|
|
|
|
2017-08-24 02:29:07 +00:00
|
|
|
define SEARCH_LAYOUTS_REPO
|
|
|
|
LAYOUT_KEYMAP_PATH := $$(LAYOUTS_REPO)/$$(LAYOUT)/$$(KEYMAP)
|
2020-06-25 22:32:21 +00:00
|
|
|
LAYOUT_KEYMAP_JSON := $$(LAYOUT_KEYMAP_PATH)/keymap.json
|
2017-08-24 02:29:07 +00:00
|
|
|
LAYOUT_KEYMAP_C := $$(LAYOUT_KEYMAP_PATH)/keymap.c
|
2020-06-25 22:32:21 +00:00
|
|
|
ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_JSON))","")
|
|
|
|
-include $$(LAYOUT_KEYMAP_PATH)/rules.mk
|
|
|
|
KEYMAP_JSON := $$(LAYOUT_KEYMAP_JSON)
|
|
|
|
KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
|
|
|
|
else ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_C))","")
|
2017-08-24 02:29:07 +00:00
|
|
|
-include $$(LAYOUT_KEYMAP_PATH)/rules.mk
|
|
|
|
KEYMAP_C := $$(LAYOUT_KEYMAP_C)
|
|
|
|
KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
|
|
|
define SEARCH_LAYOUTS
|
|
|
|
$$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
|
|
|
|
endef
|
|
|
|
|
2019-02-15 04:14:26 +00:00
|
|
|
ifneq ($(FORCE_LAYOUT),)
|
|
|
|
ifneq (,$(findstring $(FORCE_LAYOUT),$(LAYOUTS)))
|
|
|
|
$(info Forcing layout: $(FORCE_LAYOUT))
|
|
|
|
LAYOUTS := $(FORCE_LAYOUT)
|
|
|
|
else
|
2022-02-05 01:32:31 +00:00
|
|
|
$(call CATASTROPHIC_ERROR,Invalid layout,Forced layout does not exist)
|
2019-02-15 04:14:26 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-06-25 22:32:21 +00:00
|
|
|
$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))
|