2 # Copyright (C) 2010-2019 Red Hat, Inc. All rights reserved.
4 # Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
6 # This software licensed under GPL-2.0+, LGPL-2.0+
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
16 include $(top_srcdir)/build-aux/check.mk
18 AUTOMAKE_OPTIONS = foreign
20 ACLOCAL_AMFLAGS = -I m4
22 SPEC = $(PACKAGE_NAME).spec
24 TARGZFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz
26 EXTRA_DIST = autogen.sh .version \
27 NOTES_TO_PACKAGE_MAINTAINERS \
30 SUBDIRS = init libnozzle libknet kronosnetd
41 COPYING.applications \
53 rm -f $(PACKAGE_NAME)-*.tar.* $(PACKAGE_NAME)-*.sha256* tag-*
55 ## make rpm/srpm section.
57 $(SPEC): $(SPEC).in .version config.status
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`" && \
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` && \
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; \
76 gitver="`cd $(abs_srcdir); build-aux/git-version-gen .tarball-version .gitarchivever`" && \
82 if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \
83 if [ "$$numcomm" = "0" ]; then \
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; \
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; \
100 if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi
102 sed -i -e "s#@sctp@#bcond_without#g" $@-t
104 sed -i -e "s#@sctp@#bcond_with#g" $@-t
107 sed -i -e "s#@nss@#bcond_without#g" $@-t
109 sed -i -e "s#@nss@#bcond_with#g" $@-t
111 if BUILD_CRYPTO_OPENSSL
112 sed -i -e "s#@openssl@#bcond_without#g" $@-t
114 sed -i -e "s#@openssl@#bcond_with#g" $@-t
116 if BUILD_COMPRESS_ZLIB
117 sed -i -e "s#@zlib@#bcond_without#g" $@-t
119 sed -i -e "s#@zlib@#bcond_with#g" $@-t
121 if BUILD_COMPRESS_LZ4
122 sed -i -e "s#@lz4@#bcond_without#g" $@-t
124 sed -i -e "s#@lz4@#bcond_with#g" $@-t
126 if BUILD_COMPRESS_LZO2
127 sed -i -e "s#@lzo2@#bcond_without#g" $@-t
129 sed -i -e "s#@lzo2@#bcond_with#g" $@-t
131 if BUILD_COMPRESS_LZMA
132 sed -i -e "s#@lzma@#bcond_without#g" $@-t
134 sed -i -e "s#@lzma@#bcond_with#g" $@-t
136 if BUILD_COMPRESS_BZIP2
137 sed -i -e "s#@bzip2@#bcond_without#g" $@-t
139 sed -i -e "s#@bzip2@#bcond_with#g" $@-t
142 sed -i -e "s#@kronosnetd@#bcond_without#g" $@-t
144 sed -i -e "s#@kronosnetd@#bcond_with#g" $@-t
147 sed -i -e "s#@libnozzle@#bcond_without#g" $@-t
149 sed -i -e "s#@libnozzle@#bcond_with#g" $@-t
152 sed -i -e "s#@runautogen@#bcond_without#g" $@-t
154 sed -i -e "s#@runautogen@#bcond_with#g" $@-t
156 if OVERRIDE_RPM_DEBUGINFO
157 sed -i -e "s#@overriderpmdebuginfo@#bcond_without#g" $@-t
159 sed -i -e "s#@overriderpmdebuginfo@#bcond_with#g" $@-t
161 if BUILD_RPM_DEBUGINFO
162 sed -i -e "s#@rpmdebuginfo@#bcond_without#g" $@-t
164 sed -i -e "s#@rpmdebuginfo@#bcond_with#g" $@-t
167 sed -i -e "s#@buildman@#bcond_without#g" $@-t
169 sed -i -e "s#@buildman@#bcond_with#g" $@-t
172 sed -i -e "s#@installtests@#bcond_without#g" $@-t
174 sed -i -e "s#@installtests@#bcond_with#g" $@-t
176 sed -i -e "s#@defaultadmgroup@#$(DEFAULTADMGROUP)#g" $@-t
184 RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
185 --define "_specdir $(abs_builddir)" \
186 --define "_builddir $(abs_builddir)" \
187 --define "_srcrpmdir $(abs_builddir)" \
188 --define "_rpmdir $(abs_builddir)"
191 $(MAKE) $(SPEC) $(TARGZFILE)
192 rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
195 $(MAKE) $(SPEC) $(TARGZFILE)
196 rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
199 BUILT_SOURCES = .version
201 echo $(VERSION) > $@-t && mv $@-t $@
203 dist-hook: gen-ChangeLog
204 echo $(VERSION) > $(distdir)/.tarball-version
205 echo $(SOURCE_EPOCH) > $(distdir)/source_epoch
207 gen_start_date = 2000-01-01
208 .PHONY: gen-ChangeLog
210 if test -d $(abs_srcdir)/.git; then \
211 LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog \
212 --since=$(gen_start_date) > $(distdir)/cl-t; \
213 rm -f $(distdir)/ChangeLog; \
214 mv $(distdir)/cl-t $(distdir)/ChangeLog; \