]> git.proxmox.com Git - mirror_corosync-qdevice.git/blob - Makefile.am
timer-list: Improve efficiency of delete operation
[mirror_corosync-qdevice.git] / Makefile.am
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
51 SUBDIRS = qdevices man init
52
53 install-exec-local:
54 if BUILD_QNETD
55 $(INSTALL) -m 770 -d $(DESTDIR)/${localstatedir}/run/corosync-qnetd
56 $(INSTALL) -m 770 -d $(DESTDIR)/${COROSYSCONFDIR}/qnetd
57 endif
58 if BUILD_QDEVICES
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
62 endif
63
64 uninstall-local:
65 if BUILD_QNETD
66 rmdir $(DESTDIR)/${localstatedir}/run/corosync-qnetd || :;
67 rmdir $(DESTDIR)/${COROSYSCONFDIR}/qnetd || :;
68 endif
69 if BUILD_QDEVICES
70 rmdir $(DESTDIR)/${localstatedir}/run/corosync-qdevice || :;
71 rmdir $(DESTDIR)/${COROSYSCONFDIR}/qdevice/net || :;
72 rmdir $(DESTDIR)/${COROSYSCONFDIR}/qdevice/ || :;
73 endif
74
75 dist-clean-local:
76 rm -f autoconf automake autoheader
77
78 clean-generic:
79 rm -rf doc/api $(SPEC) $(TARFILE)
80
81 ## make rpm/srpm section.
82
83 $(SPEC): $(SPEC).in
84 rm -f $@-t $@
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" && \
89 alphatag="" && \
90 dirty="" && \
91 numcomm="0"; \
92 else \
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/'` && \
97 dirty="" && \
98 if [ "`echo $$gitver | sed 's/^.*-dirty$$//g'`" = "" ];then \
99 dirty="dirty"; \
100 fi \
101 fi && \
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 && \
108 sed \
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" \
114 $< > $@-t
115 if BUILD_USERFLAGS
116 sed -i -e "s#@bcond_userflags@#bcond_without#g" $@-t
117 else
118 sed -i -e "s#@bcond_userflags@#bcond_with#g" $@-t
119 endif
120 if BUILD_RUNAUTOGEN
121 sed -i -e "s#@bcond_runautogen@#bcond_without#g" $@-t
122 else
123 sed -i -e "s#@bcond_runautogen@#bcond_with#g" $@-t
124 endif
125 if INSTALL_SYSTEMD
126 sed -i -e "s#@bcond_systemd@#bcond_without#g" $@-t
127 else
128 sed -i -e "s#@bcond_systemd@#bcond_with#g" $@-t
129 endif
130 chmod a-w $@-t
131 mv $@-t $@
132
133 $(TARFILE):
134 $(MAKE) dist
135
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)"
141
142 srpm: clean
143 $(MAKE) $(SPEC) $(TARFILE)
144 rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
145
146 rpm: clean _version
147 $(MAKE) $(SPEC) $(TARFILE)
148 rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
149
150 # release/versioning
151 BUILT_SOURCES = .version
152 .version:
153 echo $(VERSION) > $@-t && mv $@-t $@
154
155 dist-hook: gen-ChangeLog
156 echo $(VERSION) > $(distdir)/.tarball-version
157
158 gen_start_date = 2000-01-01
159 .PHONY: gen-ChangeLog _version
160 gen-ChangeLog:
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; \
166 fi
167
168 _version:
169 cd $(srcdir) && rm -rf autom4te.cache .version && autoreconf -i
170 $(MAKE) $(AM_MAKEFLAGS) Makefile
171
172 maintainer-clean-local:
173 rm -rf m4