Fix build error
[platform/upstream/libksba.git] / Makefile.am
1 # Makefile.am - main makefile for libksba
2 #       Copyright (C) 2001, 2002 g10 Code GmbH
3 #
4 # This file is part of KSBA.
5 #
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.
10 #
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.
15 #
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/>.
18
19 ## Process this file with automake to produce Makefile.in
20
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
25
26 ACLOCAL_AMFLAGS = -I m4 -I gl/m4
27 DISTCHECK_CONFIGURE_FLAGS = --enable-doc
28
29 # (A suitable gitlog-to-changelog script can be found in GnuPG master.)
30 GITLOG_TO_CHANGELOG=gitlog-to-changelog
31
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
38
39
40 if CROSS_COMPILING
41 tests =
42 else
43 tests = tests
44 endif
45
46 if BUILD_DOC
47 doc = doc
48 else
49 doc =
50 endif
51
52 SUBDIRS = m4 gl src $(tests) $(doc)
53
54 dist-hook: gen-ChangeLog
55
56 distcheck-hook:
57         set -e; ( \
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)" ;;\
67           esac;\
68         done ) | tee $(distdir).swdb
69
70
71 gen_start_date = 2011-12-01T00:00:00
72 gen-ChangeLog:
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;                      \
81         fi
82
83
84
85 stowinstall:
86         $(MAKE) $(AM_MAKEFLAGS) install prefix=/usr/local/stow/libksba
87
88
89
90 # Coverage targets
91 if HAVE_GCOV
92
93 clean-coverage:
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
98
99 coverage-html: check
100         @echo Collecting coverage data with lcov
101         $(top_srcdir)/autogen.sh --coverage $(LCOV) $(GCOV) $(abs_builddir) \
102                 tests src
103         $(top_srcdir)/autogen.sh --report $(LCOV) $(GENHTML) $(abs_builddir) \
104                 '*/tests/*' '*/asn1-parse.c' '*/asn1-parse.y'
105
106 clean-local: clean-coverage
107
108 endif # HAVE_GCOV
109
110 .PHONY: gen-ChangeLog clean-coverage coverage-html release sign-release
111
112 # Macro to help the release target.
113 RELEASE_NAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
114
115 release:
116         +(set -e;\
117          if [ "$(abs_top_builddir)" = "$(abs_top_srcdir)" ]; then \
118            echo "error: build directory must not be the source directory" >&2;\
119            exit 2;\
120          fi ;\
121          echo "/* Build started at $$(date -uIseconds) */" ;\
122          cd $(top_srcdir); \
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; \
127          $(MAKE) distcheck; \
128          echo "/* Build finished at $$(date -uIseconds) */" ;\
129          echo "/*" ;\
130          echo " * Please run the final step interactivly:" ;\
131          echo " *   make sign-release" ;\
132          echo " */" ;\
133         ) 2>&1 | tee "$(RELEASE_NAME).buildlog"
134
135 sign-release:
136          +(set -e; \
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; \
141              exit 2;\
142           fi;\
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; \
147              exit 2;\
148           fi;\
149           mysignkey="$$x";\
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;\
163           echo '/*' ;\
164           echo ' * All done; for checksums see dist/swdb.snippet' ;\
165           echo ' */' ;\
166          )