summaryrefslogtreecommitdiffstats
path: root/maint/Makefile.am
blob: bfdbfaf234a7998e9f901db2489fcd1ade51e601 (plain)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#
# Copyright 2019-2023 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#

# Define release-related variables
include $(abs_srcdir)/../mk/release.mk

noinst_SCRIPTS		= bumplibs
EXTRA_DIST		= README

#
# Change log generation
#

# Count changes in these directories
CHANGELOG_DIRS = ../include 	\
		 ../lib 	\
		 ../daemons 	\
		 ../tools 	\
		 ../xml

.PHONY: require_last_release
require_last_release:
	@if [ -z "$(CHECKOUT)" ]; then					\
		echo "This target must be run from a git checkout";	\
		exit 1;							\
	elif ! "$(GIT)" rev-parse $(LAST_RELEASE) >/dev/null 2>&1; then	\
		echo "LAST_RELEASE must be set to a valid git tag";	\
		exit 1;							\
	fi

.PHONY: summary
summary: require_last_release
	@printf "* %s %s <%s> %s\n" "$$(date +'%a %b %d %Y')"		\
		"$$("$(GIT)" config user.name)"				\
		"$$("$(GIT)" config user.email)"			\
		"$(NEXT_RELEASE)"
	@printf "\055 %d commits with%s\n"				\
		"$$("$(GIT)" log --pretty=oneline --no-merges		\
			$(LAST_RELEASE)..HEAD | wc -l)"			\
		"$$("$(GIT)" diff $(LAST_RELEASE)..HEAD --shortstat	\
			$(CHANGELOG_DIRS))"

.PHONY: changes
changes: summary
	@printf "\n- Features added since $(LAST_RELEASE)\n"
	@"$(GIT)" log --pretty=format:'%s' --no-merges			\
		--abbrev-commit $(LAST_RELEASE)..HEAD			\
		| sed -n -e 's/^ *Feature: */  + /p' | sort -uf
	@printf "\n- Fixes since $(LAST_RELEASE)\n"
	@"$(GIT)" log --pretty=format:'%s' --no-merges			\
		--abbrev-commit $(LAST_RELEASE)..HEAD			\
		| sed -n -e 's/^ *\(Fix\|High\|Bug\): */  + /p' | sed	\
		-e 's/\(cib\|pacemaker-based\|based\):/CIB:/'		\
		-e 's/\(lrmd\|pacemaker-execd\|execd\):/executor:/'	\
		-e 's/\(crmd\|pacemaker-controld\|controld\):/controller:/'		\
		-e 's/\(Fencing\|stonithd?\|pacemaker-fenced\|fenced\):/fencing:/'	\
		-e 's/\(PE\|pengine\|pacemaker-schedulerd\|schedulerd\):/scheduler:/'	\
		| sort -uf
	@printf "\n- Public API changes since $(LAST_RELEASE)\n"
	@"$(GIT)" log --pretty=format:'%s' --no-merges			\
		--abbrev-commit $(LAST_RELEASE)..HEAD			\
		| sed -n -e 's/^ *API: */  + /p' | sort -uf

.PHONY: changelog
changelog: require_last_release
	@printf "%s\n\n%s\n"						\
		"$$($(MAKE) $(AM_MAKEFLAGS) changes			\
			| grep -v 'make\(\[[0-9]*\]\)\?:')"		\
		"$$(cat ../ChangeLog)" > ../ChangeLog

.PHONY: authors
authors: require_last_release
	"$(GIT)" log $(LAST_RELEASE)..$(COMMIT) --format='%an' | sort -u

#
# gnulib updates
#
# See https://www.gnu.org/software/gnulib/manual/html_node/
#

# V3	= scandir unsetenv alphasort xalloc
# V2	= setenv strerror strchrnul strndup
GNU_MODS	= crypto/md5-buffer
# stdint appears to be surrogate only for C99-lacking environments
GNU_MODS_AVOID	= stdint

.PHONY: gnulib-update
gnulib-update:
	@echo 'Newer versions of gnulib require automake 1.14'
	@echo 'Pacemaker cannot update until minimum supported automake is 1.14'
	@exit 1
	if test -e gnulib; then							\
		cd gnulib && "$(GIT)" pull;					\
	else									\
		"$(GIT)" clone https://git.savannah.gnu.org/git/gnulib.git	\
			gnulib							\
			&& cd gnulib && "$(GIT)" config pull.rebase false;	\
	fi
	cd $(top_srcdir) && maint/gnulib/gnulib-tool --source-base=lib/gnu 	\
		--lgpl=2 --no-vc-files --no-conditional-dependencies --libtool	\
		$(GNU_MODS_AVOID:%=--avoid %) --import $(GNU_MODS)
	cp -p ../rpm/pacemaker.spec.in ../rpm/pacemaker.spec.in.$$
	sed -e "s/bundled(gnulib).*/bundled(gnulib) = `date +'%Y%m%d'`/"	\
		../rpm/pacemaker.spec.in > ../rpm/pacemaker.spec.in.$$
	mv ../rpm/pacemaker.spec.in.$$ ../rpm/pacemaker.spec.in
	cp -p ../lib/gnu/md5.c ../lib/gnu/md5.c.$$
	sed -e "s/_GL_EXTERN_INLINE/_GL_INLINE/" 				\
		-e "s#left_over -= 64;#left_over \&= 63; /* helps static analysis */#"	\
		-e "s#&ctx->buffer\[16\]#\&(((char *) ctx->buffer)[64]) /* helps static analysis */#"	\
		../lib/gnu/md5.c > ../lib/gnu/md5.c.$$
	mv ../lib/gnu/md5.c.$$ ../lib/gnu/md5.c