diff options
| author | Joel Challis <git@zvecr.com> | 2021-10-17 22:37:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-17 22:37:48 +0100 |
| commit | bd2f8ab88a8d1598cde47d3238ae8a49f1d7fbf9 (patch) | |
| tree | d029505cd77fbf9a549017dbe28ef181632c226b | |
| parent | bb80b2a40cd37042b25c721033c531f8c8d0cb16 (diff) | |
| download | qmk_firmware-bd2f8ab88a8d1598cde47d3238ae8a49f1d7fbf9.tar.gz qmk_firmware-bd2f8ab88a8d1598cde47d3238ae8a49f1d7fbf9.zip | |
Infer more when building features (#13890)
| -rw-r--r-- | build_keyboard.mk | 1 | ||||
| -rw-r--r-- | build_test.mk | 1 | ||||
| -rw-r--r-- | common_features.mk | 83 | ||||
| -rw-r--r-- | generic_features.mk | 48 |
4 files changed, 50 insertions, 83 deletions
diff --git a/build_keyboard.mk b/build_keyboard.mk index 691045853..36807911d 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk | |||
| @@ -399,6 +399,7 @@ VPATH += $(KEYBOARD_PATHS) | |||
| 399 | VPATH += $(COMMON_VPATH) | 399 | VPATH += $(COMMON_VPATH) |
| 400 | 400 | ||
| 401 | include common_features.mk | 401 | include common_features.mk |
| 402 | include generic_features.mk | ||
| 402 | include $(TMK_PATH)/protocol.mk | 403 | include $(TMK_PATH)/protocol.mk |
| 403 | include $(TMK_PATH)/common.mk | 404 | include $(TMK_PATH)/common.mk |
| 404 | include bootloader.mk | 405 | include bootloader.mk |
diff --git a/build_test.mk b/build_test.mk index 96487c01f..dd66a008e 100644 --- a/build_test.mk +++ b/build_test.mk | |||
| @@ -52,6 +52,7 @@ include tests/$(TEST)/rules.mk | |||
| 52 | endif | 52 | endif |
| 53 | 53 | ||
| 54 | include common_features.mk | 54 | include common_features.mk |
| 55 | include generic_features.mk | ||
| 55 | include $(TMK_PATH)/common.mk | 56 | include $(TMK_PATH)/common.mk |
| 56 | include $(QUANTUM_PATH)/debounce/tests/rules.mk | 57 | include $(QUANTUM_PATH)/debounce/tests/rules.mk |
| 57 | include $(QUANTUM_PATH)/sequencer/tests/rules.mk | 58 | include $(QUANTUM_PATH)/sequencer/tests/rules.mk |
diff --git a/common_features.mk b/common_features.mk index 6a9754e58..aff91641e 100644 --- a/common_features.mk +++ b/common_features.mk | |||
| @@ -44,11 +44,6 @@ else ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), api) | |||
| 44 | OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE | 44 | OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE |
| 45 | endif | 45 | endif |
| 46 | 46 | ||
| 47 | ifeq ($(strip $(COMMAND_ENABLE)), yes) | ||
| 48 | SRC += $(QUANTUM_DIR)/command.c | ||
| 49 | OPT_DEFS += -DCOMMAND_ENABLE | ||
| 50 | endif | ||
| 51 | |||
| 52 | AUDIO_ENABLE ?= no | 47 | AUDIO_ENABLE ?= no |
| 53 | ifeq ($(strip $(AUDIO_ENABLE)), yes) | 48 | ifeq ($(strip $(AUDIO_ENABLE)), yes) |
| 54 | ifeq ($(PLATFORM),CHIBIOS) | 49 | ifeq ($(PLATFORM),CHIBIOS) |
| @@ -118,12 +113,6 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) | |||
| 118 | SRC += $(QUANTUM_DIR)/pointing_device.c | 113 | SRC += $(QUANTUM_DIR)/pointing_device.c |
| 119 | endif | 114 | endif |
| 120 | 115 | ||
| 121 | ifeq ($(strip $(PROGRAMMABLE_BUTTON_ENABLE)), yes) | ||
| 122 | OPT_DEFS += -DPROGRAMMABLE_BUTTON_ENABLE | ||
| 123 | SRC += $(QUANTUM_DIR)/programmable_button.c | ||
| 124 | SRC += $(QUANTUM_DIR)/process_keycode/process_programmable_button.c | ||
| 125 | endif | ||
| 126 | |||
| 127 | VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi | 116 | VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi |
| 128 | EEPROM_DRIVER ?= vendor | 117 | EEPROM_DRIVER ?= vendor |
| 129 | ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),) | 118 | ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),) |
| @@ -419,21 +408,6 @@ ifeq ($(strip $(TERMINAL_ENABLE)), yes) | |||
| 419 | OPT_DEFS += -DUSER_PRINT | 408 | OPT_DEFS += -DUSER_PRINT |
| 420 | endif | 409 | endif |
| 421 | 410 | ||
| 422 | ifeq ($(strip $(WPM_ENABLE)), yes) | ||
| 423 | SRC += $(QUANTUM_DIR)/wpm.c | ||
| 424 | OPT_DEFS += -DWPM_ENABLE | ||
| 425 | endif | ||
| 426 | |||
| 427 | ifeq ($(strip $(ENCODER_ENABLE)), yes) | ||
| 428 | SRC += $(QUANTUM_DIR)/encoder.c | ||
| 429 | OPT_DEFS += -DENCODER_ENABLE | ||
| 430 | endif | ||
| 431 | |||
| 432 | ifeq ($(strip $(VELOCIKEY_ENABLE)), yes) | ||
| 433 | OPT_DEFS += -DVELOCIKEY_ENABLE | ||
| 434 | SRC += $(QUANTUM_DIR)/velocikey.c | ||
| 435 | endif | ||
| 436 | |||
| 437 | ifeq ($(strip $(VIA_ENABLE)), yes) | 411 | ifeq ($(strip $(VIA_ENABLE)), yes) |
| 438 | DYNAMIC_KEYMAP_ENABLE := yes | 412 | DYNAMIC_KEYMAP_ENABLE := yes |
| 439 | RAW_ENABLE := yes | 413 | RAW_ENABLE := yes |
| @@ -442,16 +416,6 @@ ifeq ($(strip $(VIA_ENABLE)), yes) | |||
| 442 | OPT_DEFS += -DVIA_ENABLE | 416 | OPT_DEFS += -DVIA_ENABLE |
| 443 | endif | 417 | endif |
| 444 | 418 | ||
| 445 | ifeq ($(strip $(DYNAMIC_KEYMAP_ENABLE)), yes) | ||
| 446 | OPT_DEFS += -DDYNAMIC_KEYMAP_ENABLE | ||
| 447 | SRC += $(QUANTUM_DIR)/dynamic_keymap.c | ||
| 448 | endif | ||
| 449 | |||
| 450 | ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes) | ||
| 451 | OPT_DEFS += -DDIP_SWITCH_ENABLE | ||
| 452 | SRC += $(QUANTUM_DIR)/dip_switch.c | ||
| 453 | endif | ||
| 454 | |||
| 455 | VALID_MAGIC_TYPES := yes lite | 419 | VALID_MAGIC_TYPES := yes lite |
| 456 | BOOTMAGIC_ENABLE ?= no | 420 | BOOTMAGIC_ENABLE ?= no |
| 457 | ifneq ($(strip $(BOOTMAGIC_ENABLE)), no) | 421 | ifneq ($(strip $(BOOTMAGIC_ENABLE)), no) |
| @@ -602,54 +566,12 @@ ifeq ($(strip $(UNICODE_COMMON)), yes) | |||
| 602 | SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c | 566 | SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c |
| 603 | endif | 567 | endif |
| 604 | 568 | ||
| 605 | SPACE_CADET_ENABLE ?= yes | ||
| 606 | ifeq ($(strip $(SPACE_CADET_ENABLE)), yes) | ||
| 607 | SRC += $(QUANTUM_DIR)/process_keycode/process_space_cadet.c | ||
| 608 | OPT_DEFS += -DSPACE_CADET_ENABLE | ||
| 609 | endif | ||
| 610 | |||
| 611 | MAGIC_ENABLE ?= yes | 569 | MAGIC_ENABLE ?= yes |
| 612 | ifeq ($(strip $(MAGIC_ENABLE)), yes) | 570 | ifeq ($(strip $(MAGIC_ENABLE)), yes) |
| 613 | SRC += $(QUANTUM_DIR)/process_keycode/process_magic.c | 571 | SRC += $(QUANTUM_DIR)/process_keycode/process_magic.c |
| 614 | OPT_DEFS += -DMAGIC_KEYCODE_ENABLE | 572 | OPT_DEFS += -DMAGIC_KEYCODE_ENABLE |
| 615 | endif | 573 | endif |
| 616 | 574 | ||
| 617 | GRAVE_ESC_ENABLE ?= yes | ||
| 618 | ifeq ($(strip $(GRAVE_ESC_ENABLE)), yes) | ||
| 619 | SRC += $(QUANTUM_DIR)/process_keycode/process_grave_esc.c | ||
| 620 | OPT_DEFS += -DGRAVE_ESC_ENABLE | ||
| 621 | endif | ||
| 622 | |||
| 623 | ifeq ($(strip $(DYNAMIC_MACRO_ENABLE)), yes) | ||
| 624 | SRC += $(QUANTUM_DIR)/process_keycode/process_dynamic_macro.c | ||
| 625 | OPT_DEFS += -DDYNAMIC_MACRO_ENABLE | ||
| 626 | endif | ||
| 627 | |||
| 628 | ifeq ($(strip $(COMBO_ENABLE)), yes) | ||
| 629 | SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c | ||
| 630 | OPT_DEFS += -DCOMBO_ENABLE | ||
| 631 | endif | ||
| 632 | |||
| 633 | ifeq ($(strip $(KEY_OVERRIDE_ENABLE)), yes) | ||
| 634 | SRC += $(QUANTUM_DIR)/process_keycode/process_key_override.c | ||
| 635 | OPT_DEFS += -DKEY_OVERRIDE_ENABLE | ||
| 636 | endif | ||
| 637 | |||
| 638 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | ||
| 639 | SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c | ||
| 640 | OPT_DEFS += -DTAP_DANCE_ENABLE | ||
| 641 | endif | ||
| 642 | |||
| 643 | ifeq ($(strip $(KEY_LOCK_ENABLE)), yes) | ||
| 644 | SRC += $(QUANTUM_DIR)/process_keycode/process_key_lock.c | ||
| 645 | OPT_DEFS += -DKEY_LOCK_ENABLE | ||
| 646 | endif | ||
| 647 | |||
| 648 | ifeq ($(strip $(LEADER_ENABLE)), yes) | ||
| 649 | SRC += $(QUANTUM_DIR)/process_keycode/process_leader.c | ||
| 650 | OPT_DEFS += -DLEADER_ENABLE | ||
| 651 | endif | ||
| 652 | |||
| 653 | ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes) | 575 | ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes) |
| 654 | SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c | 576 | SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c |
| 655 | OPT_DEFS += -DAUTO_SHIFT_ENABLE | 577 | OPT_DEFS += -DAUTO_SHIFT_ENABLE |
| @@ -678,11 +600,6 @@ ifeq ($(strip $(JOYSTICK_ENABLE)), yes) | |||
| 678 | endif | 600 | endif |
| 679 | endif | 601 | endif |
| 680 | 602 | ||
| 681 | DIGITIZER_ENABLE ?= no | ||
| 682 | ifneq ($(strip $(DIGITIZER_ENABLE)), no) | ||
| 683 | SRC += $(QUANTUM_DIR)/digitizer.c | ||
| 684 | endif | ||
| 685 | |||
| 686 | USBPD_ENABLE ?= no | 603 | USBPD_ENABLE ?= no |
| 687 | VALID_USBPD_DRIVER_TYPES = custom vendor | 604 | VALID_USBPD_DRIVER_TYPES = custom vendor |
| 688 | USBPD_DRIVER ?= vendor | 605 | USBPD_DRIVER ?= vendor |
diff --git a/generic_features.mk b/generic_features.mk new file mode 100644 index 000000000..c455c83dd --- /dev/null +++ b/generic_features.mk | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | # Copyright 2021 QMK | ||
| 2 | # | ||
| 3 | # This program is free software: you can redistribute it and/or modify | ||
| 4 | # it under the terms of the GNU General Public License as published by | ||
| 5 | # the Free Software Foundation, either version 2 of the License, or | ||
| 6 | # (at your option) any later version. | ||
| 7 | # | ||
| 8 | # This program is distributed in the hope that it will be useful, | ||
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | # GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License | ||
| 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | |||
| 16 | SPACE_CADET_ENABLE ?= yes | ||
| 17 | GRAVE_ESC_ENABLE ?= yes | ||
| 18 | |||
| 19 | GENERIC_FEATURES = \ | ||
| 20 | COMBO \ | ||
| 21 | COMMAND \ | ||
| 22 | DIGITIZER \ | ||
| 23 | DIP_SWITCH \ | ||
| 24 | DYNAMIC_KEYMAP \ | ||
| 25 | DYNAMIC_MACRO \ | ||
| 26 | ENCODER \ | ||
| 27 | GRAVE_ESC \ | ||
| 28 | KEY_LOCK \ | ||
| 29 | KEY_OVERRIDE \ | ||
| 30 | LEADER \ | ||
| 31 | PROGRAMMABLE_BUTTON \ | ||
| 32 | SPACE_CADET \ | ||
| 33 | TAP_DANCE \ | ||
| 34 | VELOCIKEY \ | ||
| 35 | WPM \ | ||
| 36 | |||
| 37 | define HANDLE_GENERIC_FEATURE | ||
| 38 | # $$(info "Processing: $1_ENABLE $2.c") | ||
| 39 | SRC += $$(wildcard $$(QUANTUM_DIR)/process_keycode/process_$2.c) | ||
| 40 | SRC += $$(wildcard $$(QUANTUM_DIR)/$2.c) | ||
| 41 | OPT_DEFS += -D$1_ENABLE | ||
| 42 | endef | ||
| 43 | |||
| 44 | $(foreach F,$(GENERIC_FEATURES),\ | ||
| 45 | $(if $(filter yes, $(strip $($(F)_ENABLE))),\ | ||
| 46 | $(eval $(call HANDLE_GENERIC_FEATURE,$(F),$(shell echo $(F) | tr '[:upper:]' '[:lower:]'))) \ | ||
| 47 | ) \ | ||
| 48 | ) | ||
