From 1e723e66475324c800744739bf19153d561ddd67 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 14 Feb 2022 09:46:17 +1100 Subject: [PATCH] Output logging. --- builddefs/build_keyboard.mk | 44 ++++++++++++------------------------ builddefs/common_features.mk | 4 ++++ builddefs/message.mk | 1 + builddefs/xap.mk | 28 +++++++++++++++++++++++ 4 files changed, 48 insertions(+), 29 deletions(-) create mode 100644 builddefs/xap.mk diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk index 3e9e4bcb78..44acd964cc 100644 --- a/builddefs/build_keyboard.mk +++ b/builddefs/build_keyboard.mk @@ -159,10 +159,14 @@ ifneq ("$(wildcard $(KEYMAP_JSON))", "") # Add rules to generate the keymap files - indentation here is important $(KEYMAP_OUTPUT)/src/keymap.c: $(KEYMAP_JSON) - $(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON) + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + $(eval CMD=$(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)) + @$(BUILD_CMD) $(KEYMAP_OUTPUT)/src/config.h: $(KEYMAP_JSON) - $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_H) + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + $(eval CMD=$(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_H)) + @$(BUILD_CMD) generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c @@ -326,13 +330,19 @@ endif CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h $(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES) - $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + $(eval CMD=$(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h) + @$(BUILD_CMD) $(KEYBOARD_OUTPUT)/src/default_keyboard.h: $(INFO_JSON_FILES) - $(QMK_BIN) generate-keyboard-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/default_keyboard.h + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + $(eval CMD=$(QMK_BIN) generate-keyboard-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/default_keyboard.h) + @$(BUILD_CMD) $(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES) - $(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + $(eval CMD=$(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h) + @$(BUILD_CMD) generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/default_keyboard.h $(KEYBOARD_OUTPUT)/src/layouts.h @@ -399,30 +409,6 @@ VPATH += $(KEYBOARD_OUTPUT)/src VPATH += $(KEYMAP_OUTPUT)/src include $(BUILDDEFS_PATH)/common_features.mk - -# XAP embedded info.json -ifeq ($(strip $(XAP_ENABLE)), yes) - -$(KEYMAP_OUTPUT)/src/info_json_gz.h: $(INFO_JSON_FILES) - mkdir -p $(KEYMAP_OUTPUT)/src - $(QMK_BIN) info -f json -kb $(KEYBOARD) -km $(KEYMAP) | gzip -c9 > $(KEYMAP_OUTPUT)/src/info.json.gz - cd $(KEYMAP_OUTPUT)/src >/dev/null 2>&1 \ - && xxd -i info.json.gz info_json_gz.h \ - && cd - >/dev/null 2>&1 - -XAP_FILES := $(shell ls -1 data/xap/* | sort | xargs echo) - -$(KEYMAP_OUTPUT)/src/xap_generated.inl: $(XAP_FILES) - $(QMK_BIN) xap-generate-qmk-inc -o "$(KEYMAP_OUTPUT)/src/xap_generated.inl" - -$(KEYMAP_OUTPUT)/src/xap_generated.h: $(XAP_FILES) - $(QMK_BIN) xap-generate-qmk-h -o "$(KEYMAP_OUTPUT)/src/xap_generated.h" -kb $(KEYBOARD) - -generated-files: $(KEYMAP_OUTPUT)/src/info_json_gz.h $(KEYMAP_OUTPUT)/src/xap_generated.inl $(KEYMAP_OUTPUT)/src/xap_generated.h - -VPATH += $(KEYMAP_OUTPUT)/src -endif - include $(BUILDDEFS_PATH)/generic_features.mk include $(TMK_PATH)/protocol.mk include $(PLATFORM_PATH)/common.mk diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index cbff9fa4fa..63a5d57ec2 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -45,6 +45,10 @@ else ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), api) OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE endif +ifeq ($(strip $(XAP_ENABLE)), yes) + include $(BUILDDEFS_PATH)/xap.mk +endif + AUDIO_ENABLE ?= no ifeq ($(strip $(AUDIO_ENABLE)), yes) ifeq ($(PLATFORM),CHIBIOS) diff --git a/builddefs/message.mk b/builddefs/message.mk index d441f560be..07d0e07ce8 100644 --- a/builddefs/message.mk +++ b/builddefs/message.mk @@ -63,6 +63,7 @@ MSG_COMPILING_CXX = Compiling: MSG_ASSEMBLING = Assembling: MSG_CLEANING = Cleaning project: MSG_CREATING_LIBRARY = Creating library: +MSG_GENERATING = Generating: MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\ Please consider running $(BOLD)make git-submodule$(NO_COLOR).\n\n MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR) diff --git a/builddefs/xap.mk b/builddefs/xap.mk new file mode 100644 index 0000000000..c2ccf14541 --- /dev/null +++ b/builddefs/xap.mk @@ -0,0 +1,28 @@ +# Copyright 2022 Nick Brassel (@tzarc) +# SPDX-License-Identifier: GPL-2.0-or-later + +# XAP embedded info.json +$(KEYMAP_OUTPUT)/src/info_json_gz.h: $(INFO_JSON_FILES) + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + mkdir -p $(KEYMAP_OUTPUT)/src + $(eval CMD=$(QMK_BIN) info -f json -kb $(KEYBOARD) -km $(KEYMAP) | gzip -c9 > $(KEYMAP_OUTPUT)/src/info.json.gz \ + && cd $(KEYMAP_OUTPUT)/src >/dev/null 2>&1 \ + && xxd -i info.json.gz info_json_gz.h \ + && cd - >/dev/null 2>&1) + @$(BUILD_CMD) + +XAP_FILES := $(shell ls -1 data/xap/* | sort | xargs echo) + +$(KEYMAP_OUTPUT)/src/xap_generated.inl: $(XAP_FILES) + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + $(eval CMD=$(QMK_BIN) xap-generate-qmk-inc -o "$(KEYMAP_OUTPUT)/src/xap_generated.inl") + @$(BUILD_CMD) + +$(KEYMAP_OUTPUT)/src/xap_generated.h: $(XAP_FILES) + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + $(eval CMD=$(QMK_BIN) xap-generate-qmk-h -o "$(KEYMAP_OUTPUT)/src/xap_generated.h" -kb $(KEYBOARD)) + @$(BUILD_CMD) + +generated-files: $(KEYMAP_OUTPUT)/src/info_json_gz.h $(KEYMAP_OUTPUT)/src/xap_generated.inl $(KEYMAP_OUTPUT)/src/xap_generated.h + +VPATH += $(KEYMAP_OUTPUT)/src