From 36db4280b3f0361632d20866a33d9f574037c947 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Sun, 4 Nov 2018 21:46:40 +0900 Subject: [PATCH 1/4] add 'include keyboard_features.mk' into build_keyboard.mk keyboard_features.mk is a keyboard-local version of the functions performed by common_features.mk. --- build_keyboard.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build_keyboard.mk b/build_keyboard.mk index 366d1f5d2f9d..9dce5bb33c17 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -320,6 +320,22 @@ endif # Disable features that a keyboard doesn't support -include disable_features.mk +ifneq ("$(wildcard $(KEYBOARD_PATH_1)/keyboard_features.mk)","") + include $(KEYBOARD_PATH_1)/keyboard_features.mk +endif +ifneq ("$(wildcard $(KEYBOARD_PATH_2)/keyboard_features.mk)","") + include $(KEYBOARD_PATH_2)/keyboard_features.mk +endif +ifneq ("$(wildcard $(KEYBOARD_PATH_3)/keyboard_features.mk)","") + include $(KEYBOARD_PATH_3)/keyboard_features.mk +endif +ifneq ("$(wildcard $(KEYBOARD_PATH_4)/keyboard_features.mk)","") + include $(KEYBOARD_PATH_4)/keyboard_features.mk +endif +ifneq ("$(wildcard $(KEYBOARD_PATH_5)/keyboard_features.mk)","") + include $(KEYBOARD_PATH_5)/keyboard_features.mk +endif + # Object files directory # To put object files in current directory, use a dot (.), do NOT make # this an empty or blank macro! From 37a484dc31f14415bc270355181f805d9e96d418 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Wed, 18 Mar 2020 21:24:13 +0900 Subject: [PATCH 2/4] add comment into build_keyboard.mk --- build_keyboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build_keyboard.mk b/build_keyboard.mk index 9dce5bb33c17..df32a9c724f2 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -103,6 +103,7 @@ include $(INFO_RULES_MK) # Check for keymap.json first, so we can regenerate keymap.c include build_json.mk +# Pull in keymap level rules.mk ifeq ("$(wildcard $(KEYMAP_PATH))", "") # Look through the possible keymap folders until we find a matching keymap.c ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","") @@ -309,6 +310,7 @@ ifeq ("$(USER_NAME)","") endif USER_PATH := users/$(USER_NAME) +# Pull in user level rules.mk -include $(USER_PATH)/rules.mk ifneq ("$(wildcard $(USER_PATH)/config.h)","") CONFIG_H += $(USER_PATH)/config.h @@ -320,6 +322,7 @@ endif # Disable features that a keyboard doesn't support -include disable_features.mk +# Pull in keyboard_features.mk files from all our subfolders ifneq ("$(wildcard $(KEYBOARD_PATH_1)/keyboard_features.mk)","") include $(KEYBOARD_PATH_1)/keyboard_features.mk endif From 7418a4bd59871e13f4e0b11f2b33bf4be7065577 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Mon, 30 Mar 2020 18:07:05 +0900 Subject: [PATCH 3/4] added description of keyboard_features.mk in hardware_keyboard_guidelines.md. --- docs/hardware_keyboard_guidelines.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/hardware_keyboard_guidelines.md b/docs/hardware_keyboard_guidelines.md index 4f32715046a9..3f2e327c4005 100644 --- a/docs/hardware_keyboard_guidelines.md +++ b/docs/hardware_keyboard_guidelines.md @@ -144,10 +144,38 @@ The `rules.mk` file can also be placed in a sub-folder, and its reading order is * `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/rules.mk` * `keyboards/top_folder/keymaps/a_keymap/rules.mk` * `users/a_user_folder/rules.mk` + * `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/keyboard_features.mk` + * `keyboards/top_folder/sub_1/sub_2/sub_3/keyboard_features.mk` + * `keyboards/top_folder/sub_1/sub_2/keyboard_features.mk` + * `keyboards/top_folder/sub_1/keyboard_features.mk` +* `keyboards/top_folder/keyboard_features.mk` * `common_features.mk` Many of the settings written in the `rules.mk` file are interpreted by `common_features.mk`, which sets the necessary source files and compiler options. +The `keyboard_features.mk` file can interpret `features` of a keyboard-level before `common_features.mk`. For example, when your designed keyboard has the option to implement backlighting or underglow using rgblight.c, writing the following in the `keyboard_features.mk` makes it easier for the user to configure the `rules.mk`. + +* `keyboards/top_folder/keymaps/a_keymap/rules.mk` + ```makefile + # Please set the following according to the selection of the hardware implementation option. + RGBLED_OPTION_TYPE = backlight ## none, backlight or underglow + ``` +* `keyboards/top_folder/keyboard_features.mk` + ```makefile + ifeq ($(filter $(strip $(RGBLED_OPTION_TYPE))x, nonex backlightx underglowx x),) + $(error unknown RGBLED_OPTION_TYPE value "$(RGBLED_OPTION_TYPE)") + endif + + ifeq ($(strip $(RGBLED_OPTION_TYPE)),backlight) + RGBLIGHT_ENABLE = yes + OPT_DEFS += -DRGBLED_NUM=30 + endif + ifeq ($(strip $(RGBLED_OPTION_TYPE)),underglow) + RGBLIGHT_ENABLE = yes + OPT_DEFS += -DRGBLED_NUM=6 + endif + ``` + ?> See `build_keyboard.mk` and `common_features.mk` for more details. ### `` From e396557341533bb77dc0b0a2b2fa21a774d898e1 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Fri, 5 Mar 2021 04:28:15 +0900 Subject: [PATCH 4/4] rename `keyboard_features.mk` to `post_rules.mk` --- build_keyboard.mk | 22 +++++++++++----------- docs/hardware_keyboard_guidelines.md | 14 +++++++------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build_keyboard.mk b/build_keyboard.mk index df32a9c724f2..a3b2ce7c4d83 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -322,21 +322,21 @@ endif # Disable features that a keyboard doesn't support -include disable_features.mk -# Pull in keyboard_features.mk files from all our subfolders -ifneq ("$(wildcard $(KEYBOARD_PATH_1)/keyboard_features.mk)","") - include $(KEYBOARD_PATH_1)/keyboard_features.mk +# Pull in post_rules.mk files from all our subfolders +ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_rules.mk)","") + include $(KEYBOARD_PATH_1)/post_rules.mk endif -ifneq ("$(wildcard $(KEYBOARD_PATH_2)/keyboard_features.mk)","") - include $(KEYBOARD_PATH_2)/keyboard_features.mk +ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_rules.mk)","") + include $(KEYBOARD_PATH_2)/post_rules.mk endif -ifneq ("$(wildcard $(KEYBOARD_PATH_3)/keyboard_features.mk)","") - include $(KEYBOARD_PATH_3)/keyboard_features.mk +ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_rules.mk)","") + include $(KEYBOARD_PATH_3)/post_rules.mk endif -ifneq ("$(wildcard $(KEYBOARD_PATH_4)/keyboard_features.mk)","") - include $(KEYBOARD_PATH_4)/keyboard_features.mk +ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_rules.mk)","") + include $(KEYBOARD_PATH_4)/post_rules.mk endif -ifneq ("$(wildcard $(KEYBOARD_PATH_5)/keyboard_features.mk)","") - include $(KEYBOARD_PATH_5)/keyboard_features.mk +ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_rules.mk)","") + include $(KEYBOARD_PATH_5)/post_rules.mk endif # Object files directory diff --git a/docs/hardware_keyboard_guidelines.md b/docs/hardware_keyboard_guidelines.md index 3f2e327c4005..5166a61f43e6 100644 --- a/docs/hardware_keyboard_guidelines.md +++ b/docs/hardware_keyboard_guidelines.md @@ -144,23 +144,23 @@ The `rules.mk` file can also be placed in a sub-folder, and its reading order is * `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/rules.mk` * `keyboards/top_folder/keymaps/a_keymap/rules.mk` * `users/a_user_folder/rules.mk` - * `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/keyboard_features.mk` - * `keyboards/top_folder/sub_1/sub_2/sub_3/keyboard_features.mk` - * `keyboards/top_folder/sub_1/sub_2/keyboard_features.mk` - * `keyboards/top_folder/sub_1/keyboard_features.mk` -* `keyboards/top_folder/keyboard_features.mk` + * `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/post_rules.mk` + * `keyboards/top_folder/sub_1/sub_2/sub_3/post_rules.mk` + * `keyboards/top_folder/sub_1/sub_2/post_rules.mk` + * `keyboards/top_folder/sub_1/post_rules.mk` +* `keyboards/top_folder/post_rules.mk` * `common_features.mk` Many of the settings written in the `rules.mk` file are interpreted by `common_features.mk`, which sets the necessary source files and compiler options. -The `keyboard_features.mk` file can interpret `features` of a keyboard-level before `common_features.mk`. For example, when your designed keyboard has the option to implement backlighting or underglow using rgblight.c, writing the following in the `keyboard_features.mk` makes it easier for the user to configure the `rules.mk`. +The `post_rules.mk` file can interpret `features` of a keyboard-level before `common_features.mk`. For example, when your designed keyboard has the option to implement backlighting or underglow using rgblight.c, writing the following in the `post_rules.mk` makes it easier for the user to configure the `rules.mk`. * `keyboards/top_folder/keymaps/a_keymap/rules.mk` ```makefile # Please set the following according to the selection of the hardware implementation option. RGBLED_OPTION_TYPE = backlight ## none, backlight or underglow ``` -* `keyboards/top_folder/keyboard_features.mk` +* `keyboards/top_folder/post_rules.mk` ```makefile ifeq ($(filter $(strip $(RGBLED_OPTION_TYPE))x, nonex backlightx underglowx x),) $(error unknown RGBLED_OPTION_TYPE value "$(RGBLED_OPTION_TYPE)")