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