-
Notifications
You must be signed in to change notification settings - Fork 15
/
GNUmakefile
161 lines (135 loc) · 5.87 KB
/
GNUmakefile
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#
# Copyright (C) 2008 Andrew Beekhof
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-include Makefile
PACKAGE ?= pacemaker
# Force 'make dist' to be consistent with 'make export'
distprefix = ClusterLabs-$(PACKAGE)
distdir = $(distprefix)-$(TAG)
TARFILE = $(distdir).tar.gz
DIST_ARCHIVES = $(TARFILE)
LAST_RELEASE ?= $(shell git tag -l | grep Pacemaker | sort -Vr | head -n 1)
NEXT_RELEASE ?= $(shell test -e /Volumes || git tag -l | grep Pacemaker | sort -Vr | head -n 1 | awk -F. '/[0-9]+\./{$$3+=1;OFS=".";print $$1,$$2,$$3}')
RPM_ROOT = $(shell pwd)
RPM_OPTS = --define "_sourcedir $(RPM_ROOT)" \
--define "_specdir $(RPM_ROOT)" \
--define "_srcrpmdir $(RPM_ROOT)" \
MOCK_OPTIONS ?= --resultdir=$(RPM_ROOT)/mock
# Default to fedora compliant spec files
# SLES: /etc/SuSE-release
# openSUSE: /etc/SuSE-release
# RHEL: /etc/redhat-release
# Fedora: /etc/fedora-release, /etc/redhat-release, /etc/system-release
getdistro = $(shell test -e /etc/SuSE-release || echo fedora; test -e /etc/SuSE-release && echo suse)
PROFILE ?= $(shell rpm --eval fedora-%{fedora}-%{_arch})
DISTRO ?= $(call getdistro)
TAG ?= $(shell git log --pretty="format:%h" -n 1)
WITH ?=
BUILD_COUNTER ?= build.counter
LAST_COUNT = $(shell test ! -e $(BUILD_COUNTER) && echo 0; test -e $(BUILD_COUNTER) && cat $(BUILD_COUNTER))
COUNT = $(shell expr 1 + $(LAST_COUNT))
initialize:
./autogen.sh
echo "Now run configure with any arguments (eg. --prefix) specific to your system"
export:
rm -f $(PACKAGE)-scratch.tar.* $(PACKAGE)-tip.tar.*
if [ ! -f $(TARFILE) ]; then \
rm -f $(PACKAGE).tar.*; \
if [ $(TAG) = scratch ]; then \
git commit -m "DO-NOT-PUSH" -a; \
git archive --prefix=$(distdir)/ HEAD | gzip > $(TARFILE); \
git reset --mixed HEAD^; \
else \
git archive --prefix=$(distdir)/ $(TAG) | gzip > $(TARFILE); \
fi; \
echo `date`: Rebuilt $(TARFILE); \
else \
echo `date`: Using existing tarball: $(TARFILE); \
fi
$(PACKAGE)-opensuse.spec: $(PACKAGE)-suse.spec
cp $^ $@
@echo Rebuilt $@
$(PACKAGE)-suse.spec: $(PACKAGE).spec.in
rm -f $@
cp $(PACKAGE).spec.in $@
sed -i.sed s:%{_docdir}/%{name}:%{_docdir}/%{name}-%{version}:g $@
sed -i.sed s:corosynclib:libcorosync:g $@
sed -i.sed s:pacemaker-libs:libpacemaker3:g $@
sed -i.sed s:heartbeat-libs:heartbeat:g $@
sed -i.sed s:cluster-glue-libs:libglue:g $@
sed -i.sed s:libselinux-devel:automake:g $@
sed -i.sed s:lm_sensors-devel:automake:g $@
sed -i.sed s:bzip2-devel:libbz2-devel:g $@
sed -i.sed s:Development/Libraries:Development/Libraries/C\ and\ C++:g $@
sed -i.sed s:System\ Environment/Daemons:Productivity/Clustering/HA:g $@
sed -i.sed s:bcond_without\ publican:bcond_with\ publican:g $@
sed -i.sed s:\#global\ py_sitedir:\%global\ py_sitedir:g $@
sed -i.sed s:docbook-style-xsl:docbook-xsl-stylesheets:g $@
sed -i.sed s:libtool-ltdl-devel::g $@
sed -i.sed s:libexecdir:libdir:g $@
@echo Rebuilt $@
# Works for all fedora based distros
$(PACKAGE)-%.spec: $(PACKAGE).spec.in
rm -f $@
cp $(PACKAGE).spec.in $(PACKAGE)-$*.spec
@echo Rebuilt $@
srpm-%: export $(PACKAGE)-%.spec
rm -f *.src.rpm $(PACKAGE).spec
cp $(PACKAGE)-$*.spec $(PACKAGE).spec
if [ -e $(BUILD_COUNTER) ]; then \
echo $(COUNT) > $(BUILD_COUNTER); \
fi
sed -i.sed 's/global\ specversion.*/global\ specversion\ $(COUNT)/' $(PACKAGE).spec; \
sed -i.sed 's/global\ upstream_version.*/global\ upstream_version\ $(TAG)/' $(PACKAGE).spec
sed -i.sed 's/global\ upstream_prefix.*/global\ upstream_prefix\ $(distprefix)/' $(PACKAGE).spec
rpmbuild -bs --define "dist .$*" $(RPM_OPTS) $(WITH) $(PACKAGE).spec
# eg. WITH="--with cman" make rpm
mock-%:
make srpm-$(firstword $(shell echo $(@:mock-%=%) | tr '-' ' '))
-rm -rf $(RPM_ROOT)/mock
mock --root=$* --rebuild $(WITH) $(MOCK_OPTIONS) $(RPM_ROOT)/*.src.rpm
srpm: srpm-$(DISTRO)
mock: mock-$(PROFILE)
rpm: srpm
@echo To create custom builds, edit the flags and options in $(PACKAGE).spec first
rpmbuild $(RPM_OPTS) $(WITH) --rebuild $(RPM_ROOT)/*.src.rpm
abi: abi-check $(LAST_RELEASE) $(TAG)
abi-www: abi-check -u $(LAST_RELEASE) $(TAG)
scratch:
make TAG=scratch mock
deb:
echo To make create custom builds, edit the configure flags in debian/rules first
dpkg-buildpackage -rfakeroot -us -uc
global: clean-generic
gtags -q
global-html: global
htags -sanhIT
global-www: global-html
rsync -avzxlSD --progress HTML/ [email protected]:/var/lib/global/$(PACKAGE)
changes:
@printf "\n* `date +"%a %b %d %Y"` `hg showconfig ui.username` $(NEXT_RELEASE)-1" > ChangeLog
@printf "\n- Update source tarball to revision: `git id`" >> ChangeLog
@printf "\n- Statistics:\n">> ChangeLog
@printf " Changesets: `git log --pretty=format:'%h' $(LAST_RELEASE)..HEAD | wc -l`\n" >> ChangeLog
@printf " Diff: " >> ChangeLog
@git diff -r $(LAST_RELEASE)..HEAD --stat | tail -n 1 >> ChangeLog
@printf "\n- Changes since $(LAST_RELEASE)\n" >> ChangeLog
@git log --pretty=format:' +%s' --abbrev-commit $(LAST_RELEASE)..HEAD | grep -e High: | sed -e s@High:@@ -e s@PE:@pengine:@ | sort -uf >> ChangeLog
@printf "\n">> ChangeLog
git show $(LAST_RELEASE):ChangeLog >> ChangeLog
rel-tags: tags
find . -name TAGS -exec sed -i.sed 's:\(.*\)/\(.*\)/TAGS:\2/TAGS:g' \{\} \;