1 # Makefile.am - main makefile for libksba
2 # Copyright (C) 2001, 2002 g10 Code GmbH
4 # This file is part of KSBA.
6 # KSBA is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # KSBA is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, see <http://www.gnu.org/licenses/>.
19 ## Process this file with automake to produce Makefile.in
21 # Location of the released tarball archives. This is prefixed by
22 # the variable RELEASE_ARCHIVE in ~/.gnupg-autogen.rc. For example:
23 # RELEASE_ARCHIVE=wk@somehost:archive/tarballs
24 RELEASE_ARCHIVE_SUFFIX = libksba
26 ACLOCAL_AMFLAGS = -I m4 -I gl/m4
27 DISTCHECK_CONFIGURE_FLAGS = --enable-doc
29 # (A suitable gitlog-to-changelog script can be found in GnuPG master.)
30 GITLOG_TO_CHANGELOG=gitlog-to-changelog
32 EXTRA_DIST = autogen.sh autogen.rc \
33 COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv3 \
34 ChangeLog-2011 doc/ChangeLog-2011 src/ChangeLog-2011 \
35 tests/ChangeLog-2011 \
36 build-aux/libtool-patch.sed \
37 build-aux/git-log-footer build-aux/git-log-fix
52 SUBDIRS = m4 gl src $(tests) $(doc)
54 dist-hook: gen-ChangeLog
58 pref="#+macro: $$(echo $(PACKAGE_NAME)|tr '-' '_')_" ;\
59 reldate="$$(date -u +%Y-%m-%d)" ;\
60 echo "$${pref}ver $(PACKAGE_VERSION)" ;\
61 echo "$${pref}date $${reldate}" ;\
62 list='$(DIST_ARCHIVES)'; for i in $$list; do \
63 case "$$i" in *.tar.bz2) \
64 echo "$${pref}size $$(wc -c <$$i|awk '{print int($$1/1024)}')k" ;\
65 echo "$${pref}sha1 $$(sha1sum <$$i|cut -d' ' -f1)" ;\
66 echo "$${pref}sha2 $$(sha256sum <$$i|cut -d' ' -f1)" ;;\
68 done ) | tee $(distdir).swdb
71 gen_start_date = 2011-12-01T00:00:00
73 if test -d $(top_srcdir)/.git; then \
74 (cd $(top_srcdir) && \
75 $(GITLOG_TO_CHANGELOG) --append-dot --tear-off \
76 --amend=build-aux/git-log-fix \
77 --since=$(gen_start_date) ) > $(distdir)/cl-t; \
78 cat $(top_srcdir)/build-aux/git-log-footer >> $(distdir)/cl-t;\
79 rm -f $(distdir)/ChangeLog; \
80 mv $(distdir)/cl-t $(distdir)/ChangeLog; \
86 $(MAKE) $(AM_MAKEFLAGS) install prefix=/usr/local/stow/libksba
94 @echo Removing old coverage results
95 -find -name '*.gcda' -print | xargs -r rm
96 -find -name '*.gcno' -print | xargs -r rm
97 -rm -rf coverage.info coveragereport
100 @echo Collecting coverage data with lcov
101 $(top_srcdir)/autogen.sh --coverage $(LCOV) $(GCOV) $(abs_builddir) \
103 $(top_srcdir)/autogen.sh --report $(LCOV) $(GENHTML) $(abs_builddir) \
104 '*/tests/*' '*/asn1-parse.c' '*/asn1-parse.y'
106 clean-local: clean-coverage
110 .PHONY: gen-ChangeLog clean-coverage coverage-html release sign-release
112 # Macro to help the release target.
113 RELEASE_NAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
117 if [ "$(abs_top_builddir)" = "$(abs_top_srcdir)" ]; then \
118 echo "error: build directory must not be the source directory" >&2;\
121 echo "/* Build started at $$(date -uIseconds) */" ;\
123 ./autogen.sh --force; \
124 cd $(abs_top_builddir); \
125 rm -rf dist; mkdir dist ; cd dist ; \
126 $(abs_top_srcdir)/configure --enable-maintainer-mode; \
128 echo "/* Build finished at $$(date -uIseconds) */" ;\
130 echo " * Please run the final step interactivly:" ;\
131 echo " * make sign-release" ;\
133 ) 2>&1 | tee "$(RELEASE_NAME).buildlog"
137 test $$(pwd | sed 's,.*/,,') = dist || cd dist; \
138 x=$$(grep '^RELEASE_ARCHIVE=' $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
139 if [ -z "$$x" ]; then \
140 echo "error: RELEASE_ARCHIVE missing in ~/.gnupg-autogen.rc">&2; \
143 myarchive="$$x/$(RELEASE_ARCHIVE_SUFFIX)";\
144 x=$$(grep '^RELEASE_SIGNKEY=' $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
145 if [ -z "$$x" ]; then \
146 echo "error: RELEASE_SIGNKEY missing in ~/.gnupg-autogen.rc">&2; \
150 files1="$(RELEASE_NAME).tar.bz2" ; \
151 files2="$(RELEASE_NAME).tar.bz2.sig \
152 $(RELEASE_NAME).swdb \
153 $(RELEASE_NAME).buildlog" ;\
154 echo "/* Signing the source tarball ..." ;\
155 gpg -sbu $$mysignkey $(RELEASE_NAME).tar.bz2 ;\
156 cat $(RELEASE_NAME).swdb >swdb.snippet;\
157 echo >>swdb.snippet ;\
158 sha1sum $${files1} >>swdb.snippet ;\
159 cat "../$(RELEASE_NAME).buildlog" swdb.snippet \
160 | gzip >$(RELEASE_NAME).buildlog ;\
161 echo "Copying to archive $$myarchive ..." ;\
162 scp -p $${files1} $${files2} $${myarchive}/ || true;\
164 echo ' * All done; for checksums see dist/swdb.snippet' ;\