aboutsummaryrefslogtreecommitdiff
path: root/build_layout.mk
diff options
context:
space:
mode:
Diffstat (limited to 'build_layout.mk')
-rw-r--r--build_layout.mk32
1 files changed, 32 insertions, 0 deletions
diff --git a/build_layout.mk b/build_layout.mk
new file mode 100644
index 000000000..b4b00793e
--- /dev/null
+++ b/build_layout.mk
@@ -0,0 +1,32 @@
1LAYOUTS_PATH := layouts
2LAYOUTS_REPOS := $(patsubst %/,%,$(sort $(dir $(wildcard $(LAYOUTS_PATH)/*/))))
3
4define SEARCH_LAYOUTS_REPO
5 LAYOUT_KEYMAP_PATH := $$(LAYOUTS_REPO)/$$(LAYOUT)/$$(KEYMAP)
6 LAYOUT_KEYMAP_JSON := $$(LAYOUT_KEYMAP_PATH)/keymap.json
7 LAYOUT_KEYMAP_C := $$(LAYOUT_KEYMAP_PATH)/keymap.c
8 ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_JSON))","")
9 -include $$(LAYOUT_KEYMAP_PATH)/rules.mk
10 KEYMAP_JSON := $$(LAYOUT_KEYMAP_JSON)
11 KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
12 else ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_C))","")
13 -include $$(LAYOUT_KEYMAP_PATH)/rules.mk
14 KEYMAP_C := $$(LAYOUT_KEYMAP_C)
15 KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
16 endif
17endef
18
19define SEARCH_LAYOUTS
20 $$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
21endef
22
23ifneq ($(FORCE_LAYOUT),)
24 ifneq (,$(findstring $(FORCE_LAYOUT),$(LAYOUTS)))
25 $(info Forcing layout: $(FORCE_LAYOUT))
26 LAYOUTS := $(FORCE_LAYOUT)
27 else
28 $(error Forced layout does not exist)
29 endif
30endif
31
32$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))