1
0
Fork 0

Ensure version.h is recreated each build. (#16188)

This commit is contained in:
Nick Brassel 2022-02-04 07:36:02 +11:00 committed by GitHub
parent 57a78b68de
commit db43e45077
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -45,6 +45,9 @@ ifdef SKIP_GIT
VERSION_H_FLAGS := --skip-git VERSION_H_FLAGS := --skip-git
endif 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. # Determine which subfolders exist.
KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD) KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1))) KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
@ -165,13 +168,8 @@ generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c
endif 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) ifeq ($(strip $(CTPC)), yes)
CONVERT_TO_PROTON_C=yes CONVERT_TO_PROTON_C=yes
endif endif
ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes) ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
@ -397,6 +395,7 @@ VPATH += $(KEYMAP_PATH)
VPATH += $(USER_PATH) VPATH += $(USER_PATH)
VPATH += $(KEYBOARD_PATHS) VPATH += $(KEYBOARD_PATHS)
VPATH += $(COMMON_VPATH) VPATH += $(COMMON_VPATH)
VPATH += $(KEYBOARD_OUTPUT)/src
VPATH += $(KEYMAP_OUTPUT)/src VPATH += $(KEYMAP_OUTPUT)/src
include common_features.mk include common_features.mk

View file

@ -20,6 +20,9 @@ def generate_version_h(cli):
version_h = create_version_h(cli.args.skip_git, cli.args.skip_all) version_h = create_version_h(cli.args.skip_git, cli.args.skip_all)
if cli.args.output: 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) cli.args.output.write_text(version_h)
if not cli.args.quiet: if not cli.args.quiet: