[build] Allow for generation of all release information

Allow for automatic generation of the release name, release title, and
release notes (derived from the relevant section of the changelog).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2026-02-20 14:53:30 +00:00
parent a82e0b41af
commit 9e0057a864
4 changed files with 120 additions and 5 deletions
+2
View File
@@ -57,6 +57,8 @@ GENKEYMAP := ./util/genkeymap.py
DOXYGEN := doxygen
LCAB := lcab
QEMUIMG := qemu-img
PANDOC := pandoc
ENVSUBST := envsubst
###############################################################################
#
+63 -5
View File
@@ -1094,11 +1094,6 @@ $(BIN)/NIC : $(AUTO_DEPS)
@perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@
CLEANUP += $(BIN)/NIC # Doesn't match the $(BIN)/*.* pattern
# Generate version number record
#
$(BIN)/version.txt : $(MAKEDEPS)
@$(ECHO) "$(VERSION)" > $@
# Analyse a target name (e.g. "bin/dfe538--prism2_pci.rom.tmp") and
# derive the variables:
#
@@ -1616,6 +1611,69 @@ $(BIN)/%.bxs : $(BIN)/%.tmp
endif # defined(BIN)
###############################################################################
#
# Versioning
#
ifdef BIN
REPOURL := https://github.com/ipxe/ipxe
ifeq ($(EXTRAVERSION),)
RELNAME := v$(firstword $(VERSION))
CLMARKER := [$(RELNAME)]
SRCNAME := ipxe-$(firstword $(VERSION))
SRCURL := $(REPOURL)/archive/$(RELNAME)
BINURL := $(REPOURL)/releases/download/$(RELNAME)
else
RELNAME :=
CLMARKER := [Unreleased]
SRCNAME := ipxe
SRCURL := $(REPOURL)/archive/$(GITVERSION)
BINURL := https://boot.ipxe.org
endif
# Generate version number record
#
$(BIN)/version.txt : $(MAKEDEPS)
$(QM)$(ECHO) " [VERSION] $@"
$(Q)$(ECHO) "$(VERSION)" > $@
# Generate release name
#
$(BIN)/relname.txt : $(MAKEDEPS)
$(QM)$(ECHO) " [RELNAME] $@"
$(Q)$(ECHO) "$(RELNAME)" > $@
# Generate changelog section
#
$(BIN)/changes.md : ../CHANGELOG.md $(MAKEDEPS)
$(QM)$(ECHO) " [CHANGES] $@"
$(Q)$(PANDOC) -f gfm -t gfm --columns 10000 $< | \
awk -v RS='\n\n## ' -v marker='$(CLMARKER)' \
'index ( $$0, marker ) == 1 { print }' > $@
$(Q)if [ ! -s $@ ] ; then \
echo "Missing $(CLMARKER) in $<" >&2 ; \
exit 1 ; \
fi
# Generate release title
#
$(BIN)/reltitle.txt : $(BIN)/changes.md $(MAKEDEPS)
$(QM)$(ECHO) " [RELTITLE] $@"
$(Q)head -1 $< | sed -E \
's/^\[(.*)\]\(.+\)\s+(.+)$$/\1 (\2)/; t; s/^\[(.*)\].*$$/\1/' > $@
# Generate release notes
#
$(BIN)/relnotes.md : ../RELNOTES.tmpl.md $(BIN)/changes.md $(MAKEDEPS)
$(QM)$(ECHO) " [RELNOTES] $@"
$(Q)( cat ../RELNOTES.tmpl.md ; tail -n +2 $(BIN)/changes.md ) | \
SRCNAME="$(SRCNAME)" SRCURL="$(SRCURL)" BINURL="$(BINURL)" \
$(ENVSUBST) '$$SRCNAME $$SRCURL $$BINURL' > $@
endif # defined(BIN)
###############################################################################
#
# Documentation