forked from r-efi/r-efi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (70 loc) · 1.61 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# Maintenance Makefile
#
# Enforce bash with fatal errors.
SHELL := /bin/bash -eo pipefail
# Keep intermediates around on failures for better caching.
.SECONDARY:
# Default build and source directories.
BUILDDIR ?= ./build
SRCDIR ?= .
#
# Target: help
#
.PHONY: help
help:
@# 80-width marker:
@# 01234567012345670123456701234567012345670123456701234567012345670123456701234567
@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"
#
# Target: BUILDDIR
#
$(BUILDDIR)/:
mkdir -p "$@"
$(BUILDDIR)/%/:
mkdir -p "$@"
#
# Target: FORCE
#
# Used as alternative to `.PHONY` if the target is not fixed.
#
.PHONY: FORCE
FORCE:
#
# Target: publish-*
#
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}"