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