From 8d8a0cdeccb92976969f4959ac56d3a5d28f05f7 Mon Sep 17 00:00:00 2001 From: honorless <86894501+lesshonor@users.noreply.github.com> Date: Sat, 9 Sep 2023 12:05:30 -0400 Subject: [PATCH] refactor: create Vial-specific makefile Isolating Vial build rules and recipes makes it clearer where and why the codebase diverges and prevents unintentional modifications after upstream changes. --- builddefs/build_vial.mk | 36 ++++++++++++++++++++++++++++++++++++ builddefs/common_features.mk | 33 +-------------------------------- 2 files changed, 37 insertions(+), 32 deletions(-) create mode 100644 builddefs/build_vial.mk diff --git a/builddefs/build_vial.mk b/builddefs/build_vial.mk new file mode 100644 index 0000000000..ce31d29562 --- /dev/null +++ b/builddefs/build_vial.mk @@ -0,0 +1,36 @@ +# Copyright 2023 Ilya Zhuravlev +# SPDX-License-Identifier: GPL-2.0-or-later + +QMK_SETTINGS ?= yes +TAP_DANCE_ENABLE ?= yes +ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) + OPT_DEFS += -DTAPPING_TERM_PER_KEY +endif +COMBO_ENABLE ?= yes +KEY_OVERRIDE_ENABLE ?= yes +SRC += $(QUANTUM_DIR)/vial.c +OPT_DEFS += -DVIAL_ENABLE -DNO_DEBUG -DSERIAL_NUMBER=\"vial:f64c2b3c\" + +ifeq ($(strip $(VIAL_INSECURE)), yes) + OPT_DEFS += -DVIAL_INSECURE +endif + +ifeq ($(strip $(VIALRGB_ENABLE)), yes) + SRC += $(QUANTUM_DIR)/vialrgb.c + OPT_DEFS += -DVIALRGB_ENABLE +endif + +ifeq ($(strip $(QMK_SETTINGS)), yes) + AUTO_SHIFT_ENABLE := yes + SRC += $(QUANTUM_DIR)/qmk_settings.c + OPT_DEFS += -DQMK_SETTINGS \ + -DAUTO_SHIFT_NO_SETUP -DAUTO_SHIFT_REPEAT_PER_KEY -DAUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY \ + -DPERMISSIVE_HOLD_PER_KEY -DHOLD_ON_OTHER_KEY_PRESS_PER_KEY -DTAPPING_FORCE_HOLD_PER_KEY -DRETRO_TAPPING_PER_KEY \ + -DCOMBO_TERM_PER_COMBO +endif + +# Generate Vial layout definition header from JSON +$(QUANTUM_DIR)/vial.c: $(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h + +$(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h: $(KEYMAP_PATH)/vial.json + python3 util/vial_generate_definition.py $(KEYMAP_PATH)/vial.json $(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index e94a70c3c1..8446f4250a 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -627,38 +627,7 @@ ifeq ($(strip $(VIA_ENABLE)), yes) endif ifeq ($(strip $(VIAL_ENABLE)), yes) - QMK_SETTINGS ?= yes - TAP_DANCE_ENABLE ?= yes - ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) - OPT_DEFS += -DTAPPING_TERM_PER_KEY - endif - COMBO_ENABLE ?= yes - KEY_OVERRIDE_ENABLE ?= yes - SRC += $(QUANTUM_DIR)/vial.c - OPT_DEFS += -DVIAL_ENABLE -DNO_DEBUG -DSERIAL_NUMBER=\"vial:f64c2b3c\" - -$(QUANTUM_DIR)/vial.c: $(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h - -$(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h: $(KEYMAP_PATH)/vial.json - python3 util/vial_generate_definition.py $(KEYMAP_PATH)/vial.json $(INTERMEDIATE_OUTPUT)/src/vial_generated_keyboard_definition.h -endif - -ifeq ($(strip $(VIAL_INSECURE)), yes) - OPT_DEFS += -DVIAL_INSECURE -endif - -ifeq ($(strip $(VIALRGB_ENABLE)), yes) - SRC += $(QUANTUM_DIR)/vialrgb.c - OPT_DEFS += -DVIALRGB_ENABLE -endif - -ifeq ($(strip $(QMK_SETTINGS)), yes) - AUTO_SHIFT_ENABLE := yes - SRC += $(QUANTUM_DIR)/qmk_settings.c - OPT_DEFS += -DQMK_SETTINGS \ - -DAUTO_SHIFT_NO_SETUP -DAUTO_SHIFT_REPEAT_PER_KEY -DAUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY \ - -DPERMISSIVE_HOLD_PER_KEY -DHOLD_ON_OTHER_KEY_PRESS_PER_KEY -DTAPPING_FORCE_HOLD_PER_KEY -DRETRO_TAPPING_PER_KEY \ - -DCOMBO_TERM_PER_COMBO + include $(BUILDDEFS_PATH)/build_vial.mk endif VALID_MAGIC_TYPES := yes