summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-03-04 15:09:22 +1100
committerGitHub <noreply@github.com>2021-03-04 15:09:22 +1100
commit6461087c865bc4af30ac8521af9db785afb662a0 (patch)
tree008e8a5d4d93c4046319d9b8bf5107a8e8634934
parent7aa74c227b03e882915b184d07a5e31c9d720710 (diff)
`qmk generate-rules-mk`: add `--escape` switch for makefile logic (#12101)
-rw-r--r--build_keyboard.mk2
-rwxr-xr-xlib/python/qmk/cli/generate/rules_mk.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/build_keyboard.mk b/build_keyboard.mk
index b2a152bb98..366d1f5d2f 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -97,7 +97,7 @@ MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
# Pull in rules from info.json
-INFO_RULES_MK = $(shell bin/qmk generate-rules-mk --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk)
+INFO_RULES_MK = $(shell bin/qmk generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk)
include $(INFO_RULES_MK)
# Check for keymap.json first, so we can regenerate keymap.c
diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py
index c21ab50906..15917987b9 100755
--- a/lib/python/qmk/cli/generate/rules_mk.py
+++ b/lib/python/qmk/cli/generate/rules_mk.py
@@ -36,6 +36,7 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict):
@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to')
@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
+@cli.argument('-e', '--escape', arg_only=True, action='store_true', help="Escape spaces in quiet mode")
@cli.argument('-kb', '--keyboard', help='Keyboard to generate config.h for.')
@cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True)
@automagic_keyboard
@@ -83,7 +84,10 @@ def generate_rules_mk(cli):
cli.args.output.write_text(rules_mk)
if cli.args.quiet:
- print(cli.args.output)
+ if cli.args.escape:
+ print(cli.args.output.as_posix().replace(' ', '\\ '))
+ else:
+ print(cli.args.output)
else:
cli.log.info('Wrote rules.mk to %s.', cli.args.output)