Skip to content

Commit

Permalink
Migrate more makefile utilities to builddefs sub-directory (qmk#16002)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Feb 10, 2022
1 parent 7a0fd64 commit f7e7671
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ define PARSE_KEYMAP
# Specify the variables that we are passing forward to submake
MAKE_VARS := KEYBOARD=$$(CURRENT_KB) KEYMAP=$$(CURRENT_KM) REQUIRE_PLATFORM_KEY=$$(REQUIRE_PLATFORM_KEY) QMK_BIN=$$(QMK_BIN)
# And the first part of the make command
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_keyboard.mk $$(MAKE_TARGET)
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f $(BUILDDEFS_PATH)/build_keyboard.mk $$(MAKE_TARGET)
# The message to display
MAKE_MSG := $$(MSG_MAKE_KB)
# We run the command differently, depending on if we want more output or not
Expand Down Expand Up @@ -317,7 +317,7 @@ define BUILD_TEST
TEST_NAME := $$(notdir $$(TEST_PATH))
MAKE_TARGET := $2
COMMAND := $1
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_test.mk $$(MAKE_TARGET)
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f $(BUILDDEFS_PATH)/build_test.mk $$(MAKE_TARGET)
MAKE_VARS := TEST=$$(TEST_NAME) TEST_PATH=$$(TEST_PATH) FULL_TESTS="$$(FULL_TESTS)"
MAKE_MSG := $$(MSG_MAKE_TEST)
$$(eval $$(call BUILD))
Expand All @@ -339,7 +339,7 @@ define PARSE_TEST
TESTS :=
TEST_NAME := $$(firstword $$(subst :, ,$$(RULE)))
TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME):,,$$(RULE)))
include $(ROOT_DIR)/testlist.mk
include $(BUILDDEFS_PATH)/testlist.mk
ifeq ($$(TEST_NAME),all)
MATCHED_TESTS := $$(TEST_LIST)
else
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions build_keyboard.mk → builddefs/build_keyboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard
include $(INFO_RULES_MK)

# Check for keymap.json first, so we can regenerate keymap.c
include build_json.mk
include $(BUILDDEFS_PATH)/build_json.mk

# Pull in keymap level rules.mk
ifeq ("$(wildcard $(KEYMAP_PATH))", "")
Expand All @@ -138,7 +138,7 @@ ifeq ("$(wildcard $(KEYMAP_PATH))", "")
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
else ifneq ($(LAYOUTS),)
# If we haven't found a keymap yet fall back to community layouts
include build_layout.mk
include $(BUILDDEFS_PATH)/build_layout.mk
else
$(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
# this state should never be reached
Expand Down Expand Up @@ -398,7 +398,7 @@ VPATH += $(COMMON_VPATH)
VPATH += $(KEYBOARD_OUTPUT)/src
VPATH += $(KEYMAP_OUTPUT)/src

include common_features.mk
include $(BUILDDEFS_PATH)/common_features.mk
include $(BUILDDEFS_PATH)/generic_features.mk
include $(TMK_PATH)/protocol.mk
include $(PLATFORM_PATH)/common.mk
Expand Down Expand Up @@ -460,7 +460,7 @@ check-md5: build
objs-size: build

include $(BUILDDEFS_PATH)/show_options.mk
include $(TMK_PATH)/rules.mk
include $(BUILDDEFS_PATH)/common_rules.mk

# Ensure we have generated files available for each of the objects
define GEN_FILES
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions build_test.mk → builddefs/build_test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ include tests/test_common/build.mk
include $(TEST_PATH)/test.mk
endif

include common_features.mk
include $(BUILDDEFS_PATH)/common_features.mk
include $(BUILDDEFS_PATH)/generic_features.mk
include $(PLATFORM_PATH)/common.mk
include $(TMK_PATH)/protocol.mk
Expand All @@ -63,7 +63,7 @@ include $(QUANTUM_PATH)/encoder/tests/rules.mk
include $(QUANTUM_PATH)/sequencer/tests/rules.mk
include $(PLATFORM_PATH)/test/rules.mk
ifneq ($(filter $(FULL_TESTS),$(TEST)),)
include build_full_test.mk
include $(BUILDDEFS_PATH)/build_full_test.mk
endif

$(TEST)_SRC += \
Expand All @@ -77,7 +77,7 @@ $(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS)
$(TEST_OBJ)/$(TEST)_CONFIG := $($(TEST)_CONFIG)

include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
include $(TMK_PATH)/rules.mk
include $(BUILDDEFS_PATH)/common_rules.mk


$(shell mkdir -p $(BUILD_DIR)/test 2>/dev/null)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/python/qmk/cli/multibuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def multibuild(cli):
all: {keyboard_safe}_binary
{keyboard_safe}_binary:
@rm -f "{QMK_FIRMWARE}/.build/failed.log.{keyboard_safe}" || true
+@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false {' '.join(cli.args.env)} \\
+@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/builddefs/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false {' '.join(cli.args.env)} \\
>>"{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" 2>&1 \\
|| cp "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" "{QMK_FIRMWARE}/.build/failed.log.{os.getpid()}.{keyboard_safe}"
@{{ grep '\[ERRORS\]' "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\\n" "{keyboard_name}:{cli.args.keymap}" ; }} \\
Expand Down
2 changes: 1 addition & 1 deletion lib/python/qmk/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va
'-r',
'-R',
'-f',
'build_keyboard.mk',
'builddefs/build_keyboard.mk',
])

if bootloader:
Expand Down
4 changes: 3 additions & 1 deletion paths.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
TOP_DIR = .
TMK_DIR = tmk_core
TMK_PATH = $(TMK_DIR)
LIB_PATH = lib

LIB_DIR = lib
LIB_PATH = $(LIB_DIR)

QUANTUM_DIR = quantum
QUANTUM_PATH = $(QUANTUM_DIR)
Expand Down

0 comments on commit f7e7671

Please sign in to comment.