]> git.proxmox.com Git - mirror_corosync-qdevice.git/blob - Makefile.am
configure: Add user-flags configure option
[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 if [ -f .tarball-version ]; then \
87 gitver="$(shell cat .tarball-version)" && \
88 rpmver=$$gitver && \
89 alphatag="" && \
90 dirty="" && \
91 numcomm=""; \
92 else \
93 gitver="$(shell git describe --abbrev=4 --match='v*' HEAD 2>/dev/null)" && \
94 rpmver=`echo $$gitver | sed -e "s/^v//" -e "s/-.*//g"` && \
95 alphatag=`echo $$gitver | sed -e "s/.*-//" -e "s/^g//"` && \
96 vtag=`echo $$gitver | sed -e "s/-.*//g"` && \
97 numcomm=`git rev-list $$vtag..HEAD | wc -l` && \
98 git update-index --refresh > /dev/null 2>&1 || true && \
99 dirty=`git diff-index --name-only HEAD 2>/dev/null`; \
100 fi && \
101 if [ "$$numcomm" = "0" ]; then numcomm=""; fi && \
102 if [ -n "$$numcomm" ]; then numcomm="%global numcomm $$numcomm"; fi && \
103 if [ "$$alphatag" = "$$gitver" ]; then alphatag=""; fi && \
104 if [ -n "$$alphatag" ]; then alphatag="%global alphatag $$alphatag"; fi && \
105 if [ -n "$$dirty" ]; then dirty="%global dirty dirty"; fi && \
106 sed \
107 -e "s#@version@#$$rpmver#g" \
108 -e "s#@ALPHATAG@#$$alphatag#g" \
109 -e "s#@NUMCOMM@#$$numcomm#g" \
110 -e "s#@DIRTY@#$$dirty#g" \
111 -e "s#@date@#$$date#g" \
112 $< > $@-t
113 if BUILD_USERFLAGS
114 sed -i -e "s#@bcond_userflags@#bcond_without#g" $@-t
115 else
116 sed -i -e "s#@bcond_userflags@#bcond_with#g" $@-t
117 endif
118 if BUILD_RUNAUTOGEN
119 sed -i -e "s#@bcond_runautogen@#bcond_without#g" $@-t
120 else
121 sed -i -e "s#@bcond_runautogen@#bcond_with#g" $@-t
122 endif
123 if INSTALL_SYSTEMD
124 sed -i -e "s#@bcond_systemd@#bcond_without#g" $@-t
125 else
126 sed -i -e "s#@bcond_systemd@#bcond_with#g" $@-t
127 endif
128 chmod a-w $@-t
129 mv $@-t $@
130
131 $(TARFILE):
132 $(MAKE) dist
133
134 RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
135 --define "_specdir $(abs_builddir)" \
136 --define "_builddir $(abs_builddir)" \
137 --define "_srcrpmdir $(abs_builddir)" \
138 --define "_rpmdir $(abs_builddir)"
139
140 srpm: clean
141 $(MAKE) $(SPEC) $(TARFILE)
142 rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
143
144 rpm: clean _version
145 $(MAKE) $(SPEC) $(TARFILE)
146 rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
147
148 # release/versioning
149 BUILT_SOURCES = .version
150 .version:
151 echo $(VERSION) > $@-t && mv $@-t $@
152
153 dist-hook: gen-ChangeLog
154 echo $(VERSION) > $(distdir)/.tarball-version
155
156 gen_start_date = 2000-01-01
157 .PHONY: gen-ChangeLog _version
158 gen-ChangeLog:
159 if test -d .git; then \
160 LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog \
161 --since=$(gen_start_date) > $(distdir)/cl-t; \
162 rm -f $(distdir)/ChangeLog; \
163 mv $(distdir)/cl-t $(distdir)/ChangeLog; \
164 fi
165
166 _version:
167 cd $(srcdir) && rm -rf autom4te.cache .version && autoreconf -i
168 $(MAKE) $(AM_MAKEFLAGS) Makefile
169
170 maintainer-clean-local:
171 rm -rf m4