agent: Stop scdaemon after reload when disable_scdaemon.
[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               objcache.c objcache.h \
125               ecdh.c
126
127 gpg_sources = server.c          \
128               $(common_source)  \
129               pkclist.c         \
130               skclist.c         \
131               pubkey-enc.c      \
132               passphrase.c      \
133               decrypt.c         \
134               decrypt-data.c    \
135               cipher-cfb.c      \
136               cipher-aead.c     \
137               encrypt.c         \
138               sign.c            \
139               verify.c          \
140               revoke.c          \
141               dearmor.c         \
142               import.c          \
143               export.c          \
144               migrate.c         \
145               delkey.c          \
146               keygen.c          \
147               helptext.c        \
148               keyserver.c       \
149               keyserver-internal.h \
150               call-dirmngr.c call-dirmngr.h \
151               photoid.c photoid.h \
152               call-agent.c call-agent.h \
153               trust.c $(trust_source) $(tofu_source) \
154               $(card_source) \
155               exec.c exec.h \
156               key-clean.c key-clean.h \
157               key-check.c key-check.h
158
159 gpg_SOURCES  = gpg.c \
160         keyedit.c keyedit.h     \
161         $(gpg_sources)
162
163 gpgcompose_SOURCES  = gpgcompose.c  $(gpg_sources)
164 gpgv_SOURCES = gpgv.c           \
165               $(common_source)  \
166               verify.c
167
168 #gpgd_SOURCES = gpgd.c \
169 #              ks-proto.h \
170 #              ks-proto.c \
171 #              ks-db.c \
172 #              ks-db.h \
173 #              $(common_source)
174
175 LDADD =  $(needed_libs) ../common/libgpgrl.a \
176          $(ZLIBS) $(LIBINTL) $(CAPLIBS) $(NETLIBS)
177 gpg_LDADD = $(LDADD) $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS) $(LIBREADLINE) \
178              $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
179              $(LIBICONV) $(resource_objs) $(extra_sys_libs)
180 gpg_LDFLAGS = $(extra_bin_ldflags)
181 gpgv_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) \
182               $(GPG_ERROR_LIBS) \
183               $(LIBICONV) $(resource_objs) $(extra_sys_libs)
184 gpgv_LDFLAGS = $(extra_bin_ldflags)
185
186 gpgcompose_LDADD = $(LDADD) $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS) $(LIBREADLINE) \
187              $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
188              $(LIBICONV) $(resource_objs) $(extra_sys_libs)
189 gpgcompose_LDFLAGS = $(extra_bin_ldflags)
190
191 t_common_ldadd =
192 module_tests = t-rmd160 t-keydb t-keydb-get-keyblock t-stutter
193 t_rmd160_SOURCES = t-rmd160.c rmd160.c
194 t_rmd160_LDADD = $(t_common_ldadd)
195 t_keydb_SOURCES = t-keydb.c test-stubs.c $(common_source)
196 t_keydb_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
197               $(LIBICONV) $(t_common_ldadd)
198 t_keydb_get_keyblock_SOURCES = t-keydb-get-keyblock.c test-stubs.c \
199               $(common_source)
200 t_keydb_get_keyblock_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
201               $(LIBICONV) $(t_common_ldadd)
202 t_stutter_SOURCES = t-stutter.c test-stubs.c \
203               $(common_source)
204 t_stutter_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
205               $(LIBICONV) $(t_common_ldadd)
206
207
208 $(PROGRAMS): $(needed_libs) ../common/libgpgrl.a
209
210 # NB: To install gpg and gpgv we use this -hook.  This code has to
211 # duplicate most of the automake generated install-binPROGRAMS target
212 # so that directories are created and the transform feature works.
213 install-exec-hook:
214         @echo "running install-exec-hook"; \
215         echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
216         $(MKDIR_P) "$(DESTDIR)$(bindir)"; \
217         for p in $(gpg2_hack_list); do \
218           echo "$$p$(EXEEXT) $$p$(EXEEXT)"; done | \
219         sed 's/$(EXEEXT)$$//' | \
220         while read p p1; do if test -f $$p \
221           ; then echo "$$p"; echo "$$p"; else :; fi; \
222         done | \
223         sed -e 'p;s,.*/,,;n;h' \
224             -e 's|.*|.|' \
225             -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
226         sed 'N;N;N;s,\n, ,g' | \
227         $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
228           { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
229             if ($$2 == $$4) files[d] = files[d] " " $$1; \
230             else { print "f", $$3 "/" $$4, $$1; } } \
231           END { for (d in files) print "f", d, files[d] }' | \
232         while read type dir files; do \
233             for f in $$files; do \
234                if test $(use_gpg2_hack) = yes ; \
235                  then f2=`echo "$${f}" | sed 's/$(EXEEXT)$$//'`2$(EXEEXT); \
236                  else f2="$${f}" ;\
237                fi ; \
238                echo "$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \
239                      $${f} '$(DESTDIR)$(bindir)/$${f2}'"; \
240                $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \
241                      $${f} "$(DESTDIR)$(bindir)/$${f2}"; \
242             done; \
243         done
244
245
246 install-data-local:
247         $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
248         $(INSTALL_DATA) $(srcdir)/distsigkey.gpg \
249                                 $(DESTDIR)$(pkgdatadir)/distsigkey.gpg
250
251 # NB: For uninstalling gpg and gpgv we use -local because there is
252 # no need for a specific order the targets need to be run.
253 uninstall-local:
254         -@rm $(DESTDIR)$(pkgdatadir)/distsigkey.gpg
255         -@files=`for p in $(gpg2_hack_uninst); do echo "$$p"; done | \
256           sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
257               -e 's/$$/$(EXEEXT)/' \
258         `; \
259         echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
260         cd "$(DESTDIR)$(bindir)" && rm -f $$files