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