7dcf2f32646ad1059674de60b09806633990db3b
[platform/upstream/gpgme.git] / Makefile.am
1 # Makefile.am - Top level Makefile for GPGME.
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001, 2002, 2004, 2005, 2008, 2009 g10 Code GmbH
4 #
5 # This file is part of GPGME.
6 #
7 # GPGME is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU Lesser General Public License as
9 # published by the Free Software Foundation; either version 2.1 of the
10 # License, or (at your option) any later version.
11 #
12 # GPGME is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
15 # Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program; if not, see <https://gnu.org/licenses/>.
19 # SPDX-License-Identifier: LGPL-2.1-or-later
20
21 ## Process this file with automake to produce Makefile.in
22
23 # Location of the released tarball archives.  This is prefixed by
24 # the variable RELEASE_ARCHIVE in ~/.gnupg-autogen.rc.  For example:
25 # RELEASE_ARCHIVE=user@host:archive/tarballs
26 RELEASE_ARCHIVE_SUFFIX = gpgme
27 # The variable RELEASE_SIGNKEY in ~/.gnupg-autogen.rc is used
28 # to specify the key for signing.  For example:
29 # RELEASE_SIGNKEY=D8692123C4065DEA5E0F3AB5249B39D24F25E3B6
30
31
32 # Autoconf flags
33 ACLOCAL_AMFLAGS = -I m4
34
35 DISTCHECK_CONFIGURE_FLAGS =
36
37 EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in  \
38              ChangeLog-2011 m4/ChangeLog-2011     \
39              conf/whatisthis VERSION
40
41
42 if RUN_GPG_TESTS
43 tests = tests
44 else
45 tests =
46 endif
47
48 SUBDIRS = src ${tests} doc lang
49
50 # Fix the version of the spec file.
51 dist-hook: gen-ChangeLog
52         @set -e; \
53         sed -e 's/@pkg_version@/$(PACKAGE_VERSION)/g' \
54             $(top_srcdir)/gpgme.spec.in  > $(distdir)/gpgme.spec
55
56 distcheck-hook:
57         set -e; ( \
58         pref="#+macro: gpgme_" ;\
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 .PHONY: gen-ChangeLog release sign-release
71
72 gen_start_date = 2011-12-01T00:00:00
73 gen-ChangeLog:
74         if test -d $(top_srcdir)/.git; then                             \
75           (cd $(top_srcdir) &&                                          \
76             $(GITLOG_TO_CHANGELOG) --append-dot --tear-off              \
77             --amend=build-aux/git-log-fix                               \
78             --since=$(gen_start_date) ) > $(distdir)/cl-t;              \
79           cat $(top_srcdir)/build-aux/git-log-footer >> $(distdir)/cl-t;\
80           rm -f $(distdir)/ChangeLog;                                   \
81           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
82         fi
83
84
85 # Macro to help the release target.
86 RELEASE_NAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
87
88 release:
89         +(set -e;\
90          if [ "$(abs_top_builddir)" = "$(abs_top_srcdir)" ]; then \
91            echo "error: build directory must not be the source directory" >&2;\
92            exit 2;\
93          fi ;\
94          echo "/* Build started at $$(date -uIseconds) */" ;\
95          cd $(top_srcdir); \
96          ./autogen.sh --force; \
97          cd $(abs_top_builddir); \
98          rm -rf dist; mkdir dist ; cd dist ; \
99          $(abs_top_srcdir)/configure --enable-maintainer-mode; \
100          $(MAKE) distcheck; \
101          echo "/* Build finished at $$(date -uIseconds) */" ;\
102          echo "/*" ;\
103          echo " * Please run the final step interactively:" ;\
104          echo " *   make sign-release" ;\
105          echo " */" ;\
106         ) 2>&1 | tee "$(RELEASE_NAME).buildlog"
107
108 sign-release:
109          +(set -e; \
110           cd dist; \
111           x=$$(grep '^RELEASE_ARCHIVE=' $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
112           if [ -z "$$x" ]; then \
113              echo "error: RELEASE_ARCHIVE missing in ~/.gnupg-autogen.rc">&2; \
114              exit 2;\
115           fi;\
116           myarchive="$$x/$(RELEASE_ARCHIVE_SUFFIX)";\
117           x=$$(grep '^RELEASE_SIGNKEY=' $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
118           if [ -z "$$x" ]; then \
119              echo "error: RELEASE_SIGNKEY missing in ~/.gnupg-autogen.rc">&2; \
120              exit 2;\
121           fi;\
122           mysignkey="$$x";\
123           files1="$(RELEASE_NAME).tar.bz2" ;\
124           files2="$(RELEASE_NAME).tar.bz2.sig \
125                   $(RELEASE_NAME).swdb \
126                   $(RELEASE_NAME).buildlog" ;\
127           echo "/* Signing the source tarball ..." ;\
128           gpg -sbu $$mysignkey $(RELEASE_NAME).tar.bz2 ;\
129           cat $(RELEASE_NAME).swdb >swdb.snippet;\
130           echo >>swdb.snippet ;\
131           sha1sum $${files1} >>swdb.snippet ;\
132           cat "../$(RELEASE_NAME).buildlog" swdb.snippet \
133                | gzip >$(RELEASE_NAME).buildlog ;\
134           echo "Copying to local archive ..." ;\
135           scp -p $${files1} $${files2} $$myarchive/ || true;\
136           echo "Uploading documentation ..." ;\
137           $(MAKE) -C doc online; \
138           echo '/*' ;\
139           echo ' * All done; for checksums see dist/swdb.snippet' ;\
140           echo ' */' ;\
141          )