1## Process this file with automake to produce Makefile.in
2# Copyright (C) 2000-2012 Free Software Foundation, Inc.
3#
4# Author: Nikos Mavrogiannopoulos
5#
6# This file is part of GnuTLS.
7#
8# This file is free software; you can redistribute it and/or modify it
9# under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 3 of the License, or
11# (at your option) any later version.
12#
13# This file is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this file; if not, write to the Free Software Foundation,
20# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
22DISTCHECK_CONFIGURE_FLAGS = \
23	--enable-doc \
24	--enable-gtk-doc \
25	--disable-valgrind-tests \
26	--with-guile-site-dir='$$(datarootdir)/guile/site/$$(GUILE_EFFECTIVE_VERSION)' \
27	--with-guile-site-ccache-dir='$$(libdir)/guile/$$(GUILE_EFFECTIVE_VERSION)/site-ccache' \
28	--with-guile-extension-dir='$$(libdir)/guile/$$(GUILE_EFFECTIVE_VERSION)/extensions' \
29	AUTOGEN=false
30
31SUBDIRS = gl lib extra
32
33if ENABLE_DANE
34SUBDIRS += libdane
35endif
36
37SUBDIRS += po
38if ENABLE_TOOLS
39SUBDIRS += src/gl src
40else
41SUBDIRS += src/gl
42endif
43
44if ENABLE_TESTS
45SUBDIRS += tests fuzz
46endif
47
48if HAVE_GUILE
49SUBDIRS += guile
50endif
51
52if ENABLE_MANPAGES
53SUBDIRS += doc/manpages
54endif
55
56if ENABLE_DOC
57SUBDIRS += doc
58endif
59
60ACLOCAL_AMFLAGS = -I m4 -I src/libopts/m4 -I src/gl/m4 -I lib/unistring/m4 --install
61
62EXTRA_DIST = cfg.mk maint.mk CONTRIBUTING.md README.md LICENSE AUTHORS NEWS \
63	ChangeLog THANKS INSTALL.md RELEASES.md
64
65DISTCLEANFILES = AUTHORS
66
67AUTHORS:
68	@echo -e "The authors list is autogenerated from the git history; sorted by number of commits\n" >AUTHORS
69	@git shortlog -sen| cut -f 2 | sed 's/@/ at /g' >> AUTHORS
70	@echo -e "\n\nThe translators list is autogenerated from po file history\n" >>AUTHORS
71	@sed -n 's/.*Last-Translator: *\(.*\) *<.*/\1/p' po/*.po | sort -u >>AUTHORS
72
73pic-check:
74	@echo "Checking for position dependent code"
75	readelf -d $(builddir)/lib/.libs/libgnutls.so|grep TEXTREL; if test $$? = 0;then \
76	eu-findtextrel $(builddir)/lib/.libs/libgnutls.so; \
77	false; \
78	fi
79
80ABIDW_COMMON = --no-show-locs --no-corpus-path
81ABIGNORE_FILE = "$(top_srcdir)/devel/libgnutls.abignore"
82SYMBOLS_LAST_FILE = "$(top_srcdir)/devel/symbols.last"
83LIBGNUTLS_ABI_LAST_FILE = "$(top_srcdir)/devel/libgnutls-latest-$$(uname -m).abi"
84LIBDANE_ABI_LAST_FILE = "$(top_srcdir)/devel/libdane-latest-$$(uname -m).abi"
85
86abi-dump-versioned: lib/libgnutls.la libdane/libgnutls-dane.la
87	@echo "**************************************************************************"
88	@echo "Generating versioned ABI files of current gnutls and gnutls-dane libraries"
89	@echo "**************************************************************************"
90	@abidw lib/.libs/libgnutls.so $(ABIDW_COMMON) --suppressions $(ABIGNORE_FILE) --out-file "$(srcdir)/devel/libgnutls-$(VERSION)-$$(uname -m).abi"
91	@abidw libdane/.libs/libgnutls-dane.so $(ABIDW_COMMON) --out-file "$(srcdir)/devel/libdane-$(VERSION)-$$(uname -m).abi"
92
93abi-dump-latest: lib/libgnutls.la libdane/libgnutls-dane.la
94	@echo "****************************************************************"
95	@echo "Generating ABI files of current gnutls and gnutls-dane libraries"
96	@echo "****************************************************************"
97	@abidw lib/.libs/libgnutls.so $(ABIDW_COMMON) --suppressions $(ABIGNORE_FILE) --out-file $(LIBGNUTLS_ABI_LAST_FILE)
98	@abidw libdane/.libs/libgnutls-dane.so $(ABIDW_COMMON) --out-file $(LIBDANE_ABI_LAST_FILE)
99	@rm -f "./devel/libgnutls-latest-$$(uname -m).tmp"
100	@rm -f "./devel/libdane-latest-$$(uname -m).tmp"
101
102abi-check-latest: lib/libgnutls.la libdane/libgnutls-dane.la
103	@echo "Checking whether the latest ABI dump matches"
104	@abidiff --suppressions $(ABIGNORE_FILE) lib/.libs/libgnutls.so $(LIBGNUTLS_ABI_LAST_FILE) --hd2 "$(srcdir)/lib/includes/gnutls/" --hd2 $(builddir)/lib/includes/gnutls/ ; if test $$? != 0;then \
105		echo "*********************************************************"; \
106		echo "libgnutls ABI has changed; use 'make files-update'       "; \
107		echo "and use 'git diff' to check correctness before committing"; \
108		echo "*********************************************************"; \
109		false; \
110	fi
111	@abidiff libdane/.libs/libgnutls-dane.so $(LIBDANE_ABI_LAST_FILE) --hd2 "$(srcdir)/libdane/includes/gnutls/" --hd2 $(builddir)/lib/includes/gnutls/; if test $$? != 0;then \
112		echo "*********************************************************"; \
113		echo "libgnutls-dane ABI has changed; use 'make files-update'  "; \
114		echo "and use 'git diff' to check correctness before committing"; \
115		echo "*********************************************************"; \
116		false; \
117	fi
118	@echo "********************************"
119	@echo "Current release matches ABI dump"
120	@echo "********************************"
121
122ABICHECK_COMMON = --no-added-syms
123abi-check: lib/libgnutls.la libdane/libgnutls-dane.la
124	@for file in $$(echo $(srcdir)/devel/libgnutls-*-$$(uname -m).abi);do \
125		echo "Comparing libgnutls with $$file"; \
126		abidiff $${file} lib/.libs/libgnutls.so $(ABICHECK_COMMON) --suppressions $(ABIGNORE_FILE) --hd2 "$(srcdir)/lib/includes/gnutls/" --hd2 $(builddir)/lib/includes/gnutls/; \
127		if test $$? != 0;then \
128			echo "****************************************************************************"; \
129			echo "ABI check failed; If intentional add suppression in devel/libgnutls.abignore"; \
130			echo "****************************************************************************"; \
131			exit 1; \
132		fi; \
133	done
134	@for file in $$(echo $(srcdir)/devel/libdane-*-$$(uname -m).abi);do \
135		echo "Comparing libgnutls-dane with $$file"; \
136		abidiff $${file} libdane/.libs/libgnutls-dane.so $(ABICHECK_COMMON) --hd2 "$(srcdir)/libdane/includes/gnutls/" --hd2 $(builddir)/lib/includes/gnutls/; \
137		if test $$? != 0;then \
138			echo "**********************************************"; \
139			echo "ABI check failed; If intentional add a        "; \
140			echo "libabigail suppression file for libgnutls-dane"; \
141			echo "**********************************************"; \
142			exit 1; \
143		fi; \
144	done
145	@echo "********************"
146	@echo "ABI checks completed"
147	@echo "********************"
148
149symbol-check: lib/libgnutls.la
150	@objdump -T $(builddir)/lib/.libs/libgnutls.so | grep -v ' \*UND\*'  | awk '{print $$7 "@" $$6;}' | grep -v GNUTLS_FIPS140 | grep -v GNUTLS_PRIVATE | grep -v '^@' |  sort -u >symbols.last.tmp
151	@diff -u $(SYMBOLS_LAST_FILE) symbols.last.tmp >/dev/null 2>&1; if test $$? != 0;then \
152		diff -u $(SYMBOLS_LAST_FILE) symbols.last.tmp | grep -v '\-\-\-' >symbols.diff.tmp 2>&1; \
153		if grep -e '^-' symbols.diff.tmp;then \
154			echo "*******************************************"; \
155			echo "Symbols were removed from the library.     "; \
156			echo "Check symbols.diff.tmp for more information"; \
157			echo "*******************************************"; \
158			false; \
159		else \
160			echo "*************************************************************"; \
161			echo "Symbols were added in the library; use 'make files-update'   "; \
162			echo "and use 'git diff' to check correctness before committing    "; \
163			echo "*************************************************************"; \
164			false; \
165		fi \
166	else \
167		test -f symbols.diff.tmp && cat symbols.diff.tmp; \
168		echo "**************************"; \
169		echo "No symbol changes detected"; \
170		echo "**************************"; \
171	fi
172	rm -f symbols.last.tmp symbols.diff.tmp
173
174include $(top_srcdir)/aminclude_static.am
175clean-local: code-coverage-clean
176distclean-local: code-coverage-dist-clean
177
178local-code-coverage-output: code-coverage-capture
179	cat GnuTLS-$(VERSION)-coverage/index.html|grep headerCovTableEntry|grep '%'|head -1|sed 's/^.*>\([0-9]\+\.[0-9]\+\s*%\)<.*$$/ coverage lines: \1/' || true
180
181libopts-check:
182	@echo "*****************************************************************"
183	@echo "Checking whether included libopts matches the system's. If the"
184	@echo "check fails upgrade the included libopts."
185	@echo "*****************************************************************"
186	test "`autoopts-config libsrc|awk -F '-' '{print $$NF}'|sed 's/.tar.gz//'`" = "`cat $(srcdir)/src/libopts/autoopts/options.h |grep OPTIONS_VERSION_STRING|cut -d '"' -f 2|sed 's/:/./g'`"
187
188files-update: libopts-check abi-dump-latest
189	$(MAKE) -C doc/ compare-makefile || mv doc/tmp-compare-makefile $(srcdir)/doc/Makefile.am
190	$(MAKE) -C doc/manpages compare-makefile || mv doc/manpages/tmp-compare-makefile $(srcdir)/doc/manpages/Makefile.am
191	$(MAKE) -C . symbol-check || mv symbols.last.tmp $(SYMBOLS_LAST_FILE)
192	@echo "******************************************************************************************"
193	@echo "updated auto-generated files; please use git diff to verify the correctness of the changes"
194	@echo "******************************************************************************************"
195
196dist-hook: libopts-check
197	$(PKG_CONFIG) --atleast-version=2.2.0 guile-2.2
198	if test -d "$(top_srcdir)/devel";then \
199		$(MAKE) -C $(top_srcdir) symbol-check && \
200		$(MAKE) -C $(top_srcdir) abi-check-latest; \
201	fi
202	$(MAKE) -C doc/ compare-makefile
203	$(MAKE) -C doc/ compare-exported
204	$(MAKE) -C doc/manpages compare-makefile
205	$(MAKE) ChangeLog
206	mv ChangeLog $(distdir)
207	touch -c $(distdir)/doc/*.html $(distdir)/doc/*.pdf $(distdir)/doc/*.info
208
209.PHONY: abi-check abi-dump-versioned abi-dump-latest pic-check symbol-check local-code-coverage-output files-update libopts-check AUTHORS
210