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