From cbc065666897ce7ae66a4e7d30c88211537f6148 Mon Sep 17 00:00:00 2001 From: Thomas Huber <113915837+huber-th@users.noreply.github.com> Date: Mon, 5 Feb 2024 01:55:24 -0800 Subject: Makefile enhancements to optimize local workflows (#363) - Enhance the Makefile to enable firmware building exclusively for the left side. To modify the keymap, flashing only the left side's firmware suffices. This change facilitates the creation of firmware for the left side only, thereby expediting the build process. Usage: make left This update maintains existing functionality. Without specifying the left target, firmware for both halves will be generated. - Add separate make targets to clean firmware and docker image Add targets clean_firmware and clean_image independently while maintaing clean to run both - Ensure files modified by the build process are reset at the end The current build process dynamically generates the content of the version macro in config/version.dtsi to enable users to print out the precise version and commit the firmware was built on via a keybinding on the keymap. This change ensurs that the changes to this macro file are reset at the end of the build process to ensure it isn't shown as modified and added to keymap commit changes. --- Makefile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 39d09d3..9d7d347 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ SELINUX1 := :z SELINUX2 := ,z endif -.PHONY: all clean +.PHONY: all left clean_firmware clean_image clean all: $(shell bin/get_version.sh >> /dev/null) @@ -20,8 +20,26 @@ all: -v $(PWD)/config:/app/config:ro$(SELINUX2) \ -e TIMESTAMP=$(TIMESTAMP) \ -e COMMIT=$(COMMIT) \ + -e BUILD_RIGHT=true \ zmk + $(shell git checkout config/version.dtsi) -clean: +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 + $(shell 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 -- cgit v1.2.3