1 # Copyright (c) 2009 Red Hat, Inc.
3 # Authors: Andrew Beekhof
4 # Steven Dake (sdake@redhat.com)
6 # This software licensed under BSD license, the text of which follows:
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
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.
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.
32 SPEC = $(PACKAGE_NAME).spec
34 TARFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz
36 EXTRA_DIST = autogen.sh $(SPEC).in \
37 build-aux/git-version-gen \
38 build-aux/gitlog-to-changelog \
39 build-aux/release.mk \
42 ACLOCAL_AMFLAGS = -I m4
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
49 dist_doc_DATA = LICENSE
51 SUBDIRS = qdevices man init
55 $(INSTALL) -m 770 -d $(DESTDIR)/${localstatedir}/run/corosync-qnetd
56 $(INSTALL) -m 770 -d $(DESTDIR)/${COROSYSCONFDIR}/qnetd
59 $(INSTALL) -m 770 -d $(DESTDIR)/${localstatedir}/run/corosync-qdevice
60 $(INSTALL) -d $(DESTDIR)/${COROSYSCONFDIR}/qdevice/
61 $(INSTALL) -m 770 -d $(DESTDIR)/${COROSYSCONFDIR}/qdevice/net
66 rmdir $(DESTDIR)/${localstatedir}/run/corosync-qnetd || :;
67 rmdir $(DESTDIR)/${COROSYSCONFDIR}/qnetd || :;
70 rmdir $(DESTDIR)/${localstatedir}/run/corosync-qdevice || :;
71 rmdir $(DESTDIR)/${COROSYSCONFDIR}/qdevice/net || :;
72 rmdir $(DESTDIR)/${COROSYSCONFDIR}/qdevice/ || :;
76 rm -f autoconf automake autoheader
79 rm -rf doc/api $(SPEC) $(TARFILE)
81 ## make rpm/srpm section.
85 date="$(shell LC_ALL=C date "+%a %b %d %Y")" && \
86 gvgver="`cd $(abs_srcdir); build-aux/git-version-gen --fallback $(VERSION) .tarball-version .gitarchivever`" && \
87 if [ "$$gvgver" = "`echo $$gvgver | sed 's/-/./'`" ];then \
88 rpmver="$$gvgver" && \
93 gitver="`echo $$gvgver | sed 's/\(.*\)\./\1-/'`" && \
94 rpmver=`echo $$gitver | sed 's/-.*//g'` && \
95 alphatag=`echo $$gvgver | sed 's/[^-]*-\([^-]*\).*/\1/'` && \
96 numcomm=`echo $$gitver | sed 's/[^-]*-\([^-]*\).*/\1/'` && \
98 if [ "`echo $$gitver | sed 's/^.*-dirty$$//g'`" = "" ];then \
102 if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \
103 if [ "$$numcomm" = "0" ]; then numcomm=""; fi && \
104 if [ -n "$$numcomm" ]; then numcomm="%global numcomm $$numcomm"; fi && \
105 if [ "$$alphatag" = "$$gitver" ]; then alphatag=""; fi && \
106 if [ -n "$$alphatag" ]; then alphatag="%global alphatag $$alphatag"; fi && \
107 if [ -n "$$dirty" ]; then dirty="%global dirty dirty"; fi && \
109 -e "s#@version@#$$rpmver#g" \
110 -e "s#@ALPHATAG@#$$alphatag#g" \
111 -e "s#@NUMCOMM@#$$numcomm#g" \
112 -e "s#@DIRTY@#$$dirty#g" \
113 -e "s#@date@#$$date#g" \
116 sed -i -e "s#@bcond_userflags@#bcond_without#g" $@-t
118 sed -i -e "s#@bcond_userflags@#bcond_with#g" $@-t
121 sed -i -e "s#@bcond_runautogen@#bcond_without#g" $@-t
123 sed -i -e "s#@bcond_runautogen@#bcond_with#g" $@-t
126 sed -i -e "s#@bcond_systemd@#bcond_without#g" $@-t
128 sed -i -e "s#@bcond_systemd@#bcond_with#g" $@-t
136 RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
137 --define "_specdir $(abs_builddir)" \
138 --define "_builddir $(abs_builddir)" \
139 --define "_srcrpmdir $(abs_builddir)" \
140 --define "_rpmdir $(abs_builddir)"
143 $(MAKE) $(SPEC) $(TARFILE)
144 rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
147 $(MAKE) $(SPEC) $(TARFILE)
148 rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
151 BUILT_SOURCES = .version
153 echo $(VERSION) > $@-t && mv $@-t $@
155 dist-hook: gen-ChangeLog
156 echo $(VERSION) > $(distdir)/.tarball-version
158 gen_start_date = 2000-01-01
159 .PHONY: gen-ChangeLog _version
161 if test -d .git; then \
162 LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog \
163 --since=$(gen_start_date) > $(distdir)/cl-t; \
164 rm -f $(distdir)/ChangeLog; \
165 mv $(distdir)/cl-t $(distdir)/ChangeLog; \
169 cd $(srcdir) && rm -rf autom4te.cache .version && autoreconf -i
170 $(MAKE) $(AM_MAKEFLAGS) Makefile
172 maintainer-clean-local: