]> git.proxmox.com Git - mirror_kronosnet.git/blob - Makefile.am
Merge pull request #254 from kronosnet/test-fixes
[mirror_kronosnet.git] / Makefile.am
1 #
2 # Copyright (C) 2010-2019 Red Hat, Inc. All rights reserved.
3 #
4 # Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
5 #
6 # This software licensed under GPL-2.0+
7 #
8
9 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \
10 config.guess config.sub missing install-sh \
11 ltmain.sh compile config.h.in config.h.in~ \
12 autoscan.log configure.scan test-driver \
13 m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 \
14 m4/ltsugar.m4 m4/ltversion.m4
15
16 include $(top_srcdir)/build-aux/check.mk
17
18 AUTOMAKE_OPTIONS = foreign
19
20 ACLOCAL_AMFLAGS = -I m4
21
22 SPEC = $(PACKAGE_NAME).spec
23
24 TARGZFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz
25
26 EXTRA_DIST = autogen.sh .version \
27 NOTES_TO_PACKAGE_MAINTAINERS \
28 $(SPEC).in build-aux
29
30 SUBDIRS = init libnozzle libknet kronosnetd
31
32 if BUILD_MAN
33 SUBDIRS += man
34 endif
35
36 if BUILD_POC
37 SUBDIRS += poc-code
38 endif
39
40 dist_doc_DATA = \
41 COPYING.applications \
42 COPYING.libraries \
43 COPYRIGHT \
44 README.licence \
45 README
46
47 all-local: $(SPEC)
48
49 clean-local:
50 rm -rf $(SPEC) cov*
51
52 distclean-local:
53 rm -f $(PACKAGE_NAME)-*.tar.* $(PACKAGE_NAME)-*.sha256* tag-*
54
55 ## make rpm/srpm section.
56
57 $(SPEC): $(SPEC).in .version config.status
58 rm -f $@-t $@
59 date="`LC_ALL=C $(UTC_DATE_AT)$(SOURCE_EPOCH) "+%a %b %d %Y"`" && \
60 if [ -f $(abs_srcdir)/.tarball-version ]; then \
61 gitver="`cat $(abs_srcdir)/.tarball-version`" && \
62 rpmver=$$gitver && \
63 alphatag="" && \
64 dirty="" && \
65 numcomm="0"; \
66 elif [ "`git log -1 --pretty=format:x . 2>&1`" = "x" ]; then \
67 gitver="`GIT_DIR=$(abs_srcdir)/.git git describe --abbrev=4 --match='v*' HEAD 2>/dev/null`" && \
68 rpmver=`echo $$gitver | sed -e "s/^v//" -e "s/-.*//g"` && \
69 alphatag=`echo $$gitver | sed -e "s/.*-//" -e "s/^g//"` && \
70 vtag=`echo $$gitver | sed -e "s/-.*//g"` && \
71 numcomm=`GIT_DIR=$(abs_srcdir)/.git git rev-list $$vtag..HEAD | wc -l` && \
72 cd $(abs_srcdir) && \
73 git update-index --refresh > /dev/null 2>&1 || true && \
74 dirty=`git diff-index --name-only HEAD 2>/dev/null` && cd - 2>/dev/null; \
75 else \
76 gitver="`cd $(abs_srcdir); build-aux/git-version-gen .tarball-version .gitarchivever`" && \
77 rpmver=$$gitver && \
78 alphatag="" && \
79 dirty="" && \
80 numcomm="0"; \
81 fi && \
82 if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \
83 if [ "$$numcomm" = "0" ]; then \
84 sed \
85 -e "s#@version@#$$rpmver#g" \
86 -e "s#%glo.*alpha.*##g" \
87 -e "s#%glo.*numcomm.*##g" \
88 -e "s#@dirty@#$$dirty#g" \
89 -e "s#@date@#$$date#g" \
90 $(abs_srcdir)/$@.in > $@-t; \
91 else \
92 sed \
93 -e "s#@version@#$$rpmver#g" \
94 -e "s#@alphatag@#$$alphatag#g" \
95 -e "s#@numcomm@#$$numcomm#g" \
96 -e "s#@dirty@#$$dirty#g" \
97 -e "s#@date@#$$date#g" \
98 $(abs_srcdir)/$@.in > $@-t; \
99 fi; \
100 if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi
101 if BUILD_SCTP
102 sed -i -e "s#@sctp@#bcond_without#g" $@-t
103 else
104 sed -i -e "s#@sctp@#bcond_with#g" $@-t
105 endif
106 if BUILD_CRYPTO_NSS
107 sed -i -e "s#@nss@#bcond_without#g" $@-t
108 else
109 sed -i -e "s#@nss@#bcond_with#g" $@-t
110 endif
111 if BUILD_CRYPTO_OPENSSL
112 sed -i -e "s#@openssl@#bcond_without#g" $@-t
113 else
114 sed -i -e "s#@openssl@#bcond_with#g" $@-t
115 endif
116 if BUILD_COMPRESS_ZLIB
117 sed -i -e "s#@zlib@#bcond_without#g" $@-t
118 else
119 sed -i -e "s#@zlib@#bcond_with#g" $@-t
120 endif
121 if BUILD_COMPRESS_LZ4
122 sed -i -e "s#@lz4@#bcond_without#g" $@-t
123 else
124 sed -i -e "s#@lz4@#bcond_with#g" $@-t
125 endif
126 if BUILD_COMPRESS_LZO2
127 sed -i -e "s#@lzo2@#bcond_without#g" $@-t
128 else
129 sed -i -e "s#@lzo2@#bcond_with#g" $@-t
130 endif
131 if BUILD_COMPRESS_LZMA
132 sed -i -e "s#@lzma@#bcond_without#g" $@-t
133 else
134 sed -i -e "s#@lzma@#bcond_with#g" $@-t
135 endif
136 if BUILD_COMPRESS_BZIP2
137 sed -i -e "s#@bzip2@#bcond_without#g" $@-t
138 else
139 sed -i -e "s#@bzip2@#bcond_with#g" $@-t
140 endif
141 if BUILD_COMPRESS_ZSTD
142 sed -i -e "s#@zstd@#bcond_without#g" $@-t
143 else
144 sed -i -e "s#@zstd@#bcond_with#g" $@-t
145 endif
146 if BUILD_KRONOSNETD
147 sed -i -e "s#@kronosnetd@#bcond_without#g" $@-t
148 else
149 sed -i -e "s#@kronosnetd@#bcond_with#g" $@-t
150 endif
151 if BUILD_LIBNOZZLE
152 sed -i -e "s#@libnozzle@#bcond_without#g" $@-t
153 else
154 sed -i -e "s#@libnozzle@#bcond_with#g" $@-t
155 endif
156 if BUILD_RUNAUTOGEN
157 sed -i -e "s#@runautogen@#bcond_without#g" $@-t
158 else
159 sed -i -e "s#@runautogen@#bcond_with#g" $@-t
160 endif
161 if OVERRIDE_RPM_DEBUGINFO
162 sed -i -e "s#@overriderpmdebuginfo@#bcond_without#g" $@-t
163 else
164 sed -i -e "s#@overriderpmdebuginfo@#bcond_with#g" $@-t
165 endif
166 if BUILD_RPM_DEBUGINFO
167 sed -i -e "s#@rpmdebuginfo@#bcond_without#g" $@-t
168 else
169 sed -i -e "s#@rpmdebuginfo@#bcond_with#g" $@-t
170 endif
171 if BUILD_MAN
172 sed -i -e "s#@buildman@#bcond_without#g" $@-t
173 else
174 sed -i -e "s#@buildman@#bcond_with#g" $@-t
175 endif
176 if INSTALL_TESTS
177 sed -i -e "s#@installtests@#bcond_without#g" $@-t
178 else
179 sed -i -e "s#@installtests@#bcond_with#g" $@-t
180 endif
181 sed -i -e "s#@defaultadmgroup@#$(DEFAULTADMGROUP)#g" $@-t
182 chmod a-w $@-t
183 mv $@-t $@
184 rm -f $@-t*
185
186 $(TARGZFILE):
187 $(MAKE) dist
188
189 RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
190 --define "_specdir $(abs_builddir)" \
191 --define "_builddir $(abs_builddir)" \
192 --define "_srcrpmdir $(abs_builddir)" \
193 --define "_rpmdir $(abs_builddir)"
194
195 srpm: clean
196 $(MAKE) $(SPEC) $(TARGZFILE)
197 rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
198
199 rpm: clean
200 $(MAKE) $(SPEC) $(TARGZFILE)
201 rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
202
203 # release/versioning
204 BUILT_SOURCES = .version
205 .version:
206 echo $(VERSION) > $@-t && mv $@-t $@
207
208 dist-hook: gen-ChangeLog
209 echo $(VERSION) > $(distdir)/.tarball-version
210 echo $(SOURCE_EPOCH) > $(distdir)/source_epoch
211
212 gen_start_date = 2000-01-01
213 .PHONY: gen-ChangeLog
214 gen-ChangeLog:
215 if test -d $(abs_srcdir)/.git; then \
216 LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog \
217 --since=$(gen_start_date) > $(distdir)/cl-t; \
218 rm -f $(distdir)/ChangeLog; \
219 mv $(distdir)/cl-t $(distdir)/ChangeLog; \
220 fi