diff options
Diffstat (limited to 'build_layout.mk')
-rw-r--r-- | build_layout.mk | 32 |
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 @@ | |||
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_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 | ||
17 | endef | ||
18 | |||
19 | define SEARCH_LAYOUTS | ||
20 | $$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO))) | ||
21 | endef | ||
22 | |||
23 | ifneq ($(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 | ||
30 | endif | ||
31 | |||
32 | $(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS))) | ||