build: Build gpgcompose only in maintainer mode
[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 <http://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 installaing 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 $(module_tests)
54 endif
55 TESTS = $(module_tests)
56
57 if ENABLE_BZIP2_SUPPORT
58 bzip2_source = compress-bz2.c
59 else
60 bzip2_source =
61 endif
62
63 if ENABLE_CARD_SUPPORT
64 card_source = card-util.c
65 else
66 card_source =
67 endif
68
69 if NO_TRUST_MODELS
70 trust_source =
71 else
72 trust_source = trustdb.c trustdb.h tdbdump.c tdbio.c tdbio.h
73 endif
74
75 if USE_TOFU
76 tofu_source = tofu.h tofu.c sqlite.c sqlite.h
77 else
78 tofu_source =
79 endif
80
81
82 if HAVE_W32_SYSTEM
83 resource_objs += gpg-w32info.o
84
85 gpg-w32info.o : gpg.w32-manifest
86
87 endif
88
89 common_source =  \
90               gpg.h             \
91               dek.h             \
92               build-packet.c    \
93               compress.c        \
94               $(bzip2_source)   \
95               filter.h          \
96               free-packet.c     \
97               getkey.c          \
98               keydb.c keydb.h    \
99               keyring.c keyring.h \
100               seskey.c          \
101               kbnode.c          \
102               main.h            \
103               mainproc.c        \
104               armor.c           \
105               mdfilter.c        \
106               textfilter.c      \
107               progress.c        \
108               misc.c            \
109               rmd160.c rmd160.h \
110               options.h         \
111               openfile.c        \
112               keyid.c           \
113               packet.h          \
114               parse-packet.c    \
115               cpr.c             \
116               plaintext.c       \
117               sig-check.c       \
118               keylist.c         \
119               pkglue.c pkglue.h \
120               ecdh.c
121
122 gpg_sources = server.c          \
123               $(common_source)  \
124               pkclist.c         \
125               skclist.c         \
126               pubkey-enc.c      \
127               passphrase.c      \
128               decrypt.c         \
129               decrypt-data.c    \
130               cipher.c          \
131               encrypt.c         \
132               sign.c            \
133               verify.c          \
134               revoke.c          \
135               dearmor.c         \
136               import.c          \
137               export.c          \
138               migrate.c         \
139               delkey.c          \
140               keygen.c          \
141               helptext.c        \
142               keyserver.c       \
143               keyserver-internal.h \
144               call-dirmngr.c call-dirmngr.h \
145               photoid.c photoid.h \
146               call-agent.c call-agent.h \
147               trust.c $(trust_source) $(tofu_source) \
148               $(card_source) \
149               exec.c exec.h
150
151 gpg_SOURCES  = gpg.c \
152         keyedit.c       \
153         $(gpg_sources)
154
155 gpgcompose_SOURCES  = gpgcompose.c  $(gpg_sources)
156 gpgv_SOURCES = gpgv.c           \
157               $(common_source)  \
158               verify.c \
159               dearmor.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