Makefile: Add helper targets for `branch` and `tag`
Add `branch` and `tag` targets to assist maintaining a checked-in
`versioninfo.inc`. The version, for branch and tag names, is given
as RELEASE on the command line, e.g.
$ make branch RELEASE=1.0.x
Change-Id: Ieaa125e5168c5ce1d1aa3bb6857c648aa0c43ede
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71779
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/Makefile b/Makefile
index 135e425..dca47b7 100644
--- a/Makefile
+++ b/Makefile
@@ -334,7 +334,9 @@
SCMDEF := -D'FLASHROM_VERSION="$(VERSION)"'
# Inform user of the version string
+ifeq ($(filter branch tag,$(MAKECMDGOALS)), )
$(info Replacing all version templates with $(VERSION).)
+endif
###############################################################################
# Default settings of CONFIG_* variables.
@@ -1275,6 +1277,16 @@
@echo "VERSION = $(RELEASE)" > $@.inc
@echo "MAN_DATE = $(shell ./util/getrevision.sh --date $(PROGRAM).8.tmpl 2>/dev/null)" >> $@.inc
+branch: versioninfo
+ @git checkout -b $(RELEASE)
+ @git add -f $<.inc
+ @git commit -sm'Update version info for $(RELEASE)'
+
+tag: versioninfo
+ @git add -f $<.inc
+ @git commit -sm'Update version info for $(RELEASE)'
+ @git tag -s $(RELEASE)
+
# No spaces in release names unless set explicitly
RELEASENAME ?= $(shell echo "$(VERSION)" | sed -e 's/ /_/')
@@ -1323,7 +1335,7 @@
gitconfig:
./util/getrevision.sh -c 2>/dev/null && ./util/git-hooks/install.sh
-.PHONY: all install clean distclean compiler hwlibs features versioninfo _export export tarball featuresavailable libpayload gitconfig
+.PHONY: all install clean distclean compiler hwlibs features branch tag versioninfo _export export tarball featuresavailable libpayload gitconfig
# Disable implicit suffixes and built-in rules (for performance and profit)
.SUFFIXES: