SHELL := /bin/bash -eo pipefail
.SECONDARY:
BUILDDIR ?= ./build
SRCDIR ?= .
.PHONY: help
help:
@ @ @echo "make [TARGETS...]"
@echo
@echo "The following targets are provided by this maintenance makefile:"
@echo
@echo " help: Print this usage information"
@echo
@echo " publish-github: Publish a release to GitHub"
$(BUILDDIR)/:
mkdir -p "$@"
$(BUILDDIR)/%/:
mkdir -p "$@"
.PHONY: FORCE
FORCE:
PUBLISH_REPO ?= r-efi/r-efi
PUBLISH_VERSION ?=
define PUBLISH_RELNOTES_PY
with open('NEWS.md', 'r') as f:
notes = f.read().split("\n## CHANGES WITH ")[1:]
notes = dict(map(lambda v: (v[:v.find(":")], v), notes))
notes = notes["$(PUBLISH_VERSION)"].strip()
print(" # r-efi - UEFI Reference Specification Protocol Constants and Definitions\n")
print(" ## CHANGES WITH", notes)
endef
export PUBLISH_RELNOTES_PY
export PUBLISH_REPO
export PUBLISH_VERSION
.PHONY: publish-github
publish-github:
test ! -z "$${PUBLISH_REPO}"
test ! -z "$${PUBLISH_VERSION}"
python \
- \
<<<"$${PUBLISH_RELNOTES_PY}" \
| gh \
release \
--repo "$${PUBLISH_REPO}" \
create \
--verify-tag \
--title \
"r-efi-$${PUBLISH_VERSION}" \
--notes-file - \
"v$${PUBLISH_VERSION}"