Imported Upstream version 2.4.3
[platform/upstream/gpg2.git] / Makefile.am
1 # Makefile.am - main makefile for GnuPG
2 #       Copyright (C) 2001, 2004, 2010 Free Software Foundation, Inc.
3 #
4 # This file is part of GnuPG.
5 #
6 # GnuPG 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 # GnuPG 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 <https://www.gnu.org/licenses/>.
18
19 ## Process this file with automake to produce Makefile.in
20
21 # We want to also build the wixlib for use by GnuPG Desktop
22 WITH_MSI=1
23
24 # Location of the released tarball archives.  This is prefixed by
25 # the variable RELEASE_ARCHIVE in ~/.gnupg-autogen.rc.  For example:
26 # RELEASE_ARCHIVE=user@host:archive/tarballs
27 RELEASE_ARCHIVE_SUFFIX  = gnupg/v2.4
28 # The variable RELEASE_SIGNKEY in ~/.gnupg-autogen.rc is used
29 # to specify the key for signing.  For example:
30 # RELEASE_SIGNKEY=D8692123C4065DEA5E0F3AB5249B39D24F25E3B6
31
32
33 # Autoconf flags.
34 ACLOCAL_AMFLAGS = -I m4
35 AM_DISTCHECK_DVI_TARGET = pdf
36 AM_DISTCHECK_CONFIGURE_FLAGS = --enable-gnupg-builddir-envvar \
37   --enable-all-tests --enable-g13 \
38   --enable-gpgtar --enable-wks-tools --disable-ntbtls
39
40 GITLOG_TO_CHANGELOG=gitlog-to-changelog
41
42 EXTRA_DIST = build-aux/config.rpath build-aux/potomo autogen.sh autogen.rc \
43              ChangeLog-2011 po/ChangeLog-2011 build-aux/ChangeLog-2011     \
44              VERSION README.GIT build-aux/gitlog-to-changelog              \
45              COPYING.GPL2 COPYING.LGPL21 COPYING.LGPL3      \
46              COPYING.CC0 COPYING.other                      \
47              build-aux/git-log-fix build-aux/git-log-footer \
48              build-aux/getswdb.sh                           \
49              build-aux/speedo.mk                            \
50              build-aux/speedo/zlib.pc                       \
51              build-aux/speedo/w32/inst-options.ini          \
52              build-aux/speedo/w32/inst.nsi                  \
53              build-aux/speedo/w32/pkg-copyright.txt         \
54              build-aux/speedo/w32/g4wihelp.c                \
55              build-aux/speedo/w32/pango.modules             \
56              build-aux/speedo/w32/gdk-pixbuf-loaders.cache  \
57              build-aux/speedo/w32/exdll.h                   \
58              build-aux/speedo/w32/exdll.c                   \
59              build-aux/speedo/w32/README.txt                \
60              build-aux/speedo/w32/gnupg-logo-150x57.bmp     \
61              build-aux/speedo/w32/gnupg-logo-164x314.bmp    \
62              build-aux/speedo/w32/wixlib.wxs                \
63              build-aux/speedo/patches/atk-1.32.0.patch      \
64              build-aux/speedo/patches/libiconv-1.14.patch   \
65              build-aux/speedo/patches/pango-1.29.4.patch    \
66              build-aux/speedo/patches/sqlite.patch
67
68
69 DISTCLEANFILES = g10defs.h
70
71 if BUILD_GPG
72 gpg = g10
73 else
74 gpg =
75 endif
76 if BUILD_GPGSM
77 sm = sm
78 else
79 sm =
80 endif
81 if BUILD_AGENT
82 agent = agent
83 else
84 agent =
85 endif
86 if BUILD_SCDAEMON
87 scd = scd
88 else
89 scd =
90 endif
91 if BUILD_G13
92 g13 = g13
93 else
94 g13 =
95 endif
96 if BUILD_DIRMNGR
97 dirmngr = dirmngr
98 else
99 dirmngr =
100 endif
101 if BUILD_DOC
102 doc = doc
103 else
104 doc =
105 endif
106 if DISABLE_TESTS
107 tests =
108 else
109 tests = tests
110 endif
111 if BUILD_TPM2D
112 tpm2d = tpm2d
113 else
114 tpm2d =
115 endif
116
117 SUBDIRS = m4 common regexp kbx \
118           ${gpg} ${sm} ${agent} ${scd} ${g13} ${dirmngr} \
119           tools po ${doc} ${tests} ${tpm2d}
120
121 dist_doc_DATA = README
122
123
124 # Create test directory etc/gnupg so that we have an
125 # empty sysconfdir and bin where we put out gpgconf.ctl.
126 # we also put symlinks to the actual binaries there.
127 # Unfortunately there is no all-hook, but symlinks have the
128 # nice property that they can be created even for not yet
129 # created files.
130 all-local:
131         @-$(MKDIR_P) bin etc/gnupg libexec
132         @cat $(srcdir)/tests/gpgconf.ctl.in > bin/gpgconf.ctl
133         (set -e; cd bin; \
134          for i in gpg gpgv; \
135              do ln -sf ../g10/$$i$(EXEEXT) .; done; \
136          for i in gpgsm; \
137              do ln -sf ../sm/$$i$(EXEEXT) .; done; \
138          for i in gpg-agent; \
139              do ln -sf ../agent/$$i$(EXEEXT) .; done; \
140          for i in dirmngr; \
141              do ln -sf ../dirmngr/$$i$(EXEEXT) .; done; \
142          for i in gpgconf gpg-connect-agent gpgtar gpg-card; \
143              do ln -sf ../tools/$$i$(EXEEXT) .; done; \
144          cd ../libexec ; \
145          for i in keyboxd; \
146              do ln -sf ../kbx/$$i$(EXEEXT) .; done; \
147          for i in scdaemon; \
148              do ln -sf ../scd/$$i$(EXEEXT) .; done; \
149          for i in gpg-preset-passphrase; \
150              do ln -sf ../agent/$$i$(EXEEXT) .; done; \
151          for i in tpm2daemon; \
152              do [ -f ../tpm2d/$$i$(EXEEXT) ] && ln -sf ../tpm2d/$$i$(EXEEXT) .; done; \
153          echo "created links to binaries" )
154
155
156 # Clean up our test directories but take care that this is never
157 # called from / or /usr/local
158 distclean-local:
159         @if pwd | grep gnupg 2>/dev/null; then rm -rf etc bin libexec; fi
160
161
162 dist-hook: gen-ChangeLog
163
164 distcheck-hook:
165         set -e; ( \
166         pref="#+macro: gnupg24_" ;\
167         reldate="$$(date -u +%Y-%m-%d)" ;\
168         echo "$${pref}ver  $(PACKAGE_VERSION)"  ;\
169         echo "$${pref}date $${reldate}" ;\
170         list='$(DIST_ARCHIVES)'; for i in $$list; do \
171           case "$$i" in *.tar.bz2) \
172             echo "$${pref}size $$(wc -c <$$i|awk '{print int($$1/1024)}')k" ;\
173             echo "$${pref}sha1 $$(sha1sum <$$i|cut -d' ' -f1)" ;\
174             echo "$${pref}sha2 $$(sha256sum <$$i|cut -d' ' -f1)" ;;\
175           esac;\
176         done ) | tee $(distdir).swdb
177
178
179 if HAVE_W32_SYSTEM
180 install-data-hook:
181         set -e; \
182         for i in $$($(top_srcdir)/build-aux/potomo \
183                      --get-linguas $(top_srcdir)/po) ; do \
184            $(MKDIR_P) "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES" || true; \
185            rm -f "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/gnupg2.mo" \
186                                                  2>/dev/null || true; \
187            $(top_srcdir)/build-aux/potomo $(top_srcdir)/po/$$i.po \
188               "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/gnupg2.mo" ; \
189         done
190 endif
191
192
193 gen_start_date = 2011-12-01T06:00:00
194 .PHONY: gen-ChangeLog
195 gen-ChangeLog:
196         if test -e $(top_srcdir)/.git; then                             \
197           (cd $(top_srcdir) &&                                          \
198             $(GITLOG_TO_CHANGELOG) --append-dot --tear-off              \
199             --amend=build-aux/git-log-fix                               \
200             --since=$(gen_start_date) ) > $(distdir)/cl-t;              \
201           cat $(top_srcdir)/build-aux/git-log-footer >> $(distdir)/cl-t;  \
202           rm -f $(distdir)/ChangeLog;                                   \
203           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
204         fi
205
206
207 stowinstall:
208         $(MAKE) $(AM_MAKEFLAGS) install prefix=/usr/local/stow/gnupg
209
210 TESTS_ENVIRONMENT = \
211         LC_ALL=C \
212         EXEEXT=$(EXEEXT) \
213         PATH=$(abs_top_builddir)/tests/gpgscm:$(PATH) \
214         abs_top_srcdir=$(abs_top_srcdir) \
215         objdir=$(abs_top_builddir) \
216         GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
217         GNUPG_IN_TEST_SUITE=fact \
218         GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
219
220 .PHONY: check-all release sign-release
221 check-all:
222         $(TESTS_ENVIRONMENT) \
223           $(abs_top_builddir)/tests/gpgscm/gpgscm$(EXEEXT) \
224           $(abs_srcdir)/tests/run-tests.scm $(TESTFLAGS) $(TESTS)
225
226 # Names of to help the release target.
227 RELEASE_NAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
228 RELEASE_W32_STEM_NAME = $(PACKAGE_TARNAME)-w32-$(PACKAGE_VERSION)
229
230 release:
231         +(set -e;\
232          if [ "$(abs_top_builddir)" = "$(abs_top_srcdir)" ]; then \
233            echo "error: build directory must not be the source directory" >&2;\
234            exit 2;\
235          fi ;\
236          echo "/* Build started at $$(date -uIseconds) */" ;\
237          [ -n "$(WITH_MSI)" ] && echo "/* (with MSI build support) */" ;\
238          cd $(top_srcdir); \
239          ./autogen.sh --force; \
240          cd $(abs_top_builddir); \
241          rm -rf dist; mkdir dist ; cd dist ; \
242          mkopt=""; \
243          if [ -n "$$CUSTOM_SWDB" ]; then \
244             mkopt="CUSTOM_SWB=1"; \
245             x=$$(grep '^OVERRIDE_TARBALLS=' \
246                  $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
247             if [ -f "$$x/swdb.lst" ]; then \
248               echo "/* Copying swdb.lst from the overrides directory */"; \
249               cp "$$x/swdb.lst" . ; \
250               cp "$$x/swdb.lst.sig" . ; \
251             fi; \
252          fi; \
253          echo "/* Running configure */";\
254          $(abs_top_srcdir)/configure --enable-maintainer-mode; \
255          echo "/* Running make distcheck */";\
256          $(MAKE) distcheck TESTFLAGS=--parallel; \
257          echo "/* Unpacking release */";\
258          $(AMTAR) xjf $(RELEASE_NAME).tar.bz2 ;\
259          target=w32-release ;\
260          [ -n "$(WITH_MSI)" ] && target=w32-msi-release ;\
261          echo "/* Running $(MAKE) -f  $(RELEASE_NAME)/build-aux/speedo.mk $${target} */";\
262          $(MAKE) -f  $(RELEASE_NAME)/build-aux/speedo.mk $${target} ;\
263          echo "/* Build finished at $$(date -uIseconds) */" ;\
264          echo "/*" ;\
265          echo " * Please run the final step interactively:" ;\
266          echo " *   make sign-release $${WITH_MSI:+WITH_MSI=1}" ;\
267          echo " */" ;\
268         ) 2>&1 | tee "$(RELEASE_NAME).buildlog"
269
270 sign-release:
271          +(set -e; \
272           test $$(pwd | sed 's,.*/,,') = dist || cd dist; \
273           x=$$(grep '^RELEASE_ARCHIVE=' $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
274           if [ -z "$$x" ]; then \
275              echo "error: RELEASE_ARCHIVE missing in ~/.gnupg-autogen.rc">&2; \
276              exit 2;\
277           fi;\
278           myarchive="$$x/$(RELEASE_ARCHIVE_SUFFIX)";\
279           x=$$(grep '^RELEASE_SIGNKEY=' $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
280           if [ -z "$$x" ]; then \
281              echo "error: RELEASE_SIGNKEY missing in ~/.gnupg-autogen.rc">&2; \
282              exit 2;\
283           fi;\
284           mysignkey="$$x";\
285           release_w32_name="$(RELEASE_W32_STEM_NAME)_$$(date -u +%Y%m%d)" ;\
286           files1="$(RELEASE_NAME).tar.bz2 \
287                   $${release_w32_name}.tar.xz \
288                   $${release_w32_name}.exe" ;\
289           files2="$(RELEASE_NAME).tar.bz2.sig \
290                   $(RELEASE_NAME).swdb \
291                   $(RELEASE_NAME).buildlog \
292                   $${release_w32_name}.tar.xz.sig \
293                   $${release_w32_name}.exe.sig    \
294                   $${release_w32_name}.exe.swdb" ;\
295           wixlibfile="$${release_w32_name}.wixlib";\
296           $(MAKE) -f $(RELEASE_NAME)/build-aux/speedo.mk w32-sign-installer ;\
297           echo "/* Signing the source tarball ..." ;\
298           gpg -sbu $$mysignkey $(RELEASE_NAME).tar.bz2 ;\
299           echo "/* Signing the W32 source tarball ..." ;\
300           gpg -sbu $$mysignkey $${release_w32_name}.tar.xz ;\
301           echo "/* Signing the W32 installer ..." ;\
302           gpg -sbu $$mysignkey $${release_w32_name}.exe ;\
303           if [ -e $${wixlibfile} ]; then \
304               echo "/* Signing the Wixlib ..." ;\
305               gpg -sbu $$mysignkey $${wixlibfile} ;\
306           fi; \
307           cat $(RELEASE_NAME).swdb >swdb.snippet;\
308           echo '#+macro: gnupg24_branch  STABLE-BRANCH-2-4' >>swdb.snippet;\
309           cat  $${release_w32_name}.exe.swdb >>swdb.snippet;\
310           echo >>swdb.snippet ;\
311           sha1sum $${files1} >>swdb.snippet ;\
312           cat "../$(RELEASE_NAME).buildlog" swdb.snippet \
313                | gzip >$(RELEASE_NAME).buildlog ;\
314           echo "Release created - copying it to the archive ..." ;\
315           scp -p $${files1} $${files2} $$myarchive/ \
316             || echo "/* Error copying files to the archive - ignored */" ;\
317           if [ -e $${wixlibfile} ]; then\
318             scp -p $${wixlibfile} $${wixlibfile}.sig $$myarchive/ \
319               || echo "/* Error copying wixlib to the archive - ignored. */" ;\
320           fi ;\
321           echo '/*' ;\
322           echo ' * All done; for checksums see dist/swdb.snippet' ;\
323           echo ' */' ;\
324          )