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