dd3da03b9d
In #376 a new step was introduced for local builds to undo changes to the version.dtsi file after a build in order to reduce noise to the repo. Unfortunately the way used to execute the step causes the version.dtsi file to be reset too early and therefore causes an incorrect version number to be used for the version macro when run locally. This went unfortunately undiscovered as the checked in version.dtsi was the same on the day the change in #376 was tested and was not noticed until I build a new change to my keymap locally a few days ago. The git command introduced in #376 is wrapped into a shell function. However what was missed is that commands run by the shell function are run when the function calls are expanded by make. This causes the version.dtsi file to be reset before the firmware build process is even started which resultes in the version.dtsi currently checked in to the repo to be used for local builds instead of the newly generated file when make starts. This change updates how the git command to reset the version.dtsi is being called. It is no longer called within a shell function to ensure it does run in the order it is defined after the firmware build is complete. Builds run through GitHub actions are not impacted and always used the correct version.dtsi For more information and context see: - https://www.gnu.org/software/make/manual/html_node/Shell-Function.html - https://www.gnu.org/software/make/manual/html_node/Reading-Makefiles.html
46 lines
1.2 KiB
Makefile
46 lines
1.2 KiB
Makefile
DOCKER := "$(shell { command -v podman || command -v docker; })"
|
|
TIMESTAMP := "$(shell date -u +"%Y%m%d%H%M")"
|
|
COMMIT := "$(shell git rev-parse --short HEAD 2>/dev/null)"
|
|
detected_OS := "$(shell uname)" # Classify UNIX OS
|
|
ifeq ($(strip $(detected_OS)),Darwin) #We only care if it's OS X
|
|
SELINUX1 :=
|
|
SELINUX2 :=
|
|
else
|
|
SELINUX1 := :z
|
|
SELINUX2 := ,z
|
|
endif
|
|
|
|
.PHONY: all left clean_firmware clean_image clean
|
|
|
|
all:
|
|
$(shell bin/get_version.sh >> /dev/null)
|
|
$(DOCKER) build --tag zmk --file Dockerfile .
|
|
$(DOCKER) run --rm -it --name zmk \
|
|
-v $(PWD)/firmware:/app/firmware$(SELINUX1) \
|
|
-v $(PWD)/config:/app/config:ro$(SELINUX2) \
|
|
-e TIMESTAMP=$(TIMESTAMP) \
|
|
-e COMMIT=$(COMMIT) \
|
|
-e BUILD_RIGHT=true \
|
|
zmk
|
|
git checkout config/version.dtsi
|
|
|
|
left:
|
|
$(shell bin/get_version.sh >> /dev/null)
|
|
$(DOCKER) build --tag zmk --file Dockerfile .
|
|
$(DOCKER) run --rm -it --name zmk \
|
|
-v $(PWD)/firmware:/app/firmware$(SELINUX1) \
|
|
-v $(PWD)/config:/app/config:ro$(SELINUX2) \
|
|
-e TIMESTAMP=$(TIMESTAMP) \
|
|
-e COMMIT=$(COMMIT) \
|
|
-e BUILD_RIGHT=false \
|
|
zmk
|
|
git checkout config/version.dtsi
|
|
|
|
clean_firmware:
|
|
rm -f firmware/*.uf2
|
|
|
|
clean_image:
|
|
$(DOCKER) image rm zmk docker.io/zmkfirmware/zmk-build-arm:stable
|
|
|
|
clean: clean_firmware clean_image
|