Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure version.h is recreated each build. #16188

Merged
merged 1 commit into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions build_keyboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ ifdef SKIP_GIT
VERSION_H_FLAGS := --skip-git
endif

# Generate the board's version.h file.
$(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h)

# Determine which subfolders exist.
KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
Expand Down Expand Up @@ -165,13 +168,8 @@ generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c

endif

generated-files: $(KEYMAP_OUTPUT)/src/version.h
$(KEYMAP_OUTPUT)/src/version.h:
[ -d $(KEYMAP_OUTPUT)/src ] || mkdir -p $(KEYMAP_OUTPUT)/src
$(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h

ifeq ($(strip $(CTPC)), yes)
CONVERT_TO_PROTON_C=yes
CONVERT_TO_PROTON_C=yes
endif

ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
Expand Down Expand Up @@ -397,6 +395,7 @@ VPATH += $(KEYMAP_PATH)
VPATH += $(USER_PATH)
VPATH += $(KEYBOARD_PATHS)
VPATH += $(COMMON_VPATH)
VPATH += $(KEYBOARD_OUTPUT)/src
VPATH += $(KEYMAP_OUTPUT)/src

include common_features.mk
Expand Down
3 changes: 3 additions & 0 deletions lib/python/qmk/cli/generate/version_h.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def generate_version_h(cli):
version_h = create_version_h(cli.args.skip_git, cli.args.skip_all)

if cli.args.output:
cli.args.output.parent.mkdir(parents=True, exist_ok=True)
if cli.args.output.exists():
cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak'))
cli.args.output.write_text(version_h)

if not cli.args.quiet:
Expand Down