gpg: Fix detection of the AEAD feature flag.
[gnupg.git] / g10 / Makefile.am
1 # Copyright (C) 1998, 1999, 2000, 2001, 2002,
2 #               2003, 2006, 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 EXTRA_DIST = distsigkey.gpg \
22              ChangeLog-2011 gpg-w32info.rc \
23              gpg.w32-manifest.in test.c t-keydb-keyring.kbx \
24              t-keydb-get-keyblock.gpg t-stutter-data.asc \
25              all-tests.scm
26
27 AM_CPPFLAGS =
28
29 include $(top_srcdir)/am/cmacros.am
30
31 AM_CFLAGS = $(SQLITE3_CFLAGS) $(LIBGCRYPT_CFLAGS) \
32             $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS)
33
34 needed_libs = ../kbx/libkeybox.a $(libcommon)
35
36 # Because there are no program specific transform macros we need to
37 # work around that to allow installing gpg as gpg2.
38 gpg2_hack_list = gpg gpgv
39 if USE_GPG2_HACK
40 gpg2_hack_uninst = gpg2 gpgv2
41 use_gpg2_hack = yes
42 else
43 gpg2_hack_uninst = $(gpg2_hack_list)
44 use_gpg2_hack = no
45 endif
46
47 # NB: We use noinst_ for gpg and gpgv so that we can install them with
48 # the install-hook target under the name gpg2/gpgv2.
49 noinst_PROGRAMS = gpg
50 if !HAVE_W32CE_SYSTEM
51 noinst_PROGRAMS += gpgv
52 endif
53 if MAINTAINER_MODE
54 noinst_PROGRAMS += gpgcompose
55 endif
56 noinst_PROGRAMS += $(module_tests)
57 TESTS = $(module_tests)
58 TESTS_ENVIRONMENT = \
59         abs_top_srcdir=$(abs_top_srcdir)
60
61 if ENABLE_BZIP2_SUPPORT
62 bzip2_source = compress-bz2.c
63 else
64 bzip2_source =
65 endif
66
67 if ENABLE_CARD_SUPPORT
68 card_source = card-util.c
69 else
70 card_source =
71 endif
72
73 if NO_TRUST_MODELS
74 trust_source =
75 else
76 trust_source = trustdb.c trustdb.h tdbdump.c tdbio.c tdbio.h
77 endif
78
79 if USE_TOFU
80 tofu_source = tofu.h tofu.c gpgsql.c gpgsql.h
81 else
82 tofu_source =
83 endif
84
85
86 if HAVE_W32_SYSTEM
87 resource_objs += gpg-w32info.o
88
89 gpg-w32info.o : gpg.w32-manifest
90
91 endif
92
93 common_source =  \
94               gpg.h             \
95               dek.h             \
96               build-packet.c    \
97               compress.c        \
98               $(bzip2_source)   \
99               filter.h          \
100               free-packet.c     \
101               getkey.c          \
102               keydb.c keydb.h    \
103               keyring.c keyring.h \
104               seskey.c          \
105               kbnode.c          \
106               main.h            \
107               mainproc.c        \
108               armor.c           \
109               mdfilter.c        \
110               textfilter.c      \
111               progress.c        \
112               misc.c            \
113               rmd160.c rmd160.h \
114               options.h         \
115               openfile.c        \
116               keyid.c           \
117               packet.h          \
118               parse-packet.c    \
119               cpr.c             \
120               plaintext.c       \
121               sig-check.c       \
122               keylist.c         \
123               pkglue.c pkglue.h \
124               ecdh.c
125
126 gpg_sources = server.c          \
127               $(common_source)  \
128               pkclist.c         \
129               skclist.c         \
130               pubkey-enc.c      \
131               passphrase.c      \
132               decrypt.c         \
133               decrypt-data.c    \
134               cipher-cfb.c      \
135               cipher-aead.c     \
136               encrypt.c         \
137               sign.c            \
138               verify.c          \
139               revoke.c          \
140               dearmor.c         \
141               import.c          \
142               export.c          \
143               migrate.c         \
144               delkey.c          \
145               keygen.c          \
146               helptext.c        \
147               keyserver.c       \
148               keyserver-internal.h \
149               call-dirmngr.c call-dirmngr.h \
150               photoid.c photoid.h \
151               call-agent.c call-agent.h \
152               trust.c $(trust_source) $(tofu_source) \
153               $(card_source) \
154               exec.c exec.h \
155               key-check.c key-check.h
156
157 gpg_SOURCES  = gpg.c \
158         keyedit.c keyedit.h     \
159         $(gpg_sources)
160
161 gpgcompose_SOURCES  = gpgcompose.c  $(gpg_sources)
162 gpgv_SOURCES = gpgv.c           \
163               $(common_source)  \
164               verify.c
165
166 #gpgd_SOURCES = gpgd.c \
167 #              ks-proto.h \
168 #              ks-proto.c \
169 #              ks-db.c \
170 #              ks-db.h \
171 #              $(common_source)
172
173 LDADD =  $(needed_libs) ../common/libgpgrl.a \
174          $(ZLIBS) $(LIBINTL) $(CAPLIBS) $(NETLIBS)
175 gpg_LDADD = $(LDADD) $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS) $(LIBREADLINE) \
176              $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
177              $(LIBICONV) $(resource_objs) $(extra_sys_libs)
178 gpg_LDFLAGS = $(extra_bin_ldflags)
179 gpgv_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) \
180               $(GPG_ERROR_LIBS) \
181               $(LIBICONV) $(resource_objs) $(extra_sys_libs)
182 gpgv_LDFLAGS = $(extra_bin_ldflags)
183
184 gpgcompose_LDADD = $(LDADD) $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS) $(LIBREADLINE) \
185              $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
186              $(LIBICONV) $(resource_objs) $(extra_sys_libs)
187 gpgcompose_LDFLAGS = $(extra_bin_ldflags)
188
189 t_common_ldadd =
190 module_tests = t-rmd160 t-keydb t-keydb-get-keyblock t-stutter
191 t_rmd160_SOURCES = t-rmd160.c rmd160.c
192 t_rmd160_LDADD = $(t_common_ldadd)
193 t_keydb_SOURCES = t-keydb.c test-stubs.c $(common_source)
194 t_keydb_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
195               $(LIBICONV) $(t_common_ldadd)
196 t_keydb_get_keyblock_SOURCES = t-keydb-get-keyblock.c test-stubs.c \
197               $(common_source)
198 t_keydb_get_keyblock_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
199               $(LIBICONV) $(t_common_ldadd)
200 t_stutter_SOURCES = t-stutter.c test-stubs.c \
201               $(common_source)
202 t_stutter_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
203               $(LIBICONV) $(t_common_ldadd)
204
205
206 $(PROGRAMS): $(needed_libs) ../common/libgpgrl.a
207
208 # NB: To install gpg and gpgv we use this -hook.  This code has to
209 # duplicate most of the automake generated install-binPROGRAMS target
210 # so that directories are created and the transform feature works.
211 install-exec-hook:
212         @echo "running install-exec-hook"; \
213         echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
214         $(MKDIR_P) "$(DESTDIR)$(bindir)"; \
215         for p in $(gpg2_hack_list); do \
216           echo "$$p$(EXEEXT) $$p$(EXEEXT)"; done | \
217         sed 's/$(EXEEXT)$$//' | \
218         while read p p1; do if test -f $$p \
219           ; then echo "$$p"; echo "$$p"; else :; fi; \
220         done | \
221         sed -e 'p;s,.*/,,;n;h' \
222             -e 's|.*|.|' \
223             -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
224         sed 'N;N;N;s,\n, ,g' | \
225         $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
226           { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
227             if ($$2 == $$4) files[d] = files[d] " " $$1; \
228             else { print "f", $$3 "/" $$4, $$1; } } \
229           END { for (d in files) print "f", d, files[d] }' | \
230         while read type dir files; do \
231             for f in $$files; do \
232                if test $(use_gpg2_hack) = yes ; \
233                  then f2=`echo "$${f}" | sed 's/$(EXEEXT)$$//'`2$(EXEEXT); \
234                  else f2="$${f}" ;\
235                fi ; \
236                echo "$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \
237                      $${f} '$(DESTDIR)$(bindir)/$${f2}'"; \
238                $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \
239                      $${f} "$(DESTDIR)$(bindir)/$${f2}"; \
240             done; \
241         done
242
243
244 install-data-local:
245         $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
246         $(INSTALL_DATA) $(srcdir)/distsigkey.gpg \
247                                 $(DESTDIR)$(pkgdatadir)/distsigkey.gpg
248
249 # NB: For uninstalling gpg and gpgv we use -local because there is
250 # no need for a specific order the targets need to be run.
251 uninstall-local:
252         -@rm $(DESTDIR)$(pkgdatadir)/distsigkey.gpg
253         -@files=`for p in $(gpg2_hack_uninst); do echo "$$p"; done | \
254           sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
255               -e 's/$$/$(EXEEXT)/' \
256         `; \
257         echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
258         cd "$(DESTDIR)$(bindir)" && rm -f $$files