]>
Commit | Line | Data |
---|---|---|
9a1955a7 JF |
1 | # Copyright (c) 2009 Red Hat, Inc. |
2 | # | |
3 | # Authors: Andrew Beekhof | |
4 | # Steven Dake (sdake@redhat.com) | |
5 | # | |
6 | # This software licensed under BSD license, the text of which follows: | |
7 | # | |
8 | # Redistribution and use in source and binary forms, with or without | |
9 | # modification, are permitted provided that the following conditions are met: | |
10 | # | |
11 | # - Redistributions of source code must retain the above copyright notice, | |
12 | # this list of conditions and the following disclaimer. | |
13 | # - Redistributions in binary form must reproduce the above copyright notice, | |
14 | # this list of conditions and the following disclaimer in the documentation | |
15 | # and/or other materials provided with the distribution. | |
16 | # - Neither the name of the Red Hat, Inc. nor the names of its | |
17 | # contributors may be used to endorse or promote products derived from this | |
18 | # software without specific prior written permission. | |
19 | # | |
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
21 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
24 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
25 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
26 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
28 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
30 | # THE POSSIBILITY OF SUCH DAMAGE. | |
31 | ||
32 | SPEC = $(PACKAGE_NAME).spec | |
33 | ||
34 | TARFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz | |
35 | ||
36 | EXTRA_DIST = autogen.sh $(SPEC).in \ | |
37 | build-aux/git-version-gen \ | |
38 | build-aux/gitlog-to-changelog \ | |
39 | build-aux/release.mk \ | |
40 | .version | |
41 | ||
42 | ACLOCAL_AMFLAGS = -I m4 | |
43 | ||
44 | MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \ | |
45 | config.guess config.sub missing install-sh \ | |
46 | autoheader automake autoconf \ | |
47 | autoscan.log configure.scan ltmain.sh test-driver | |
48 | ||
49 | dist_doc_DATA = LICENSE | |
50 | ||
cc7f23cf FDN |
51 | pkgconfigdir = ${prefix}/share/pkgconfig |
52 | pkgconfig_DATA = corosync-qdevice.pc | |
53 | ||
9a1955a7 JF |
54 | SUBDIRS = qdevices man init |
55 | ||
56 | install-exec-local: | |
57 | if BUILD_QNETD | |
58 | $(INSTALL) -m 770 -d $(DESTDIR)/${localstatedir}/run/corosync-qnetd | |
59 | $(INSTALL) -m 770 -d $(DESTDIR)/${COROSYSCONFDIR}/qnetd | |
60 | endif | |
61 | if BUILD_QDEVICES | |
62 | $(INSTALL) -m 770 -d $(DESTDIR)/${localstatedir}/run/corosync-qdevice | |
63 | $(INSTALL) -d $(DESTDIR)/${COROSYSCONFDIR}/qdevice/ | |
64 | $(INSTALL) -m 770 -d $(DESTDIR)/${COROSYSCONFDIR}/qdevice/net | |
65 | endif | |
66 | ||
67 | uninstall-local: | |
68 | if BUILD_QNETD | |
69 | rmdir $(DESTDIR)/${localstatedir}/run/corosync-qnetd || :; | |
70 | rmdir $(DESTDIR)/${COROSYSCONFDIR}/qnetd || :; | |
71 | endif | |
72 | if BUILD_QDEVICES | |
73 | rmdir $(DESTDIR)/${localstatedir}/run/corosync-qdevice || :; | |
74 | rmdir $(DESTDIR)/${COROSYSCONFDIR}/qdevice/net || :; | |
75 | rmdir $(DESTDIR)/${COROSYSCONFDIR}/qdevice/ || :; | |
76 | endif | |
77 | ||
78 | dist-clean-local: | |
79 | rm -f autoconf automake autoheader | |
80 | ||
81 | clean-generic: | |
82 | rm -rf doc/api $(SPEC) $(TARFILE) | |
83 | ||
84 | ## make rpm/srpm section. | |
85 | ||
86 | $(SPEC): $(SPEC).in | |
87 | rm -f $@-t $@ | |
88 | date="$(shell LC_ALL=C date "+%a %b %d %Y")" && \ | |
c4512f39 JF |
89 | gvgver="`cd $(abs_srcdir); build-aux/git-version-gen --fallback $(VERSION) .tarball-version .gitarchivever`" && \ |
90 | if [ "$$gvgver" = "`echo $$gvgver | sed 's/-/./'`" ];then \ | |
91 | rpmver="$$gvgver" && \ | |
9a1955a7 JF |
92 | alphatag="" && \ |
93 | dirty="" && \ | |
c4512f39 | 94 | numcomm="0"; \ |
9a1955a7 | 95 | else \ |
c4512f39 JF |
96 | gitver="`echo $$gvgver | sed 's/\(.*\)\./\1-/'`" && \ |
97 | rpmver=`echo $$gitver | sed 's/-.*//g'` && \ | |
98 | alphatag=`echo $$gvgver | sed 's/[^-]*-\([^-]*\).*/\1/'` && \ | |
99 | numcomm=`echo $$gitver | sed 's/[^-]*-\([^-]*\).*/\1/'` && \ | |
100 | dirty="" && \ | |
101 | if [ "`echo $$gitver | sed 's/^.*-dirty$$//g'`" = "" ];then \ | |
102 | dirty="dirty"; \ | |
103 | fi \ | |
9a1955a7 | 104 | fi && \ |
c4512f39 | 105 | if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \ |
9a1955a7 JF |
106 | if [ "$$numcomm" = "0" ]; then numcomm=""; fi && \ |
107 | if [ -n "$$numcomm" ]; then numcomm="%global numcomm $$numcomm"; fi && \ | |
108 | if [ "$$alphatag" = "$$gitver" ]; then alphatag=""; fi && \ | |
109 | if [ -n "$$alphatag" ]; then alphatag="%global alphatag $$alphatag"; fi && \ | |
110 | if [ -n "$$dirty" ]; then dirty="%global dirty dirty"; fi && \ | |
111 | sed \ | |
112 | -e "s#@version@#$$rpmver#g" \ | |
113 | -e "s#@ALPHATAG@#$$alphatag#g" \ | |
114 | -e "s#@NUMCOMM@#$$numcomm#g" \ | |
115 | -e "s#@DIRTY@#$$dirty#g" \ | |
116 | -e "s#@date@#$$date#g" \ | |
eae6806f | 117 | $< > $@-t |
c6548f40 JF |
118 | if BUILD_USERFLAGS |
119 | sed -i -e "s#@bcond_userflags@#bcond_without#g" $@-t | |
120 | else | |
121 | sed -i -e "s#@bcond_userflags@#bcond_with#g" $@-t | |
122 | endif | |
eae6806f JF |
123 | if BUILD_RUNAUTOGEN |
124 | sed -i -e "s#@bcond_runautogen@#bcond_without#g" $@-t | |
125 | else | |
126 | sed -i -e "s#@bcond_runautogen@#bcond_with#g" $@-t | |
127 | endif | |
128 | if INSTALL_SYSTEMD | |
129 | sed -i -e "s#@bcond_systemd@#bcond_without#g" $@-t | |
130 | else | |
131 | sed -i -e "s#@bcond_systemd@#bcond_with#g" $@-t | |
132 | endif | |
9a1955a7 JF |
133 | chmod a-w $@-t |
134 | mv $@-t $@ | |
135 | ||
136 | $(TARFILE): | |
137 | $(MAKE) dist | |
138 | ||
139 | RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \ | |
140 | --define "_specdir $(abs_builddir)" \ | |
141 | --define "_builddir $(abs_builddir)" \ | |
142 | --define "_srcrpmdir $(abs_builddir)" \ | |
143 | --define "_rpmdir $(abs_builddir)" | |
144 | ||
145 | srpm: clean | |
146 | $(MAKE) $(SPEC) $(TARFILE) | |
f26ec675 | 147 | rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC) |
9a1955a7 JF |
148 | |
149 | rpm: clean _version | |
150 | $(MAKE) $(SPEC) $(TARFILE) | |
f26ec675 | 151 | rpmbuild $(RPMBUILDOPTS) -ba $(SPEC) |
9a1955a7 JF |
152 | |
153 | # release/versioning | |
154 | BUILT_SOURCES = .version | |
155 | .version: | |
156 | echo $(VERSION) > $@-t && mv $@-t $@ | |
157 | ||
158 | dist-hook: gen-ChangeLog | |
159 | echo $(VERSION) > $(distdir)/.tarball-version | |
160 | ||
161 | gen_start_date = 2000-01-01 | |
162 | .PHONY: gen-ChangeLog _version | |
163 | gen-ChangeLog: | |
164 | if test -d .git; then \ | |
165 | LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog \ | |
166 | --since=$(gen_start_date) > $(distdir)/cl-t; \ | |
167 | rm -f $(distdir)/ChangeLog; \ | |
168 | mv $(distdir)/cl-t $(distdir)/ChangeLog; \ | |
169 | fi | |
170 | ||
171 | _version: | |
172 | cd $(srcdir) && rm -rf autom4te.cache .version && autoreconf -i | |
173 | $(MAKE) $(AM_MAKEFLAGS) Makefile | |
174 | ||
175 | maintainer-clean-local: | |
176 | rm -rf m4 |