1# Makefile.am - dirmngr
2# Copyright (C) 2002 Klarälvdalens Datakonsult AB
3# Copyright (C) 2004, 2007, 2010 g10 Code GmbH
4#
5# This file is part of GnuPG.
6#
7# GnuPG is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# GnuPG is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, see <https://www.gnu.org/licenses/>.
19#
20# SPDX-License-Identifier: GPL-3.0+
21
22## Process this file with automake to produce Makefile.in
23
24EXTRA_DIST = OAUTHORS ONEWS ChangeLog-2011 tls-ca.pem
25dist_pkgdata_DATA = sks-keyservers.netCA.pem
26
27bin_PROGRAMS = dirmngr dirmngr-client
28
29if USE_LDAP
30libexec_PROGRAMS = dirmngr_ldap
31else
32libexec_PROGRAMS =
33endif
34
35noinst_PROGRAMS = $(module_tests) $(module_net_tests) $(module_maint_tests)
36if DISABLE_TESTS
37TESTS =
38else
39TESTS = $(module_tests) $(module_net_tests)
40endif
41
42AM_CPPFLAGS =
43
44include $(top_srcdir)/am/cmacros.am
45
46AM_CFLAGS = $(USE_C99_CFLAGS) \
47            $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS) $(LIBASSUAN_CFLAGS)	\
48            $(GPG_ERROR_CFLAGS) $(NPTH_CFLAGS) $(NTBTLS_CFLAGS)		\
49            $(LIBGNUTLS_CFLAGS)
50
51
52if HAVE_W32_SYSTEM
53ldap_url = ldap-url.h ldap-url.c
54else
55ldap_url =
56endif
57
58noinst_HEADERS = dirmngr.h crlcache.h crlfetch.h misc.h
59
60dirmngr_SOURCES = dirmngr.c dirmngr.h server.c crlcache.c crlfetch.c	\
61	certcache.c certcache.h \
62	domaininfo.c \
63	workqueue.c \
64	loadswdb.c \
65	cdb.h cdblib.c misc.c dirmngr-err.h dirmngr-status.h \
66	ocsp.c ocsp.h validate.c validate.h  \
67	dns-stuff.c dns-stuff.h \
68	http.c http.h http-common.c http-common.h http-ntbtls.c \
69	ks-action.c ks-action.h ks-engine.h \
70	ks-engine-hkp.c ks-engine-http.c ks-engine-finger.c ks-engine-kdns.c
71
72if USE_LIBDNS
73dirmngr_SOURCES += dns.c dns.h
74endif
75
76if USE_LDAP
77dirmngr_SOURCES += ldapserver.h ldapserver.c ldap.c w32-ldap-help.h \
78                   ldap-wrapper.h ldap-parse-uri.c ldap-parse-uri.h \
79                   ldap-misc.c ldap-misc.h \
80                   ks-engine-ldap.c $(ldap_url) ldap-wrapper.c
81ldaplibs = $(LDAPLIBS)
82else
83ldaplibs =
84endif
85
86
87dirmngr_LDADD = $(libcommonpth) \
88        $(DNSLIBS) $(LIBASSUAN_LIBS) \
89	$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(NPTH_LIBS) \
90	$(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) $(LIBINTL) $(LIBICONV) $(NETLIBS)
91if USE_LDAP
92dirmngr_LDADD += $(ldaplibs)
93endif
94dirmngr_LDFLAGS = $(extra_bin_ldflags)
95
96if USE_LDAP
97dirmngr_ldap_SOURCES = dirmngr_ldap.c ldap-misc.c ldap-misc.h $(ldap_url)
98dirmngr_ldap_CFLAGS = $(GPG_ERROR_CFLAGS) $(LIBGCRYPT_CFLAGS)
99dirmngr_ldap_LDFLAGS =
100dirmngr_ldap_LDADD = $(libcommon) \
101		     $(GPG_ERROR_LIBS) $(LIBGCRYPT_LIBS) $(LDAPLIBS) \
102		     $(LBER_LIBS) $(LIBINTL) $(LIBICONV) $(NETLIBS)
103endif
104
105dirmngr_client_SOURCES = dirmngr-client.c
106dirmngr_client_LDADD = $(libcommon) \
107                       $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
108                       $(LIBGCRYPT_LIBS) $(NETLIBS) $(LIBINTL) $(LIBICONV)
109dirmngr_client_LDFLAGS = $(extra_bin_ldflags)
110
111
112t_common_src = t-support.h t-support.c
113if USE_LIBDNS
114t_common_src += dns.c dns.h
115endif
116t_common_ldadd = $(libcommon) $(LIBASSUAN_LIBS) $(LIBGCRYPT_LIBS) \
117                 $(GPG_ERROR_LIBS) $(NETLIBS) \
118                 $(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) \
119                 $(DNSLIBS) $(LIBINTL) $(LIBICONV)
120
121module_tests = t-http-basic
122
123if USE_LDAP
124module_tests += t-ldap-parse-uri t-ldap-misc
125endif
126
127# Test which need a network connections are only used in maintainer mode.
128if MAINTAINER_MODE
129module_net_tests = t-dns-stuff
130else
131module_net_tests =
132endif
133
134# Tests which are only for manually testing are only build in maintainer-mode.
135if MAINTAINER_MODE
136module_maint_tests = t-http
137else
138module_maint_tests =
139endif
140
141
142# http tests
143# We need to add the KSBA flags in case we are building against GNUTLS.
144# In that case NTBTLS flags are empty, but we need ksba anyway.
145t_http_SOURCES = $(t_common_src) t-http.c http.c dns-stuff.c http-common.c
146t_http_CFLAGS  = -DWITHOUT_NPTH=1  $(USE_C99_CFLAGS) \
147	         $(LIBGCRYPT_CFLAGS) $(NTBTLS_CFLAGS) $(LIBGNUTLS_CFLAGS) \
148                 $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS) $(KSBA_CFLAGS)
149t_http_LDADD   = $(t_common_ldadd) \
150	         $(NTBTLS_LIBS) $(KSBA_LIBS) $(LIBGNUTLS_LIBS) $(DNSLIBS)
151
152t_http_basic_SOURCES = $(t_common_src) t-http-basic.c http.c \
153	               dns-stuff.c http-common.c
154t_http_basic_CFLAGS  = -DWITHOUT_NPTH=1  $(USE_C99_CFLAGS) \
155	         $(LIBGCRYPT_CFLAGS) $(NTBTLS_CFLAGS) $(LIBGNUTLS_CFLAGS) \
156                 $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS) $(KSBA_CFLAGS)
157t_http_basic_LDADD   = $(t_common_ldadd) \
158	         $(NTBTLS_LIBS) $(KSBA_LIBS) $(LIBGNUTLS_LIBS) $(DNSLIBS)
159
160t_ldap_parse_uri_SOURCES = \
161	t-ldap-parse-uri.c ldap-parse-uri.c ldap-parse-uri.h \
162        http.c http-common.c dns-stuff.c ldap-misc.c \
163        $(ldap_url) $(t_common_src)
164t_ldap_parse_uri_CFLAGS = -DWITHOUT_NPTH=1  $(USE_C99_CFLAGS) \
165			  $(LIBGCRYPT_CFLAGS) \
166                          $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS) $(KSBA_CFLAGS)
167t_ldap_parse_uri_LDADD = $(ldaplibs) $(t_common_ldadd) $(DNSLIBS)
168
169t_ldap_misc_SOURCES = t-ldap-misc.c ldap-misc.c ldap-misc.h $(ldap_url)
170t_ldap_misc_CFLAGS = -DWITHOUT_NPTH=1 $(GPG_ERROR_CFLAGS) $(LIBGCRYPT_CFLAGS)
171t_ldap_misc_LDFLAGS =
172t_ldap_misc_LDADD = $(libcommon) \
173		     $(GPG_ERROR_LIBS) $(LIBGCRYPT_LIBS) $(LDAPLIBS) \
174		     $(LBER_LIBS) $(LIBINTL) $(LIBICONV) $(NETLIBS)
175
176
177t_dns_stuff_CFLAGS = -DWITHOUT_NPTH=1  $(USE_C99_CFLAGS) \
178		     $(LIBGCRYPT_CFLAGS) \
179	             $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS)
180t_dns_stuff_SOURCES = $(t_common_src) t-dns-stuff.c dns-stuff.c
181t_dns_stuff_LDADD   = $(t_common_ldadd) $(DNSLIBS)
182
183$(PROGRAMS) : $(libcommon) $(libcommonpth)
184