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