Imported Upstream version 2.1.9
[platform/upstream/gpg2.git] / common / Makefile.am
1 # Makefile for common gnupg modules
2 # Copyright (C) 2001, 2003, 2007, 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 = mkstrtable.awk exaudit.awk exstatus.awk ChangeLog-2011 \
22              audit-events.h status-codes.h ChangeLog.jnlib \
23              ChangeLog-2011.include w32info-rc.h.in gnupg.ico tls-ca.pem
24
25 noinst_LIBRARIES = libcommon.a libcommonpth.a libgpgrl.a \
26                    libcommontls.a libcommontlsnpth.a
27 if !HAVE_W32CE_SYSTEM
28 noinst_LIBRARIES += libsimple-pwquery.a
29 endif
30 noinst_PROGRAMS = $(module_tests) $(module_maint_tests)
31 TESTS = $(module_tests)
32
33 BUILT_SOURCES = audit-events.h status-codes.h
34
35 MAINTAINERCLEANFILES = audit-events.h status-codes.h
36
37 AM_CPPFLAGS =
38
39 AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBASSUAN_CFLAGS) $(KSBA_CFLAGS)
40
41 include $(top_srcdir)/am/cmacros.am
42
43
44 common_sources = \
45         common-defs.h \
46         util.h i18n.c i18n.h \
47         types.h host2net.h dynload.h w32help.h \
48         mapstrings.c stringhelp.c stringhelp.h \
49         strlist.c strlist.h \
50         utf8conv.c utf8conv.h \
51         argparse.c argparse.h \
52         logging.c logging.h  \
53         dotlock.c dotlock.h  \
54         mischelp.c mischelp.h \
55         status.c status.h\
56         shareddefs.h \
57         openpgpdefs.h \
58         gc-opt-flags.h \
59         keyserver.h \
60         sexp-parse.h \
61         tlv.c tlv.h \
62         init.c init.h \
63         sexputil.c \
64         sysutils.c sysutils.h \
65         homedir.c \
66         gettime.c gettime.h \
67         yesno.c \
68         b64enc.c b64dec.c zb32.c \
69         convert.c \
70         percent.c \
71         mbox-util.c mbox-util.h \
72         miscellaneous.c \
73         xasprintf.c \
74         xreadline.c \
75         membuf.c membuf.h \
76         iobuf.c iobuf.h \
77         ttyio.c ttyio.h \
78         asshelp.c asshelp2.c asshelp.h \
79         exechelp.h \
80         signal.c \
81         audit.c audit.h \
82         srv.h \
83         localename.c \
84         session-env.c session-env.h \
85         userids.c userids.h \
86         openpgp-oid.c \
87         ssh-utils.c ssh-utils.h \
88         agent-opt.c \
89         helpfile.c \
90         mkdir_p.c mkdir_p.h
91
92 if HAVE_W32_SYSTEM
93 common_sources += w32-reg.c w32-afunix.c w32-afunix.h
94 endif
95
96 # Sources possible requiring a TLS library are put into a separate
97 # conveince library.
98 tls_sources = \
99         http.c http.h
100
101
102 # To make the code easier to read we have split home some code into
103 # separate source files.
104 if HAVE_W32_SYSTEM
105 if HAVE_W32CE_SYSTEM
106 common_sources += exechelp-w32ce.c
107 else
108 common_sources += exechelp-w32.c
109 endif
110 else
111 common_sources += exechelp-posix.c
112 endif
113
114 # Sources only useful without NPTH.
115 without_npth_sources = \
116         get-passphrase.c get-passphrase.h
117
118
119 libcommon_a_SOURCES = $(common_sources) $(without_npth_sources)
120 if USE_DNS_SRV
121 libcommon_a_SOURCES += srv.c
122 endif
123 libcommon_a_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_CFLAGS) -DWITHOUT_NPTH=1
124
125 libcommonpth_a_SOURCES = $(common_sources)
126 if USE_DNS_SRV
127 libcommonpth_a_SOURCES += srv.c
128 endif
129 libcommonpth_a_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_CFLAGS) $(NPTH_CFLAGS)
130
131 libcommontls_a_SOURCES = $(tls_sources)
132 libcommontls_a_CFLAGS = $(AM_CFLAGS) $(LIBGNUTLS_CFLAGS) -DWITHOUT_NPTH=1
133
134 libcommontlsnpth_a_SOURCES = $(tls_sources)
135 libcommontlsnpth_a_CFLAGS = $(AM_CFLAGS) $(LIBGNUTLS_CFLAGS) $(NPTH_CFLAGS)
136
137 if !HAVE_W32CE_SYSTEM
138 libsimple_pwquery_a_SOURCES = \
139         simple-pwquery.c simple-pwquery.h asshelp.c asshelp.h
140 libsimple_pwquery_a_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_CFLAGS)
141 endif
142
143 libgpgrl_a_SOURCES = \
144         gpgrlhelp.c
145
146 if MAINTAINER_MODE
147 # Note: Due to the dependency on Makefile, the file will always be
148 # rebuilt, so we allow this only in maintainer mode.
149
150 # Create the audit-events.h include file from audit.h
151 # Note: We create the target file in the source directory because it
152 # is a distributed built source.  If we would not do that we may end
153 # up with two files and then it is not clear which version of the
154 # files will be picked up.
155 audit-events.h: Makefile.am mkstrtable.awk exaudit.awk audit.h
156         $(AWK) -f $(srcdir)/exaudit.awk $(srcdir)/audit.h \
157           | $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 -v nogettext=1 \
158                    -v namespace=eventstr_  > $(srcdir)/audit-events.h
159
160 # Create the status-codes.h include file from status.h
161 status-codes.h: Makefile.am mkstrtable.awk exstatus.awk status.h
162         $(AWK) -f $(srcdir)/exstatus.awk $(srcdir)/status.h \
163           | $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 -v nogettext=1 \
164                    -v namespace=statusstr_  > $(srcdir)/status-codes.h
165 endif
166
167 #
168 # Module tests
169 #
170 module_tests = t-stringhelp t-timestuff \
171                t-convert t-percent t-gettime t-sysutils t-sexputil \
172                t-session-env t-openpgp-oid t-ssh-utils \
173                t-mapstrings t-zb32 t-mbox-util t-iobuf
174 if !HAVE_W32CE_SYSTEM
175 module_tests += t-exechelp
176 endif
177 if HAVE_W32_SYSTEM
178 module_tests += t-w32-reg
179 endif
180
181 if MAINTAINER_MODE
182 module_maint_tests = t-helpfile t-b64 t-http
183 else
184 module_maint_tests =
185 endif
186
187 t_extra_src = t-support.h
188
189 t_common_cflags = $(KSBA_CFLAGS) $(LIBGCRYPT_CFLAGS) \
190                   $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS)
191 t_common_ldadd = libcommon.a \
192                  $(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
193                  $(LIBINTL) $(LIBICONV)
194
195
196 # Common tests
197 t_stringhelp_SOURCES = t-stringhelp.c $(t_extra_src)
198 t_stringhelp_LDADD = $(t_common_ldadd)
199
200 t_timestuff_SOURCES = t-timestuff.c $(t_extra_src)
201 t_timestuff_LDADD = $(t_common_ldadd)
202
203 t_convert_LDADD = $(t_common_ldadd)
204 t_percent_LDADD = $(t_common_ldadd)
205 t_gettime_LDADD = $(t_common_ldadd)
206 t_sysutils_LDADD = $(t_common_ldadd)
207 t_helpfile_LDADD = $(t_common_ldadd)
208 t_sexputil_LDADD = $(t_common_ldadd)
209 t_b64_LDADD = $(t_common_ldadd)
210 t_exechelp_LDADD = $(t_common_ldadd)
211 t_session_env_LDADD = $(t_common_ldadd)
212 t_openpgp_oid_LDADD = $(t_common_ldadd)
213 t_ssh_utils_LDADD = $(t_common_ldadd)
214 t_mapstrings_LDADD = $(t_common_ldadd)
215 t_zb32_LDADD = $(t_common_ldadd)
216 t_mbox_util_LDADD = $(t_common_ldadd)
217 t_iobuf_LDADD = $(t_common_ldadd)
218
219 # System specific test
220 if HAVE_W32_SYSTEM
221 t_w32_reg_SOURCES = t-w32-reg.c $(t_extra_src)
222 t_w32_reg_LDADD   = $(t_common_ldadd)
223 endif
224
225 # http tests
226 t_http_SOURCES = t-http.c
227 t_http_CFLAGS  = $(t_common_cflags) $(NTBTLS_CFLAGS) $(LIBGNUTLS_CFLAGS)
228 t_http_LDADD   = libcommontls.a $(t_common_ldadd) \
229                  $(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) $(DNSLIBS)
230
231 # All programs should depend on the created libs.
232 $(PROGRAMS) : libcommon.a libcommonpth.a libcommontls.a libcommontlsnpth.a