]> git.ipfire.org Git - thirdparty/glibc.git/blob - resolv/Makefile
31658202d3c9d68fac68b59a08f284b2fabb9b96
[thirdparty/glibc.git] / resolv / Makefile
1 # Copyright (C) 1994-2021 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
13
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
17
18 #
19 # Sub-makefile for resolv portion of the library.
20 #
21 subdir := resolv
22
23 include ../Makeconfig
24
25 headers := resolv.h bits/types/res_state.h \
26 netdb.h bits/netdb.h \
27 arpa/nameser.h arpa/nameser_compat.h \
28 sys/bitypes.h
29
30 routines := \
31 dn_comp \
32 dn_expand \
33 dn_skipname \
34 herror \
35 inet_addr \
36 inet_ntop \
37 inet_pton \
38 ns_makecanon \
39 ns_name_compress \
40 ns_name_ntop \
41 ns_name_pack \
42 ns_name_pton \
43 ns_name_skip \
44 ns_name_uncompress \
45 ns_name_unpack \
46 ns_samename \
47 nsap_addr \
48 res-close \
49 res-name-checking \
50 res-state \
51 res_context_hostalias \
52 res_enable_icmp \
53 res_get_nsaddr \
54 res_hconf \
55 res_init \
56 res_libc \
57 res_mkquery \
58 res_nameinquery \
59 res_queriesmatch \
60 res_randomid \
61 res_send \
62 resolv_conf \
63 resolv_context \
64 # routines
65
66 tests = tst-aton tst-leaks tst-inet_ntop
67 tests-container = tst-leaks2
68
69 tests-internal += tst-inet_aton_exact
70
71
72 generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
73
74 extra-libs := libresolv libnss_dns
75 ifeq ($(have-thread-library),yes)
76 extra-libs += libanl
77 routines += gai_sigqueue
78
79 tests += \
80 tst-bug18665 \
81 tst-bug18665-tcp \
82 tst-ns_name \
83 tst-ns_name_compress \
84 tst-ns_name_pton \
85 tst-res_hconf_reorder \
86 tst-res_hnok \
87 tst-resolv-basic \
88 tst-resolv-binary \
89 tst-resolv-edns \
90 tst-resolv-network \
91 tst-resolv-nondecimal \
92 tst-resolv-res_init-multi \
93 tst-resolv-search \
94 tst-resolv-trailing \
95
96 # This test calls __res_context_send directly, which is not exported
97 # from libresolv.
98 tests-internal += tst-resolv-txnid-collision
99 tests-static += tst-resolv-txnid-collision
100
101 # These tests need libdl.
102 ifeq (yes,$(build-shared))
103 tests += \
104 tst-resolv-ai_idn \
105 tst-resolv-ai_idn-latin1 \
106 tst-resolv-ai_idn-nolibidn2 \
107 tst-resolv-canonname \
108 tst-resolv-trustad \
109
110 # Needs resolv_context.
111 tests-internal += \
112 tst-resolv-res_init \
113 tst-resolv-res_init-thread \
114 tst-resolv-res_ninit \
115 tst-resolv-threads \
116
117 # Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
118 # providing any functions in libidn2.so.0).
119 modules-names += tst-no-libidn2
120 extra-test-objs += tst-no-libidn2.os
121 LDFLAGS-tst-no-libidn2.so = -Wl,-soname,libidn2.so.0
122
123 endif # $(build-shared)
124
125 # This test accesses __inet_ntop_length, an internal libc function.
126 tests-internal += tst-inet_pton
127
128 # This test accesses the __p_secstodate compat symbol.
129 ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
130 tests += tst-p_secstodate
131 endif
132
133 # This test sends millions of packets and is rather slow.
134 xtests += tst-resolv-qtypes
135
136 # This test has dropped packet tests and runs for a long time.
137 xtests += tst-resolv-rotate
138 endif
139 extra-libs-others = $(extra-libs)
140 libresolv-routines := \
141 base64 \
142 compat-gethnamaddr \
143 compat-hooks \
144 inet_net_ntop \
145 inet_net_pton \
146 inet_neta \
147 ns_date \
148 ns_name \
149 ns_netint \
150 ns_parse \
151 ns_print \
152 ns_samedomain \
153 ns_ttl \
154 res-putget \
155 res_data \
156 res_debug \
157 res_hostalias \
158 res_isourserver \
159 res_query \
160 resolv-deprecated \
161 # libresolv-routines
162
163 $(libanl-routines-var) += \
164 gai_cancel \
165 gai_error \
166 gai_misc \
167 gai_notify \
168 gai_suspend \
169 getaddrinfo_a \
170 # $(libanl-routines-var)
171
172 libanl-routines += libanl-compat
173 libanl-shared-only-routines += libanl-compat
174
175 subdir-dirs = nss_dns
176 vpath %.c nss_dns
177
178 libnss_dns-routines := \
179 dns-canon \
180 dns-host \
181 dns-network \
182 # libnss_dns-routines
183
184 libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
185 ifeq ($(build-static-nss),yes)
186 routines += $(libnss_dns-routines) $(libresolv-routines)
187 static-only-routines += $(libnss_dns-routines) $(libresolv-routines)
188 endif
189
190 ifeq ($(run-built-tests),yes)
191 ifneq (no,$(PERL))
192 tests-special += $(objpfx)mtrace-tst-leaks.out $(objpfx)mtrace-tst-leaks2.out \
193 $(objpfx)mtrace-tst-resolv-res_ninit.out
194 endif
195 endif
196
197 generated += mtrace-tst-leaks.out tst-leaks.mtrace \
198 mtrace-tst-leaks2.out tst-leaks2.mtrace \
199 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
200
201 include ../Rules
202
203 LOCALES := en_US.UTF-8 en_US.ISO-8859-1
204 include ../gen-locales.mk
205
206 CFLAGS-res_hconf.c += -fexceptions
207
208 # The DNS NSS modules needs the resolver.
209 $(objpfx)libnss_dns.so: $(objpfx)libresolv.so
210
211 # The asynchronous name lookup code needs the thread library.
212 $(objpfx)libanl.so: $(shared-thread-library)
213
214 $(objpfx)tst-res_hconf_reorder: $(shared-thread-library)
215 tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
216
217 $(objpfx)tst-leaks: $(objpfx)libresolv.so
218 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
219 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
220 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
221 $(evaluate-test)
222
223 tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace
224 $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
225 { test -r $(objpfx)tst-leaks2.mtrace \
226 || ( echo "tst-leaks2.mtrace does not exist"; exit 77; ) \
227 && $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace; } > $@; \
228 $(evaluate-test)
229
230 tst-resolv-res_ninit-ENV = MALLOC_TRACE=$(objpfx)tst-resolv-res_ninit.mtrace
231 $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
232 $(common-objpfx)malloc/mtrace \
233 $(objpfx)tst-resolv-res_ninit.mtrace > $@; \
234 $(evaluate-test)
235
236 $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
237 $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
238 $(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
239 $(objpfx)tst-resolv-ai_idn-latin1: \
240 $(objpfx)libresolv.so $(shared-thread-library)
241 $(objpfx)tst-resolv-ai_idn-nolibidn2: \
242 $(objpfx)libresolv.so $(shared-thread-library)
243 $(objpfx)tst-resolv-ai_idn.out: $(gen-locales)
244 $(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)
245 $(objpfx)tst-resolv-ai_idn-nolibidn2.out: \
246 $(gen-locales) $(objpfx)tst-no-libidn2.so
247 $(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)
248 $(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)
249 $(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)
250 $(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)
251 $(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so
252 $(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \
253 $(shared-thread-library)
254 $(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \
255 $(shared-thread-library)
256 $(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)
257 $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
258 $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)
259 $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
260 $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
261 $(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)
262 $(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
263 $(static-thread-library)
264 $(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)
265 $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
266
267 $(objpfx)tst-ns_name: $(objpfx)libresolv.so
268 $(objpfx)tst-ns_name.out: tst-ns_name.data
269 $(objpfx)tst-ns_name_compress: $(objpfx)libresolv.so
270 $(objpfx)tst-ns_name_pton: $(objpfx)libresolv.so
271 $(objpfx)tst-res_hnok: $(objpfx)libresolv.so
272 $(objpfx)tst-p_secstodate: $(objpfx)libresolv.so