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