aboutsummaryrefslogtreecommitdiff
path: root/build_keyboard.mk
diff options
context:
space:
mode:
Diffstat (limited to 'build_keyboard.mk')
-rw-r--r--build_keyboard.mk46
1 files changed, 36 insertions, 10 deletions
diff --git a/build_keyboard.mk b/build_keyboard.mk
index 46d1e4566..daef76080 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -23,6 +23,15 @@ KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
23# Force expansion 23# Force expansion
24TARGET := $(TARGET) 24TARGET := $(TARGET)
25 25
26ifneq ($(FORCE_LAYOUT),)
27 TARGET := $(TARGET)_$(FORCE_LAYOUT)
28endif
29
30# Object files and generated keymap directory
31# To put object files in current directory, use a dot (.), do NOT make
32# this an empty or blank macro!
33KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
34
26# For split boards we need to set a master half. 35# For split boards we need to set a master half.
27MASTER ?= left 36MASTER ?= left
28ifdef master 37ifdef master
@@ -100,18 +109,9 @@ MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
100MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP) 109MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
101 110
102# Pull in rules from info.json 111# Pull in rules from info.json
103INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk) 112INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_rules.mk)
104include $(INFO_RULES_MK) 113include $(INFO_RULES_MK)
105 114
106ifneq ($(FORCE_LAYOUT),)
107 TARGET := $(TARGET)_$(FORCE_LAYOUT)
108endif
109
110# Object files and generated keymap directory
111# To put object files in current directory, use a dot (.), do NOT make
112# this an empty or blank macro!
113KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
114
115# Check for keymap.json first, so we can regenerate keymap.c 115# Check for keymap.json first, so we can regenerate keymap.c
116include build_json.mk 116include build_json.mk
117 117
@@ -146,6 +146,29 @@ ifeq ("$(wildcard $(KEYMAP_PATH))", "")
146 endif 146 endif
147endif 147endif
148 148
149# Have we found a keymap.json?
150ifneq ("$(wildcard $(KEYMAP_JSON))", "")
151 KEYMAP_C := $(KEYMAP_OUTPUT)/keymap.c
152 KEYMAP_H := $(KEYMAP_OUTPUT)/config.h
153
154 # Load the keymap-level rules.mk if exists
155 -include $(KEYMAP_PATH)/rules.mk
156
157 # Load any rules.mk content from keymap.json
158 INFO_RULES_MK = $(shell (QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_OUTPUT)/rules.mk)
159 include $(INFO_RULES_MK)
160
161# Add rules to enerate the keymap files - indentation here is important
162$(KEYMAP_OUTPUT)/keymap.c: $(KEYMAP_JSON)
163 (QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
164
165$(KEYMAP_OUTPUT)/config.h: $(KEYMAP_JSON)
166 (QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_OUTPUT)/config.h
167
168generated-files: $(KEYMAP_OUTPUT)/config.h $(KEYMAP_OUTPUT)/keymap.c
169
170endif
171
149ifeq ($(strip $(CTPC)), yes) 172ifeq ($(strip $(CTPC)), yes)
150 CONVERT_TO_PROTON_C=yes 173 CONVERT_TO_PROTON_C=yes
151endif 174endif
@@ -336,6 +359,9 @@ endif
336ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","") 359ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
337 CONFIG_H += $(KEYMAP_PATH)/config.h 360 CONFIG_H += $(KEYMAP_PATH)/config.h
338endif 361endif
362ifneq ("$(KEYMAP_H)","")
363 CONFIG_H += $(KEYMAP_H)
364endif
339 365
340# project specific files 366# project specific files
341SRC += \ 367SRC += \