Debian Codegraph @

resolv/Makefile

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 # Copyright (C) 1994-2026 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 dns-canon \
35 dns-host \
36 dns-network \
37 herror \
38 inet_addr \
39 inet_ntop \
40 inet_pton \
41 inet_pton_length \
42 ns_makecanon \
43 ns_name_compress \
44 ns_name_length_uncompressed \
45 ns_name_ntop \
46 ns_name_pack \
47 ns_name_pton \
48 ns_name_skip \
49 ns_name_uncompress \
50 ns_name_unpack \
51 ns_rr_cursor_init \
52 ns_rr_cursor_next \
53 ns_samebinaryname \
54 ns_samename \
55 nsap_addr \
56 nss_dns_functions \
57 res-close \
58 res-name-checking \
59 res-noaaaa \
60 res-state \
61 res_context_hostalias \
62 res_enable_icmp \
63 res_get_nsaddr \
64 res_hconf \
65 res_init \
66 res_libc \
67 res_mkquery \
68 res_nameinquery \
69 res_queriesmatch \
70 res_query \
71 res_randomid \
72 res_send \
73 resolv_conf \
74 resolv_context \
75 # routines
76
77 # Exclude fortified routines from being built with _FORTIFY_SOURCE
78 routines_no_fortify += \
79 inet_pton \
80 # routines_no_fortify
81
82 tests = tst-aton tst-leaks tst-inet_ntop
83 tests-container += \
84 tst-getaddrinfo-eai-again \
85 tst-leaks2 \
86 # tests-container
87
88 tests-internal += tst-inet_aton_exact
89
90
91 generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
92
93 extra-libs := libresolv libnss_dns
94 ifeq ($(have-thread-library),yes)
95 routines += gai_sigqueue
96
97 tests += \
98 tst-bug18665 \
99 tst-bug18665-tcp \
100 tst-inet_addr-binary \
101 tst-ns_name \
102 tst-ns_name_compress \
103 tst-ns_name_pton \
•104 tst-ns_sprintrr \
105 tst-res_hconf_reorder \
106 tst-res_hnok \
107 tst-resolv-aliases \
108 tst-resolv-basic \
109 tst-resolv-binary \
110 tst-resolv-byaddr \
•111 tst-resolv-dns-section \
112 tst-resolv-edns \
113 tst-resolv-invalid-cname \
•114 tst-resolv-invalid-ptr \
115 tst-resolv-network \
116 tst-resolv-noaaaa \
117 tst-resolv-noaaaa-vc \
118 tst-resolv-nondecimal \
119 tst-resolv-res_init-multi \
120 tst-resolv-search \
121 tst-resolv-semi-failure \
122 tst-resolv-short-response \
123 tst-resolv-trailing \
•124 # tests
125
126 # This test calls __res_context_send directly, which is not exported
127 # from libresolv.
128 tests-internal += tst-resolv-txnid-collision
129 tests-static += tst-resolv-txnid-collision
130
131 # Likewise for __ns_samebinaryname.
132 tests-internal += tst-ns_samebinaryname
133 tests-static += tst-ns_samebinaryname
134
135 # Likewise for __ns_name_length_uncompressed.
136 tests-internal += tst-ns_name_length_uncompressed
137 tests-static += tst-ns_name_length_uncompressed
138
139 # Likewise for struct ns_rr_cursor and its functions.
140 tests-internal += tst-ns_rr_cursor
141 tests-static += tst-ns_rr_cursor
142
143 # These tests need libdl.
144 ifeq (yes,$(build-shared))
145 tests += \
146 tst-getaddrinfo-eai-again-timeout \
147 tst-resolv-af-unspec-noerror-nodata \
148 tst-resolv-ai_idn \
149 tst-resolv-ai_idn-latin1 \
150 tst-resolv-ai_idn-nolibidn2 \
151 tst-resolv-canonname \
152 tst-resolv-getaddrinfo-fqdn \
153 tst-resolv-trustad \
154
155 # Needs resolv_context.
156 tests-internal += \
157 tst-resolv-res_init \
158 tst-resolv-res_init-thread \
159 tst-resolv-res_ninit \
160 tst-resolv-threads \
161
162 # Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
163 # providing any functions in libidn2.so.0).
164 modules-names += tst-no-libidn2
165 extra-test-objs += tst-no-libidn2.os
166 LDFLAGS-tst-no-libidn2.so = -Wl,-soname,libidn2.so.0
167
168 endif # $(build-shared)
169
170 # This test accesses __inet_ntop_length, an internal libc function.
171 tests-internal += tst-inet_pton
172
173 # This test accesses the __p_secstodate compat symbol.
174 ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
175 tests += tst-p_secstodate
176 endif
177
178 # This test sends millions of packets and is rather slow.
179 xtests += tst-resolv-qtypes
180
181 # This test has dropped packet tests and runs for a long time.
182 xtests += tst-resolv-rotate
183 endif # $(have-thread-library)
184
185 extra-libs-others = $(extra-libs)
186 libresolv-routines := \
187 base64 \
188 compat-gethnamaddr \
189 compat-hooks \
190 inet_net_ntop \
191 inet_net_pton \
192 inet_neta \
193 ns_date \
194 ns_name \
195 ns_netint \
196 ns_parse \
197 ns_print \
198 ns_samedomain \
199 ns_ttl \
200 res-putget \
201 res_data \
202 res_debug \
203 res_hostalias \
204 res_isourserver \
205 resolv-deprecated \
206 # libresolv-routines
207
208 ifeq ($(have-anl-library),yes)
209 # Empty compatibility library for old binaries.
210 extra-libs += libanl
211 libanl-routines += libanl-compat
212 libanl-shared-only-routines += libanl-compat
213 endif
214
215 $(libanl-routines-var) += \
216 gai_cancel \
217 gai_error \
218 gai_misc \
219 gai_notify \
220 gai_suspend \
221 getaddrinfo_a \
222 # $(libanl-routines-var)
223
224 # Pretend that libanl.so is a linker script, so that the symbolic link
225 # is not installed.
226 install-lib-ldscripts = libanl.so
227 $(inst_libdir)/libanl.so:
228
229 subdir-dirs = nss_dns
230 vpath %.c nss_dns
231
232 # Build only an empty shared libnss_dns.
233 libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
234
235 # Pretend that libnss_dns.so is a linker script, so that the symbolic link
236 # is not installed.
237 install-lib-ldscripts = libnss_dns.so
238 $(inst_libdir)/libnss_dns.so:
239
240 ifeq ($(run-built-tests),yes)
241 ifneq (no,$(PERL))
242 tests-special += $(objpfx)mtrace-tst-leaks.out $(objpfx)mtrace-tst-leaks2.out \
243 $(objpfx)mtrace-tst-resolv-res_ninit.out
244 endif
245 endif
246
247 generated += mtrace-tst-leaks.out tst-leaks.mtrace \
248 mtrace-tst-leaks2.out tst-leaks2.mtrace \
249 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
250
251 include ../Rules
252
253 LOCALES := en_US.UTF-8 en_US.ISO-8859-1
254 include ../gen-locales.mk
255
256 CFLAGS-res_hconf.c += -fexceptions
257
258 # The DNS NSS modules needs the resolver.
259 $(objpfx)libnss_dns.so: $(objpfx)libresolv.so
260
261 # The asynchronous name lookup code needs the thread library.
262 $(objpfx)libanl.so: $(shared-thread-library)
263
264 $(objpfx)tst-res_hconf_reorder: $(shared-thread-library)
265 tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
266
267 $(objpfx)tst-leaks: $(objpfx)libresolv.so
268 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
269 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
270 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
271 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
272 $(evaluate-test)
273
274 tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace \
275 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
276 $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
277 { test -r $(objpfx)tst-leaks2.mtrace \
278 || ( echo "tst-leaks2.mtrace does not exist"; exit 77; ) \
279 && $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace; } > $@; \
280 $(evaluate-test)
281
282 tst-resolv-res_ninit-ENV = MALLOC_TRACE=$(objpfx)tst-resolv-res_ninit.mtrace \
283 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
284 $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
285 $(common-objpfx)malloc/mtrace \
286 $(objpfx)tst-resolv-res_ninit.mtrace > $@; \
287 $(evaluate-test)
288
289 $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
290 $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
291 $(objpfx)tst-resolv-af-unspec-noerror-nodata: \
292 $(objpfx)libresolv.so $(shared-thread-library)
293 $(objpfx)tst-getaddrinfo-eai-again-timeout: \
294 $(objpfx)libresolv.so $(shared-thread-library)
295 $(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
296 $(objpfx)tst-resolv-ai_idn-latin1: \
297 $(objpfx)libresolv.so $(shared-thread-library)
298 $(objpfx)tst-resolv-ai_idn-nolibidn2: \
299 $(objpfx)libresolv.so $(shared-thread-library)
300 $(objpfx)tst-resolv-ai_idn.out: $(gen-locales)
301 $(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)
302 $(objpfx)tst-resolv-ai_idn-nolibidn2.out: \
303 $(gen-locales) $(objpfx)tst-no-libidn2.so
304 $(objpfx)tst-resolv-aliases: $(objpfx)libresolv.so $(shared-thread-library)
305 $(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)
306 $(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)
307 $(objpfx)tst-resolv-byaddr: $(objpfx)libresolv.so $(shared-thread-library)
•308 $(objpfx)tst-resolv-dns-section: $(objpfx)libresolv.so \
309 $(shared-thread-library)
310 $(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)
311 $(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)
312 $(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so
313 $(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \
314 $(shared-thread-library)
315 $(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \
316 $(shared-thread-library)
317 $(objpfx)tst-resolv-invalid-cname: $(objpfx)libresolv.so \
318 $(shared-thread-library)
•319 $(objpfx)tst-resolv-invalid-ptr: $(objpfx)libresolv.so \
320 $(shared-thread-library)
321 $(objpfx)tst-resolv-noaaaa: $(objpfx)libresolv.so $(shared-thread-library)
322 $(objpfx)tst-resolv-noaaaa-vc: $(objpfx)libresolv.so $(shared-thread-library)
323 $(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)
324 $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
325 $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)
326 $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
327 $(objpfx)tst-resolv-semi-failure: $(objpfx)libresolv.so \
328 $(shared-thread-library)
329 $(objpfx)tst-resolv-short-response: $(objpfx)libresolv.so \
330 $(shared-thread-library)
331 $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
332 $(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)
333 $(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
334 $(static-thread-library)
335 $(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)
336 $(objpfx)tst-resolv-getaddrinfo-fqdn: $(objpfx)libresolv.so $(shared-thread-library)
337 $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
338
339 $(objpfx)tst-ns_name: $(objpfx)libresolv.so
340 $(objpfx)tst-ns_name.out: tst-ns_name.data
341 $(objpfx)tst-ns_name_compress: $(objpfx)libresolv.so
342 $(objpfx)tst-ns_name_pton: $(objpfx)libresolv.so
•343 $(objpfx)tst-ns_sprintrr: $(objpfx)libresolv.so
344 $(objpfx)tst-res_hnok: $(objpfx)libresolv.so
345 $(objpfx)tst-p_secstodate: $(objpfx)libresolv.so